NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsType barsType = Bars.BarsSeries.BarsType as
NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsType;
if (barsType != null)
{
currentDelta = barsType.Volumes[CurrentBars[VOLUMETRIC_BAR]].BarDelta; // Errors here. VOLUMETRIC_BAR is 1, which is what I currently have in the State.Configure
}
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Volumetric array out of bounds
Collapse
X
-
Volumetric array out of bounds
For some reason, I started getting an array out of bounds. It looks like the last bar was 1716, but it is trying to look for 1717. This was previously working without any issue and then I started noticing this recently. My expectation is to get the current delta of the current volumetric bar.
Code:1 PhotoTags: None
-
I found my issue. I updated my visual chart to a Range 15, but still had AddVolumetric in the State.Configure section to Range 10.
-
Hello tonystarks,
It sounds like you need a proper current bars check.
https://ninjatrader.com/support/help...urrentbars.htm
https://ninjatrader.com/support/foru...13#post1048513
Code:private NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsType volumetricBars; private double currentDelta;
Code:else if (State == State.Configure) { AddVolumetric(null, BarsPeriodType.Minute, 1, VolumetricDeltaType.BidAsk, 1); } else if (State == State.DataLoaded) { if (BarsArray.Count() > 0) volumetricBars = BarsArray[1].BarsSeries.BarsType as NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsType; }Code:if (BarsInProgress != 0) return; if (CurrentBars[0] < 1 || CurrentBars[1] < 1) return; if (volumetricBars != null) { currentDelta = volumetricBars.Volumes[CurrentBars[1]].BarDelta; Print(string.Format("{0} | currentDelta: {1}", Times[1][0], currentDelta)); }Chelsea B.NinjaTrader Customer Service
- Likes 1
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
56 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|
||
|
Started by CarlTrading, 05-10-2026, 08:12 PM
|
0 responses
33 views
0 likes
|
Last Post
by CarlTrading
05-10-2026, 08:12 PM
|
||
|
Started by Hwop38, 05-04-2026, 07:02 PM
|
0 responses
195 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|
||
|
Started by CaptainJack, 04-24-2026, 11:07 PM
|
0 responses
359 views
0 likes
|
Last Post
by CaptainJack
04-24-2026, 11:07 PM
|
||
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
280 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|

Comment