when I apply a stratgy on a chart and an order gets filled on the historical data, I´m wondwering why the order name gets printed below the following bar.
Would you please help me to figure out, when the order gets exactly filled, e.g. in the example below at Bar0 (OnExecution was called) or Bar1(Order name was ploted in the chart).
I created for test purpose a simple dummy strategy (see attached files), which submits a market order and prints CurrentBar and the time stamp in Time[0] on every OnBarUpdate and OnExecution method call.
As you can see on the screenshot, the strategy plots the blue dot on currentbar 0, but the blue arrow above and the order name at currentbar 1.
The printing output shows also, that the order gets executed on currentbar 0.
currentbar 0 , time stamp 01.09.2011 23:00:00
Order submited at: currentbar 0 , time stamp 01.09.2011 23:00:00
OnOrderUpdate: CurrentBar 0 at 01.09.2011 23:00:00, orderState PendingSubmit
OnOrderUpdate: CurrentBar 0 at 01.09.2011 23:00:00, orderState Accepted
OnOrderUpdate: CurrentBar 0 at 01.09.2011 23:00:00, orderState Working
OnOrderUpdate: CurrentBar 0 at 01.09.2011 23:00:00, orderState Filled
OnExecution: CurrentBar 0 at 01.09.2011 23:00:00
currentbar 1 , time stamp 02.09.2011 23:00:00
EntryOrder OrderState is Filled Quantity 1
currentbar 2 , time stamp 05.09.2011 23:00:00
EntryOrder OrderState is Filled Quantity 1
...........
currentbar 6 , time stamp 09.09.2011 23:00:00
EntryOrder OrderState is Filled Quantity 1
OnOrderUpdate: CurrentBar 6 at 09.09.2011 23:00:00, orderState PendingSubmit
OnOrderUpdate: CurrentBar 6 at 09.09.2011 23:00:00, orderState Accepted
OnOrderUpdate: CurrentBar 6 at 09.09.2011 23:00:00, orderState Working
OnOrderUpdate: CurrentBar 6 at 09.09.2011 23:00:00, orderState Filled
OnExecution: CurrentBar 6 at 09.09.2011 23:00:00
I´m a little confused about that. I want to implement a trailing stop and visualize it´s actual position via DrawDot. Before using any work-arounds like setting barsAgo to -1, I want to understand your ploting logic and whats the reason behind this mismatch.
Thank you in advance,
TUISerge
Comment