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 NullPointStrategies, 03-13-2026, 05:17 AM
|
0 responses
87 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
151 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
80 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
53 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
62 views
0 likes
|
Last Post
|

Comment