I made my indicators with COBCtrue and I know how to do with "if(....) return;" and all works ok.
Now I run an indicator on each tick and I want to compare the current/developing volume with the volume of the bar before and plotting me backcolor to see easily when volume is higher.
I have in onbarupdate
if (BarsInProgress != 0) return;
if (CurrentBars[0] < 2) return;
if(VOL1[0] > VOL1[1] || VOL1[0] > VOL1[2]) BackBrush=Brushes.White;
In log tab I get the error message
| 15.12.2020 15:49:18 | Default | Indicator '': Error on calling 'OnBarUpdate' method on bar 2559: 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. |
What am I´m doing wrong here please?
Thank you!
Tony

Comment