Vary ApplyStop Profit Percents during Backtest

I want to be able to vary stopTypeProfit percent values based upon the given time.
For example, between 093000 < 094000, I want the stopPercent = 1.0, while when
TimeNum >= 094000, I want the stopPercent = 0.5.

Does anyone know how to do this?

Example code of what I tried is below...

ProfitPctVal = ( TimeNum() >= 094000 AND TimeNum() <= 160000 ) * 0.5 ;
ProfitPctVal = ( TimeNum() >= 093000 AND TimeNum() <  094000 ) * 1.0;

ApplyStop( stopTypeProfit,  stopModePercent , ProfitPctVal, ExitAtStop = 1 );   

Thanks for your help in these matters...

You need to use Volatile stop (Volatile parameter set to True), see manual http://www.amibroker.com/f?applystop

1 Like