Thank you for your response.
I would incorporate the use of the Filled or PartFilled OrderStates to achieve the same reset Matthew refers to that is used in the reference. This ensures the stopOrder exists and yes it has been filled, now it can be reset. You can also reset the stop when the entry order for the opposite position is filled.
// Reset our stop order and target orders' IOrder objects after our position is closed. if ((stopOrder != null && stopOrder == execution.Order) || (targetOrder != null && targetOrder == execution.Order)) { if (execution.Order.OrderState == OrderState.Filled || execution.Order.OrderState == OrderState.PartFilled) { stopOrder = null; targetOrder = null; } }
Comment