it is my understanding that NT8 triggers OnBarUpdate() for every new bar event for every unique data series added to a strategy.
if this is the case then let's assume I have a strategy in which the primary series is USDJPY, 1 Minute TimeFrame, and I added the following additional data series in the following order:
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Name = "Multi-Time Frame & Instruments Example";
}
else if (State == State.Configure)
{
AddDataSeries(BarsPeriodType.Minute, 5); // 5 minute USDJPY dataseries
AddDataSeries("EURUSD", BarsPeriodType.Minute, 1); // 1 minute EURUSD dataseries
AddDataSeries("GBPJPY", BarsPeriodType.Minute, 1); // 1 minute GBPJPY dataseries
}
}
1. Given above, if a new bar event raises for all the data series then what is the order in which these events are processed?
here are two scenerios I can think of:
a) OnBarUpdate() is triggered "randomly". Meaning in whichever order the new bar events happened to occur (non-predictable) that is the order in which they will be processed.
b) OnBarUpdate() is triggered sequentially based on the order in which the data series were added. Meaning USDJPY 1 Minute gets OnBarUpdate() triggered first since it is the primary series. Then USDJPY 5 minute and so on..
2. Does the answer to question 1 differ if the strategy is running Live or Sim(backtest)?
3. Let's assume a new bar from 1 Minute USDJPY dataseries (the primary series) is responsible for triggering OnBarUpdate() first. Given the code below, is the primary series (USDJPY 1 Minute) comparing it's open price, which happens to be the open price of the same bar that triggered OnBarUpdate(), to the open price of the latest USDJPY 5 Minute bar (the bar that has raised a new bar event but has yet to be processed / trigger OnBarUpdate) or is it comparing to the open price of the last USDJPY 5 minute bar that triggered OnBarUpdate() which occurred about 5 minutes ago in this pseudo-example.
protected override void OnBarUpdate()
{
if (BarsInProgress == 0)
{
if (Opens[0][0] > Opens[1][0])
Print("The primary bar's open price (USDJPY 1 Minute) is greater than USDJPY 5 Minute bar open price");
}
}
Thank you in advance and I hope I'm not overcomplicating things too much but just want to be extremely precise and confident in trading logic and minimize as much live vs sim discrepancies as possible.

Comment