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 Mindset, 04-21-2026, 06:46 AM
|
0 responses
88 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
134 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
68 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|
||
|
Started by cmoran13, 04-16-2026, 01:02 PM
|
0 responses
119 views
0 likes
|
Last Post
by cmoran13
04-16-2026, 01:02 PM
|
||
|
Started by PaulMohn, 04-10-2026, 11:11 AM
|
0 responses
67 views
0 likes
|
Last Post
by PaulMohn
04-10-2026, 11:11 AM
|

Comment