Rank: Advanced Member
Groups: Registered, Registered Users Joined: 3/19/2005(UTC) Posts: 2,995
Was thanked: 14 time(s) in 10 post(s)
|
Coding is not my strong point. You'll have to test it with known values (I didn't)...
[code:1:7ef27fb493]STLong:= Ref(LLV(L,30),-1);
StShort:= Ref(HHV(H,30),-1);
stopLong:=If(Cum(1)=1,0,If(C<Ref(C,-1),StLong,Max(StLong,Ref(C,-1))));
stopShort:=If(Cum(1)=1,0,If(C>Ref(C,-1),StShort,Min(StShort,Ref(C,-1))));
ELEntryprice:=ValueWhen(1,H>Ref(HHV(H,30),-1),C);
ELmidlevel:=ELEntryprice-(Ref(HHV(H,30),-1)-Ref(LLV(L,30),-1))/2; {MaxLoss Stop}
ESEntryprice:=ValueWhen(1,L<Ref(LLV(L,30),-1),C);
ESmidlevel:=ESEntryprice+(Ref(HHV(H,30),-1)-Ref(LLV(L,30),-1))/2; {MaxLoss Stop}
LE:=H>Ref(HHV(H,30),-1) AND C>Max(Elmidlevel,stoplong);
SE:= L<Ref(LLV(L,30),-1) AND C<Min(ESmidlevel,stopshort);
LX:=C<ELMidlevel OR C<StopLong;
SX:=C>ESMidlevel OR C>StopShort;
[/code:1:7ef27fb493]
|