Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Erro calling Instrument.FullName from State.Configure

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

    Erro calling Instrument.FullName from State.Configure

    Hello,

    I am trying to retrieve the value of Instrument.FullName from State.Configure and assign it to a variable during an optimization.

    I can do it from the first pass but I get the error "Strategy 'MyOptimizer': Error on calling 'OnStateChange' method: Object reference not set to an instance of an object." in the following passes.

    What is the problem?

    #2
    Hello guillembm,

    You cannot use anything related to a DataSeries until State.DataLoaded.

    From the help guide:
    "Warning: The properties in this class should NOT be accessed within the OnStateChange() method before the State has reached State.DataLoaded​"


    Move the code to State.DataLoaded or OnBarUpdate().
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    164 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Started by CaptainJack, 04-24-2026, 11:07 PM
    0 responses
    317 views
    0 likes
    Last Post CaptainJack  
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    245 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    350 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    179 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Working...
    X