I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
OnBarUpdate error
Collapse
X
-
OnBarUpdate error
I created a strategy but when enabled in chart I get this error (See quote below). I believe there is a snippet I need to add in the code but forget which one. Please advice. Thanks.
Error on calling 'OnBarUpdate' method on bar 0: You are accessing an index with a value that is invalid since it is out-of-range.
I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.Tags: None
-
Never mind I figured it out it's this snippet below.
Code:if (CurrentBars[0] < 5) //Need more than 5 bars to trade { return; }
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Yesterday, 05:17 AM
|
0 responses
65 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
139 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
75 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
45 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
50 views
0 likes
|
Last Post
|

Comment