Following the 'SampleMultiInstrument' Strategy example I coded a few lines which print Time, Close of my first datastream and Close of the second datastream.
The 1st datastream is 1 minute DAX index, 2nd datastream is 1 minute STOXX index.
protected override void Initialize() { CalculateOnBarClose = true; Add("^STOXX",PeriodType.Minute,1); } /// <summary> /// Called on each bar update event (incoming tick) /// </summary> protected override void OnBarUpdate() { if (BarsInProgress!=0) return; Print(ToTime(Time[0]).ToString() + " " + Closes[0][0].ToString() + " " + Closes[1][0].ToString());
However, Closes[1][0] sometimes has the correct value and sometimes actually shows Closes[1][1], the Close of the previous Bar. So sometimes it updates, sometimes it sticks to the previous bars Close.
Please see the attachement: screenshot of chart and Output Window.
What could be the problem in my code, and what would be the solution?
Thanks!
Nick
Comment