Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Isue Object reference not set to an instance of an object

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Isue Object reference not set to an instance of an object

    Hi,

    Issue "Unhandled exception: Object reference not set to an instance of an object" appears periodically in the indicator. I cannot find the source. Is this error related only to DrawObject? Or can it relate to any variable that is not defined in the code. For all my DrawObjects, I made a check If A != null. How can I find the problematic place in the code?
    The most incomprehensible thing is that I can load the Chart with the same settings 2 times in a row. In one case, the error will be in the other, not. Or vice versa​

    #2
    Hello zhiga,

    Thank you for your post.

    Object reference not set to an instance of an object indicates that there is a null value in a variable being used in your script.

    Checking for Null References - https://ninjatrader.com/support/help...references.htm

    I recommend you debug the script to narrow now exactly which line your code is hitting this error at.

    You can use prints, place a print every few lines with a new number: Print("1"); etc. That will help you see where the script gets in execution when you hit the error. Once you know what line throws the error its much easier to debug. After you have confirmed which line is throwing the error, you can add another print to then check which variable or object is null.

    Please let me know if you have any further questions.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    601 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    347 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    103 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    559 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    558 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X