The code about ApplyStops work in 6.20 version but don't work in 6.30 version

Hello! everyone,
I've just updated from 6.20 to 6.30 and found that a piece of code about ApplyStops don't work anymore, but they work perfectly well in 6.20. Do I make some mistakes? How can I make it work in 6.30? Please help me! Thank you!
This is my code:

Equity( 1, 0 );
InLong = Flip( Buy, Sell );
InShort = Flip(Short, Cover);
Setoption("EverybarNullCheck", True);

LongPPT = Param("LongPPT", 120, 30, 200, 2);
ShortPPT = Param("ShortPPT", 35, 10, 90, 2);
PPT = IIf(InLong, LongPPT, ShortPPT);
ApplyStop(stopTypeProfit, stopModePercent, PPT, 2, False, 0, 0, -1);

LongTrail = (Param("LTATR", 5, 4, 10, 0.5) * ATR(10));
ShortTrail = (Param("STATR", 5, 4, 10, 0.5) * ATR(10));
Trail = IIf(InShort, ShortTrail, LongTrail);
ApplyStop(stopTypeTrailing, stopModePoint, LongTrail, 2, True, 1 );

See this post Apply Stop Issues with different versions.

First of all the code is incorrect. I don't even mean that it is incomplete (missing original Buy/Sell statements so people simply can't use the code to reproduce the problem and as such code you posted is useless without tinkering with it). But why do you call Equity(1, 0 ) then you call Flip() then you call ApplyStops? Equity() call is not needed.

As to the ExitAtStop=2, only today I have found that there was an unintended change in the code that caused ExitAtStop = 2 mode together with backtestRegular not to generate any exits in 6.25.0...6.30.0. This will need to be addressed in next update.

There are 2 workarounds as of now:

  • use SetBacktestMode( backtestRegularRaw );
    OR
  • use ExitAtStop = 1

General reminder: any issues with given version should be reported to either:

This forum receives tons of "noise traffic" and I can't follow each and every random thread for issues that get buried in some Nth reply.

1 Like

Thank you! Tomasz,
I removed Equity(1,0)), and add activationFloor=0 and change ExitAtStop to 1, and it works. Problem solved.
And I seed your reminder. Thank you.

1 Like

Thank you! TrendSurfer
Your reply helps!