I've now removed all instances of randomized values from my code, trying to iron this out.
I click run on the analyzer, it backtests and produces a result.
I click it again with no changes, and I get various error when the code is trying to access BarsArray[0]. This is the primary series and should always be available, as I have full data for the instrument. I've placed all sorts of null checks and it throws erros without executiong the null check prints
The behavior alternates almost every other click between running the backtest. With Try catch the execution continues but a lot of bars arer
What would cause this behavior? It's becoming very difficult to debug when it works
Data loads fine: BEGIN DataLoaded CurrentBars[0] -1 BarsArray[0].Count 25620 BarsArray[2].Count 25602 >> barsType length 25602
string msg = " aaaa ";
try
{
msg = " TRY "+Time[0];
// Check if BarsArray and BarsArray[0] are not null
if (BarsArray[0] == null || BarsArray[1] == null || BarsArray[2] == null)
{
Print(Time[0] + " BarsArray or one of its elements is null.");
return FunctionResponses.NoAction;
}
Then if i remove Time[0]
string msg = " aaaa ";
msg = " TRY using BarsInProgress "+BarsInProgress ;
// Check if BarsArray and BarsArray[0] are not null
if (BarsArray[0] == null || BarsArray[1] == null || BarsArray[2] == null)
{
Print(Time[0] + " BarsArray or one of its elements is null.");
return FunctionResponses.NoAction;
}
BackBrush = Brushes.Cyan;
T3"
In the above example, it wont even check for null values before it throws the error? In the screen shot, cyan is where it works and not painted is where it cant find the series.
Any tips?

Comment