Metastock Indicator Formula |
mc - 28/14 breakout + 28/14/1.5 trailing stop |
Breakout system with the addition of a trailing stop. |
Formula: |
a:=H>Ref(HHV(H,14),-1); {high above the highest high of 14 periods}
a2:=C>=Ref(HHV(HHV(H,14)-1.5*ATR(14),28),-1); {price above a trailing stop}
b:=L
b2:=C
sbuy:=a AND a2; {buy signal}
ssell:=b OR b2; {sell signal}
state1:=If(BarsSince(sbuy)
state2:=If(BarsSince(sbuy)>BarsSince(ssell),1,0);
s2buy:=state1>Ref(state1,-1);
s2sell:=state2>Ref(state2,-1);
s2buy-s2sell {final signal: 1 for buy, -1 for sell}
|
|
|