Generally this works but occasionally orders seem to disappear. I put Print statements immediately before and after the SubmitOrderUnmanaged() and ChangeOrder() statements. When everything is working I see my first print statement and then system generated printouts within OnOrderUpdate() followed by my second print statement. I will generally see multiple OnOrderUpdate() printouts thereafter. But when things go wrong, I see that both of my Print statements execute but the orders never reach OnOrderUpdate(). As my strategy tries to update the orders, the erroneous condition continues. But sometimes thereafter it starts working again.
When an order is completed, I set the order objects to null rather than calling CancelOrder(). Is there any time I should be using CancelOrder() rather than setting the order objects to null? The example code I have only set them to null, so that's what I'm doing.
I really don't know how to debug this situation any better than I have. I have Print statements everywhere and therefore see when order statements seem to be ignored. I'm totally baffled how orders get ignored without any kind of error statements being generated. Any help would be greatly appreciated.

Comment