"" Error on calling 'OnBarUpdate' method on bar 50: 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. "
Things I have tried -
1. OnBarUpdate - check currentbar < 502 return
2. Print statements
I check the currentbar == 50 and I try to initialize the dataseries gk_sum in the NadaryaSmoothed function and I get this error. I am not sure what I am doing wrong. It keeps complaining that there are 4 bars even when I am checking for currentbar as 50. I am attaching my code here.
Please help! BB.zip
Comment