I'm developing an indicator needs to display something at the beginning of a trading day.
Followed instructions from this thread: http://ninjatrader.com/support/forum...ad.php?t=71559
And here is my code
protected override void OnBarUpdate() { //Add your custom indicator logic here. if (Time.Count > 2 && Time[0].Date != Time[1].Date) { Log("New day " + Time[0].Date.ToLongTimeString(), LogLevel.Information); } }
I'm testing this while using playback. Nothing got printed into the Log, meanwhile keep getting this error message "Error on calling 'OnBarUpdate' method on bar 0: You are accessing an index with a value that is invalid since it is out-of-range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart."
Please advice if there's anyway I could deal with this? Thank you very much!
Comment