Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Object reference not set to an instance of an object

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

    Object reference not set to an instance of an object

    Hello.
    I got this error when trying to start my strategy:
    Object reference not set to an instance of an object.

    What could be possible reason of this error?

    #2
    Hello Czarek, and thank you for your question. This means that one or more of your variables were not set to anything before it was used. This example will give the same message :

    Code:
    Instrument myInstrument;
    Print("This does not work: " + myInstrument.FullName);
    myInstrument = Instrument;
    Print("This works: " + myInstrument.FullName);
    If we comment out line 2, this works.

    Code:
    Instrument myInstrument;
    // Print("This does not work: " + myInstrument.FullName);
    myInstrument = Instrument;
    Print("This works: " + myInstrument.FullName);
    You will need to look for code similar to line 2 in your own code. Please let us know if there are any other ways we can help.
    Jessica P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    39 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    124 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    64 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    41 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    46 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X