It would just be guessing unless you can identify the specific line of code causing the error by adding debugging prints or commenting out code until the error stops and uncommenting code until the error returns.
Note, that string.Format(), Draw method calls, Series, array, list, and other collection indexes can all cause this error.
The fact this occurs only after bar 980 would likely suggest the line of code is within a conditional logic block.

Comment