As for the stop code, the formula below plots identically and faster (for explorations) with two of the seven PREV functions taken out:
---8<---------------------------------- perc:=Input("Trailing Loss %",0,100,14); loss:=C*perc/100; trail:= If(LLV(C,2)>PREV,Max(PREV,C-loss),
If(HHV(C,2)
entry:=Cross(C,trail);
exit:=Cross(trail,C);
entry-exit
---8<---------------------------------- This formula is even faster with three PREV functions taken out: ---8<---------------------------------- {Input} perc:=Input("Trailing Loss %",0,100,14); {Stops} loss:=C*perc/100; stopLong:=If(C
{Signals}
In:=Cross(C,Ref(stopShort,-1));
Out:=Cross(Ref(stopLong,-1),C);
Init:=Cum(In+Out>-1)=1;
InInit:=Cum(In)=1;
flag:=BarsSince(Init OR In)
< BarsSince(Init OR Out)+InInit;
signals:=(InInit AND Alert(InInit=0,2)
OR flag AND Alert(flag=0,2))
-(flag=0 AND Alert(flag,2));
{Display}
signals
---8<----------------------------------
No comments:
Post a Comment