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

Trailingstop & applystop



PureBytes Links

Trading Reference Links

Tz,

I understand that the applystop can be used with a buyprice and a 
sellprice.
I can have a Long system with:

Buy= Binary bar;
Sell= Binary bar;
Buyprice = Close ( default) or a buystop; 
Sellprice= trailingstop;
ApplyStop( 1, 2, 
Optimize( "min. Profit stop level", 4, 2, 10, 1 )*MA(ATR(1),10), 1 );
ApplyStop( 0, 2, 
Optimize( "max. loss stop level", 4, 2, 10, 1 )*MA(ATR(1),10), 1 );


Is It possible to have in the further two functions for volatility 
trailing stop, of course we can write them in Afl scripting language,
But I am sure that all the Ami's users are not "cool" with Jscript oc 
basic.

Volatility trailing stop on the Long side.

Stop:=C-ATR(Period);
BandLong:=If(L<=PREV, {if stop reached?}
Stop, {yes: restart plot }
If(Stop>PREV, { no: if new stop>prev stop?}
Stop, {yes: plot new higher stop }
PREV) { no: plot previous stop}
);
ExitLong:=(L <= ref(BandLong,-1));

Volatility trailing stop on the short side.

Trailing Stop Band
The following indicator formula defines a volatility-trailing stop on 
the short side.
Stop:=C+ATR(Period);
BandShort:=If( H >= PREV , {if stop reached?}
Stop , {yes: restart plot }
If(Stop < PREV, {no: if new stop>prev stop?}
Stop, { yes: plot new stop }
PREV) { no: plot previous stop}
);
ExitShort:=(H >= ref(BandShort,-1));

Thanks again and excuse me for all this questions but I like the 
system tester.

Stephane