Setoption in trade

Thanks to all, i need help about setoption, i'm in trouble because i don't reach a solution, I didn't find anything in the various search, so my question is:
-is there a possibility to change the setoption based on the direction of the trade? that is when I go long and I am in trade I would like setoption ("ActivateStopsImmediately", False); when I go short and I'm in trade I would like the option to be: SetOption ("ActivateStopsImmediately", true); and obviously with the relative backtesting.
-I tried in different ways but I didn't succeed
-thanks and I apologize in advance if the problem had already been dealt with

No, SetOption("ActivateStopsImmediately", ...) is a once per-backtest setting. You can't change it on bar by bar basis. If you want things like that you have to write your own stop code

1 Like

could anyone give me a cue? on how the code could be,I really can't handle it, thanks