Using multiple apply stops

@colombianflag, the code is wrong (and will not execute).

There is no "precedence" parameter in the ApplyStop() function. Please, review its syntax.

From the comments section of the ApplyStop guide page:

If two or more different stops are triggered on the VERY SAME bar then they are evaluated in this fixed order:
Fixed Ruin stop (loosing 99.96% of the starting capital)
Max. loss stop
Profit target stop
Trailing stop
N-bar stop

Moreover, usually, there is no reason to call it with the stopModeDisable flag, if you did not enable a specific type of stop elsewhere in your code or in your configuration.

To change the above order see the SetStopPrecedence() function documentation.

P.S. When are posting some code you should always use the </> button in the forum text editor - see the:

Enter the AFL code properly

section "How to use this site" thread.

2 Likes