As mentioned in my previous post, your coded logic is simply invalid. If you want to know what exactly is happening under the hood you need to add debugging prints into your strategy. For instance, turn TraceOrders on and add prints into OnOrderUpdate(). Then you can very clearly see and understand exactly what your strategy is doing and why.
I have already outlined exactly how to achieve what you want. If you want a historically placed trade to be submitted live, resubmit it in real-time on strategy start up. As it currently stands your code does not resubmit any orders. All it does is keep preexisting orders alive which for sure will not be all of a sudden submitted live since you are using "Wait until flat".
The whole concept of how to program this is very easy. Use liveUntilCancelled instead of trying to keep alive every single OnBarUpdate(). Use IOrder != null checks as outlined in every single IOrder reference sample as part of your entry condition along with that liveUntilCancelled. Use CancelOrder() to cancel the historical order when you start the strategy and determine your Position.MarketPosition is flat. Wait for OnOrderUpdate() to receive the OrderState.Cancelled. Once received and strategy is running real-time, resubmit your order at the same price of the historical one just cancelled.

Comment