Activate Stops Immediately


I see the check box in the Back Tester under the "Stops" tab, "Activate Stops Immediately..."

Can this option be controlled from within the code so that I can have a StopLoss triggered immediately (same bar) after entering on the Open but allow a Profit Target to be executed next bar?

Thank you,



See SetOption function:

SetOption("ActivateStopsImmediately", True);

BTW, your ApplyStop code is incorrect. ReentryDelay is at 6th position.

ApplyStop(stopTypeLoss, stopModePercent, StopLoss, 1, False, ReentryDelay);

Thanks for the correction on the ReentryDelay positioning.

If I set the Option as you suggest, both the Stop Loss and Profit Target are executed immediately. Can the Option be conditioned to be True for a Stop Loss and False for a Profit Target?



Have you tried ValidFrom setting of ApplyStop?
I have posted link to ApplyStop manual in upper message.

AFL Function Reference - APPLYSTOP

ValidFrom -
defines first bar since entry when stop can generate an exit. 0 means from the very beginning

fxshrat...Thank you!..Worked perfectly!!...Mike

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