• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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 Emma1, Today, 02:42 PM
    1 response
    12 views
    0 likes
    Last Post NinjaTrader_DrewO  
    Started by fx.practic, Today, 03:10 PM
    1 response
    5 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by jertrade, Today, 02:50 PM
    1 response
    9 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by RedDuke, Today, 01:59 PM
    1 response
    18 views
    0 likes
    Last Post NinjaTrader_Kate  
    Started by MarianApalaghiei, Today, 01:18 PM
    1 response
    15 views
    0 likes
    Last Post NinjaTrader_PatrickG  
    Working...
    X