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 CaptainJack, 05-29-2026, 05:09 AM
|
0 responses
172 views
0 likes
|
Last Post
by CaptainJack
05-29-2026, 05:09 AM
|
||
|
Started by CaptainJack, 05-29-2026, 12:02 AM
|
0 responses
88 views
0 likes
|
Last Post
by CaptainJack
05-29-2026, 12:02 AM
|
||
|
Started by charlesugo_1, 05-26-2026, 05:03 PM
|
0 responses
128 views
0 likes
|
Last Post
by charlesugo_1
05-26-2026, 05:03 PM
|
||
|
Started by DannyP96, 05-18-2026, 02:38 PM
|
1 response
208 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
185 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|

Comment