I've spent hours studying the docs and searching the forum and still don't understand the timing and relationship between IOrder.Time, IExecution.Time and IOrder.OrderState.
I did read in one forum post that:
Order placement logic essentially happens at the end of each bar
Order submission logic essentially runs at the beginning of each bar
But I don't see how this explains what I'm seeing.
I'm backtesting a single symbol in the Strategy Analyzer using a 5 minute "Last" price strategy with the following code snippet:
protected override void OnExecution(IExecution execution) {
Print(execution.Order.Time +
" -- " + execution.Order.OrderState +
" -- " + execution.Time);
}
This prints the following line to the output window:
8/2/2011 7:45:00 AM -- Filled -- 8/2/2011 7:50:00 AM
The order is marked as "Filled" at 7:45, but the Fill does not actually happen until 7:50.
How can the Order be marked "Filled" an entire bar before the Execution?
PS
CalculateOnBarClose=false is the last line of my Initialize method (although my understanding is this doesn't have any effect during backtesting).

Comment