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.
JesseNinjaTrader Customer Service
-
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.JesseNinjaTrader Customer Service
Comment
-
Originally posted by samish18 View PostThe only object I was using were the bars themselves.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by michelz, 02-18-2025, 08:30 AM
|
18 responses
370 views
0 likes
|
Last Post
![]()
by neveral0n3
Yesterday, 10:49 AM
|
||
Started by laketrader, 03-10-2025, 07:20 AM
|
4 responses
34 views
0 likes
|
Last Post
![]()
by laketrader
Yesterday, 04:15 PM
|
||
Started by owensd, 04-21-2024, 11:34 PM
|
19 responses
190 views
0 likes
|
Last Post
![]() |
||
Started by bokorb, 03-14-2025, 02:45 PM
|
2 responses
26 views
0 likes
|
Last Post
![]()
by bokorb
Yesterday, 11:40 AM
|
||
Started by Schools, 03-14-2025, 03:32 PM
|
1 response
26 views
0 likes
|
Last Post
![]()
by Schools
Yesterday, 10:06 AM
|
Comment