Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Times[][] error
Collapse
X
-
Times[][] error
I'm getting a Times[1][index] error when the index is within range of Times[1].Count - 1 for awhile then it works about 15 mins later (put in try..catch) until it does work. The debugger watch window is attached here with my hardcoding the index value that eventually works.
Tags: None
-
Hello jalley, thanks for writing in.
You must reduce your code to find the issue. There is no problem using a contrived example to access the secondary time stamps e.g.
if(CurrentBars[0] < 10 || CurrentBars[1] < 10) return;
if(BarsInProgress == 1)
{
Print(Times[1][10]);
}
At some point in your script, it is accessing a Times[1] index that has not been created yet.
Please let me know if I can assist any further.
-
Hi Chris,
The Times[1].Count was equal to 2123 and the index I was trying to get at was 127 at the time it had the 2123 count. That was the confusion because it said it already had 2123 bars in the series and I was trying to get one within it but it got the error shown in the debug window. CurrentBars are also way past 127 as shown in the debugger watch window.
Comment
-
Hello jalley, thanks for your reply.
The code must be reduced down to see where the barsago error is coming from. I reccomend right clicking the script>Save As> save under a new name and make a copy so you can remove code down to just the problem area. The script you are using is accessing an index that does not yet exist or is not initialized. If you run my attached test script it should work fine on your end, please run this to confirm.
Kind regards.Attached Files
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
603 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
349 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
104 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
560 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
560 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment