PureBytes Links
Trading Reference Links
|
Onno
> I am currently developing a new end of day trading system.
>
> This trading system needs two conditions to go long and two other
> conditions to go short.
>
> So if the two long-conditions are true, you receive a "buy" pulse.
> And if the two short-conditions are true, you receive a "sell" pulse.
>
> But instead of receiving pulses, I want like to make an indicator that
> tells me: long position and short position.
> In other words: I am looking for a way to change the pulses (signals)
> into a binary wave (position).
>
> Thanks in advance for your help!
As long as you don't introduce an entry dependent exit condition then this
piece of code will work fine. The 'R' variable is essentially two latches,
one for long trades and one for short trades. A value of "+2" is assigned to
a long trade and a value of "-1" is assigned to a short trade. It won't
matter if long and short trades are synchronised or not because the logic
tells us the following three things.
1. R=0 indicates no trades are in progress.
2. R>0 indicates a long trade is in progress.
3. Abs(R)=1 indicates a short trade is in progress.
So you can see that it is very easy to be able to decipher the 'R' variable
to tell us exactly what is happening . Hope this helps.
Roy
N:=Fml("your long entry");
X:=Fml("your long exit");
M:=Fml("your short entry");
Y:=Fml("your short exit");
I:=Cum(M+N+X+Y>-1)=1;
R:=If(BarsSince(I OR N)>= BarsSince(I OR X),0,2)+
If(BarsSince(I OR M)>= BarsSince(I OR Y),0,-1);
A:=Abs(R)=1; {long trade binary signal}
B:=R>0; {short trade binary signal}
R;
|