There is a lot of information here that is difficult to absorb.
The best way to understand issues you are facing while developing is to implement just that part in a separate script to focus only on the part you are having trouble with.
If the following line of code reproduces the error, set up the code in a separate script to focus just on how that part of code is set up and used.
DateTime myStartTime = BarsArray[0].GetTime(CurrentBars[0]).Subtract(TimeSpan.FromMilliseconds(7000));
What exactly on this line is being indexed/referenced when I get the error?
On which data series?
aka - Which bar on which data series is being referenced?
Does that bar exist? (Bar indexes start at 0. -1 implies the first bar of that data series has not yet been formed. Referencing a bar that has not yet been formed would give an error because the bar does not exist.)
Comment