Problem is, that order-state is updated faster, than allows required logic of execution callbacks.
Follow this example:
Entry order 2 cts is filled in 2 quick executions of 1 cts.
One would expect this order of callbacks:
- Execution 1 cts
- Execution 1 cts
- Order update - new status Filled
But in reality, NinjaTrader randomly (it just happens this way sometimes) invokes callbacks in this order:
- Execution 1cts
- Order update - new status Filled
- Execution 1 cts
We all know, this can never happen in reality - i.e. Order state cannot get into state Filled, before both executions are registered = these execution callbacks should be first invoked by Ninja API, and then - Order-update callback with new order-state Filled should be invoked.
What it means ?
It means, that 2 executions were very fast one after another and NinjaTrader immediately updates order-state to most up-to-date order-state (in this case Filled). It does not care, if proper sequence of execution-callbacks (that had to happen before) were called first.
That means - strategy can be informed about order update to state Filled, sooner, than it is informed about executions of the same order. This does not make sense- because it is vice-versa. API should order this events into real and correct order of the events.
Is this correct behaviour? Is it OK, that order of callbacks does reflect the order of real events as they happened?
Should not be guaranteed, the all execution callbacks are invoked first, before the order-update-callback will be called with status "Filled"?
In case this is not valid behavior - it is important, that this does not happen in new NT8 too.
Comment