Can someone help me understand what this means and how to fix it? Thanks.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Error on calling 'OnBarUpdate' method on bar
Collapse
X
-
Error on calling 'OnBarUpdate' method on bar
I'm backtesting 30 days of data using the backtest type "Optimization." When I use 30 days of data it says, Error on calling "OnBarUpdate' method on bar 1: Object reference not set to an instance of an object.
Can someone help me understand what this means and how to fix it? Thanks.Tags: None
-
Hello AdeptistJune,
Thanks for your post.
The message "object reference not set to an instance of an object" means that you are referring to an object the does not exist.
To determine what the source of the error is you will need to debug your strategy. This is typically done with print statements added to your code to send a print output to the New>Ninjascript Output window. As you do not know where the error is, you would add a print statement every few lines of code and then observe the output window when you apply the strategy. The last print statement value shown in the output window would indicate the error occurs after that print statement, you can then add further print statements to zero in on the offending code.
Here is a link to our tips on debugging: https://ninjatrader.com/support/help...script_cod.htm
Does the error occur when you perform a normal backtest of the exact same data?
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by CarlTrading, 03-31-2026, 09:41 PM
|
1 response
47 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
23 views
0 likes
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
33 views
1 like
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
51 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
42 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment