Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Strategy Disabled
Collapse
X
-
Hello samish18,
The error you are seeing means an object that was being used was null when you tried to use it. From the error we can see the problem is happening in your OnBarUpdate code and based on the bar number it is likely code within a condition because it happened after 312 bars had processed.
To get a better idea of what is happening you can add prints into your OnBarUpdate code so you can visually see how the logic is executing in the output window. When you hit the error the last print would be the last code that was successfully executed, the problematic code comes after that print. Once it is known what part of the code is having an error it would be easier to tell what may have been null.
-
Hello samish18,
That does not help to know why you got that error. Some types of code need error handling to be used correctly, that is not specific to NinjaScript but in general with the underlying language being used called C#.
Have you added prints into the code to see which line of code has a an error? if not that is going to be the very first step at addressing this type of question. We would need to know what the specific code was that you used to know why that error was generated, very likely you are missing a condition to check if that object is not null before using it.
Comment
-
I think the best way to debug these issues is to use the debug in Visual Studios. It'll break in Visual Studios, once you attach it to NinjaTrader and run the strategy. https://ninjatrader.com/support/help..._debugging.htmOriginally posted by samish18 View PostThe only object I was using were the bars themselves.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Yesterday, 05:17 AM
|
0 responses
54 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
130 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
72 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
44 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
49 views
0 likes
|
Last Post
|

Comment