Different number of trades taken

Hello,

can you please help me identify following problem - when I switch opton SetOption("ActivateStopsImmediately", True); to False, I get different numbers of trades even though the trades were not stopped on stop-loss.

using this code:

SetOption("InitialEquity",50000);                   
SetOption("AllowSameBarExit", 1);
SetOption("MaxOpenPositions",5);                
SetOption("AccountMargin",100);                   
SetOption("UsePrevBarEquityForPosSizing",False); 
SetOption("AllowPositionShrinking", True);   
SetTradeDelays(1,1,1,1);                             
SetOption("ActivateStopsImmediately", True); 
SetPositionSize(20,spsPercentOfEquity); 

Short = ROC(C,3) > 40 
		AND RSI(3) > 90;

Cover = C<Ref(C,-1);

ApplyStop(stopTypeLoss,stopModePercent,25,1);

and testing stocks XSPA and EYES, range 1.1.2016 - 15.6.2018.

with SetOption("ActivateStopsImmediately", True) I get following trades:

trades1

with SetOption("ActivateStopsImmediately", False) I get following trades:

trades2

Thus there is a difference in the second XSPA trade. But why? The previous XSPA trade was a stop-loss regardless the ActivateStopsImmediately setttings..

Any hint why I am getting the difference?
Can anyone try the backtest on the selected 2 stocks if you get the same results?
Thank you.

I suggest you read this: https://www.amibroker.com/guide/afl/applystop.html

Your second trade in XSPA can only be entered if the previous trade has already been closed. In the first case (ActivateStopsImmediately = True), the entry signals are processed before the stops. In the second case, the stops are processed before the entries.