Thanks for the video.
I was able to duplicate the issue.
It looks like you draw the line on every on bar update call.
Somewhere you are getting a calculation with a bars ago value that is greater than the bars on the chart. This appears to happen the first time that startbar_v is set.
You need to check your calculation and make sure that your bars ago value is less than the current bar value.
I added:
Print("CurrentBar: "+CurrentBar);
DrawLine("slopedline" + a.ToString(),false, startbar_v, start_v, endbar_v, end_v, Color.Black, DashStyle.Dash,2);
And got the print:
xxxxxx: startbar:264/455 endbar:455/264
CurrentBar: 454
Thus the startbar bars ago value is greater than the current bar.
Comment