Incorrect usage of ApplyStop, was: triggering stop loss on next candle

Hi I am new to Amibroker & AFL

I am writing a code for generating buy sell & short cover signals.

Stuck on this stop loss.

my stop loss are two either 100 points or super trend whichever is lower(sell SL)/higher (buy SL). as soon as buy short signal are generated, on the next candle sell and cover are generated.

Sell = (Close < SuperTrend) OR ApplyStop(stopTypeLoss,stopModePoint,100,1,False,0,1,-1); 

Cover = (Close > supertrend) OR ApplyStop(stopTypeLoss,stopModePoint,100,1,False,0,1,-1);



Your code is incorrect.

ApplyStop is NOT returning any value. ApplyStop is a switch for the backtester. It has been explained many many times:

So it works INSIDE THE BACKTESTER and causes BACKTESTER to execute stops while BACKTEST is run.

For ApplyStop to generate exit signals you have to RUN BACKTEST.

For more information READ THE MANUAL about ApplyStop, entirely, including the comments:

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.