[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Crossover position



PureBytes Links

Trading Reference Links

Jim

I was more trying to give some ideas than come up with a definitive answer.
As long as you understand the difference in output between a cross of two
signals and a comparison of two signals then you can use one or the other,
or a combination of both, to get the required result.

A Cross() function will produce a binary result that looks like this;
______/\__________

A comparison (> or <) of the same signals will produce a binary result that
looks like this;
______/--------\____ or
------\________/----

How you use and combine these results logically is up to you. If you have
trouble getting a mental picture of how the various logical signals work
together then it may help you to draw the signals on a piece of paper.
Better still create each individual expression (as an indicator) in a series
of small inner windows on a test chart. This can be a very useful exercise
in seeing how all the pieces fit together. Having a visual image to work
with can be a very powerful tool.

I use Alert() for binary signals in the same way that most people use Ref().
Typically I am testing for a signal that is true (1) today but was false (0)
yesterday. However Alert() won't extend a binary false, only a binary true.
So in English the expression "a=0 AND b AND Alert(b=0,2)" means "The test
for 'a' is false (reverse cross has occurred), and the test for 'b' is true
(cross has occurred), and on the previous bar 'b' was false (cross had not
occurred)". I have extended the false from 'b' by one bar so that I generate
a one bar spike to signal the first bar only when 'b' is true.

Ref() adds an N/A period to the expression that it is used in, while Alert()
does not. This can be a big problem when Ref() is used in a number of
variables within an indicator.

Roy

> Thanks for answering.
> The formula below with the cross does not work.
> I think this is because it will not see the cross as it is past tense.
>
> The first formula is the way to go, although I see what the Alert is there
for, it doesn't seem to work as advertized either, in fact there must be
something I don't understand about the alert function as I have tried in the
past to get to work with no luck.
>
> Thanks again.
> Jim
> ______________
> Jim
> Try this for your Enter Short
> a:=RSI(5)>WillR(20)*(-1);
> b:=WillR(30)*(-1)>RSI(24);
> a=0 AND b AND Alert(b=0,2);
>
> you could also write this as
> a:=RSI(5)>WillR(20)*(-1);
> a=0 AND Cross(WillR(30)*(-1),RSI(24));
>
> The Cross() picks out the leading edge of a condition but sometimes it is
more useful to have access to the logical 'state' of an expression (one side
compared to the other), not just the cross. In the code above I am looking
for the state of "a" to be zero, and using "b" in the way I have to still
effectively signals a Cross by detecting the leading edge of "b". You can
still use a cross if you want, as in the second example.
>
> Roy
>
>
> > I wonder if this has been addressed before. I'm at a loss as to how
> > to
> code it.
> >
> > Below is the system test.
> > The problem is that there is a different condition for the buy than
> > there
> is for the sell.
> > What I would like to have happen is for the "ENTER LONG" Condition to
> always go long and once that condition crosses back and if the condition
of the "ENTER SHORT" condition has already crossed, then the system would go
short.
> >
> > What is happening is that if the "ENTER LONG" position crosses back
> > over
> ( and no longer meets the criteria for a long position, and the "ENTER
SHORT" position has already crossed over, then it will not take a short
position, even though both conditions are in a short mode.
> >
> >
> > Enter LONG / Exit SHORT
> > Cross(RSI(5),(WillR(20)*(-1)))
> >
> > Enter SHORT / Exit LONG
> > Cross(WillR(30)*(-1)),RSI(24)
> >
> > Thanks,
> >
> > Jim
> >
> >
> >
> >
>
>
>