I need to know whether the same thing applies to SubmitOrder?
In my own tests it looks as though SubmitOrder blocks the thread until it returns a non-null IOrder object (eg one with OrderState==PendingSubmit). This is what I would expect.
So for instance if I call entryOrder=SubmitOrder(...) in OnBarUpdate then on the next line entryOrder will always be non-null.
I would assume that all order entry methods should always block their thread until they return a non-null IOrder, and only then become non-blocking (presumably by letting NT core threads handle the order progression).
If my assumption is correct its possible that users who have reported order entry methods returning null, on very fast timeframes such as single tick, could be really be experiencing something like this:
- Thread A (say in OnBarUpdate) : entryOrder=EnterLongLimit(...)
- Thread B: triggers OnExecution, say for a previous stop order, and user might have coded 'entryOrder=null', which gets executed although user may not be expecting it in this sequence.
- Thread A (next line in OnBarUpdate): sees entryOrder==null
Comment