Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Object Reference not set to an instance of an Object. Bars == Null
Collapse
X
-
Object Reference not set to an instance of an Object. Bars == Null
I am getting the Object Reference not set to an instance of an Object error if I use Bars.IsFirstBarOfSession. I don't understand how this is possible since I am doing a check to see if Bars == null just before the exeption gets thrown. Also, the exception is getting thrown many hundreds of bars into the script so obviously bars was not null at some point and then turned null? Take a look at this screenshot:
Tags: None
-
Hi, swcooke.
Try to check the State value when error happened.
Probably, exception happened in another part of program and script start disposing, and that moment you may receive "null reference" error in any line, referring NT objects .Last edited by fx.practic; 03-27-2020, 12:29 AM.
Comment
-
I meant just this:
Just try to put State variable in watch window.
I guess, it would be State.Finalized
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
648 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
369 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
108 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
572 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
574 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment