The problem: when the strategy ran through all the historical data and start shifting into the real time phase, it resubmit an order I didn't have a chance to cancel from the historical data. (Which they couldn't be cancel anyway since I used GetRealtimeOrder() function and there wasn't a realtime position, so I assume that will return null and CancelOrder(null) will not do anything)
If you run the code I provided in playback mode, it had 2 oco orders after the strategy got transition into the Realtime phase, which there should be only 1. (if you look at the output panel or the pic1 I attached, nt8 automatically resubmit an oco bracket that should not be there or should be cancelled already)
Thank you for your helps, It stuck me days already

Comment