I am trying to code a opening range breakout strategy (OBR) (code attached). My stop1 is 1 ATR away and my profit1 is 2 ATR away. To scale out progressively, I have the same entry with my stop2 1 ATR away and my profit2 3 ATR away.
Once the first profit target is reached, I would like to enter the market with a trailing stop 1ATR away from closing, and cancel stop2 and profit2 (in this chronological order so that I always have a stoploss order active).
I have tried both with ExitShortStopMarket and with SetStopLoss methods (only for shorting in the code). The later I am not even able to use, it doesn't work when I set the stop and limit (code line in comment) By the way what's the difference between these two?
Can you help me out with this please?
Thank you very much.
Best,
Comment