• A position is open and an order submitted by an exit method (ExitLongLimit() for example) is active and the order is used to open a position in the opposite direction
• A position is open and an order submitted by a set method (SetStopLoss() for example) is active and the order is used to open a position in the opposite direction
• The strategy position is flat and an order submitted by an enter method (EnterLongLimit() for example) is active and the order is used to open a position in the opposite direction
• The entry signal name is not unique
My guess is one of 3 things:
1) In OnOrderUpdate keep a reference to all stop loss order objects and cancel them out first. Then place my stop market order...but if price doesn't get hit within a certain timeframe then I must put my stoploss back in place.
2) Handle placing stoploss orders manually ?
3) Manage the trade in OnEachTick and wait for my predefined price to get hit then place an short market order?
Is there another way to handle this situation? For example I'm long at 50, have a stoploss at 30 but later decide I need to reverse if the market hits 40 but only within a specific timeframe else keep my stoploss in place.
Comment