I use more than one dataseries in my script.
When I have in OnBarUpdate "if(State==State.Historical) return;" it works OK.
But when I add 2 x volumetric with eg
in configure AddVolumetric("MNQ 06-20", BarsPeriodType.Range, 3, VolumetricDeltaType.BidAsk, 1);
and in onbarupdate
NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe barsType = BarsArray[2].BarsType as NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe;
if (barsType == null) return;
NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe barsType2 = BarsArray[4].BarsType as NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe;
if (barsType2 == null) return;
and use it in the code eg like
"&&(barsType.Volumes[CurrentBar].GetAskVolumeForPrice(Highs[2][1])+barsType.Volumes[CurrentBar].GetAskVolumeForPrice(Highs[2][1]-1*TickSize)"
I get in the log tab the error message:
"Time Category Message
08.05.2020 10:28:00 Default Strategy 'Tx17xNQv1xAvolx1x2r': Error on calling 'OnBarUpdate' method on bar 1223456: Index was outside the bounds of the array."
What might be the reason for this log-message please?
Thank you!
Tony
Comment