Applystop function with stopModeRisk gives unexpected exit

Hi all,
I tried to implement stopModeRisk, but gets unexpected exit on short trades.
Here is a code example:

SetOption( "InitialEquity", 100000);
SetOption( "FuturesMode", True );

Buy	  = EMA(C,20) > EMA(C,40);
Short = EMA(C,20) < EMA(C,40);

ApplyStop(stopTypeLoss, stopModePoint, 2*ATR(14), 1, 0);
ApplyStop(stopTypeTrailing, stopModeRisk, 20, 1, 0, 0, 15);

I expect that trailing Stop loss activated 15 bars after entry and trail with 20% profit give up.
Applystop function works as expected if Position sets to "Long" or "Short" (not "Long and Short") in the settings.
However, if Both "Long and Short" sets, then short trades trail-exit at the entry bar, regardless of the assigned Bar Delay (here 15).

Here is a screenshot of the resulted report if the position in the setting sets to "Long" only, "Short" only, "Long and Short" both:


I don't know what I did wrong or what might be the problem. As discussed here, it seems that both ReverseSignalForcesExit and AllowSameBarExit will be ignored and set to default "True".
Any comment r advice appreciated.

As it discussed here,
In "stopModePercent" mode, ActivationFloor =10 means 10%,
In "stopModePoint" mode, ActivationFloor =10 means $10,
In "stopModeRisk" mode, what the "ActivationFloor" means?


activationFloor is ONLY for stopModePercent and stopModePoint modes.

Thanks Tomaz,
I double checked and confim that assigning a value to the activationFloor in the stopModePoint mode change the behavior of ApplyStop function.
If activationFloor is only for stopModePercent and stopModePoint modes, then why/how activationFloor affect the ApplyStop function in stopModePoint mode then?

Appritiate any advice on first question.

That is pretty obvious, as I said here, activationFloor is expressed in the same units as amount, so:

  • if you use stopModePoint then activation floor is expressed in DOLLAR MOVEMENT (the same unit as amount)
  • if you use stopModePercent then activation floor is expressed in PERCENT MOVEMENT (the same unit as amount)

Hello again, thanks for the info,

How can I fix the error occurred with stopModeRisk as detailed above

ApplyStop(stopTypeTrailing, stopModeRisk, 20, 1, 0, 0, 15);


See previous responses.

Hi Tomasz, thanks for your reply.
I read your reply a couple of times but didn't understand how you addressed the problem that occurred in the first post.

How the settings should be modified that activation of tSL occurs 15 bars after entry for both short and long trades?


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