int lastBarPainted = ChartBars.ToIndex; DateTime lastBarPaintedTime = BarsArray[0].GetTime(lastBarPainted);
Here are the steps to reproduce the problem.
(1) Take any indicator, add this custom plot and compile.
protected override void OnRender(ChartControl chartControl, ChartScale chartScale) { if (ChartBars == null || ChartControl == null) return; int lastBarPainted = ChartBars.ToIndex; DateTime lastBarPaintedTime = BarsArray[0].GetTime(lastBarPainted); base.OnRender(chartControl, chartScale); }
(3) Add the modified indicator to the upper panel.
(4) Change the bar period from 60 min to 5 min.
The indicator will now throw an exception when BarsArray[0].GetTime(lastBarPainted) is called. No exception will be thrown when the bar period is increased from 5 min back to 60 min. Error messages will only be produced when the bar period is reduced.
Comment