- ExitLong/ExitShort in OnBarUpdate (CaclculateOnBarClose is true)
- save "ActionAfterFlat"
- in OnPositionUpdate for MarketPosition.Flat with a "ActionAfterFlat" set new Stop Loss & then EnterLong/EnterShort
Works fine in backtest and market replay. In real-time my feeling is that its quit slow and I get some slippage between Exit and Entry.
Is there a chance to do this with OnOrderUpdate?
Idea is to EnterLong/EnterShort without explicit ExitLong/ExitShort and wait e.g. for PendingCancel on (old) Stop Loss Order and then set new Stop Loss before new Stop Order is calculated by NinjaTrader and executed.
What is the best event to do this (Accepted,Working or Filled of ByToCover / Close Position or PendingCancel of
BuyToCover / Stop Loss)? Cancelled of BuyToCover / Stop Loss is executed in my test after Filled of Buy Order (in new direction) and is too late? Is it ok to call SetStopLoss before old Stop Order is canceled?

Comment