I am confused as to why my code is giving me this error. I have a working indicator that marks doji with a white dot on bar close. I am now trying to draw an extended line between two marked doji. I am using a list to collect the x-axis value via datetime and a list to collect the y-axis value as a double via the close price of the current bar (if, and only if, it's a doji). Everything works perfectly without error EXCEPT for the Draw.ExtendedLine portion.
- When this is active and I try to run it I get an error saying "Error on calling "OnBarUpdate" method on bar 27: You are accessing an index with a value that is invalid since it is out of range."
- I have a line at the beginning of OnBarUpdate that says " if (CurrentBars[0] < 20) { return; }" and if I increase this number it increases the number of the bar that throws the error.
Here is the code for this portion:
if (dBull == dBear)
{
Comment