Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

State Configure, a General question

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

    State Configure, a General question

    I am writing a converter from NT7 to NT8 and I am doing some simplifications accepting to do some minor adjustments manually.
    For example I am placing all new class instantiation under DataLoaded because I think it works best in most cases. Is this the best general assumption to make?

    Also I am placing line of code having kewword like "ChartControl" under DataLoaded because I am certain they are available then. By chance is there a place where I can find which keywords goes where or I have to discover it case by case?
    Thank you.
    Gio




    #2
    Hello Gio,

    The help guide typically states in which state a property is constructed by, but not always.

    "Warning: The ChartControl and its methods and properties should ONLY be access once the State has reached State.Historical​"

    "Note: The ChartControl object is ONLY guaranteed to be available when a NinjaScript type initiates from a Chart Window. There are situations where an indicator or strategy starts from another Windows (such as the Control Center's Strategies Grid, or from a Strategy Analyzer), where the ChartContol object is NOT accessible. Therefore, the ChartControl object should always be safely accessed (e.g., from within a try-catch, or conditionally using null reference checks)"



    I would recommend first checking the help guide for each property to see if there is a note or warning on which state (or method) a property can be used in.

    Instantiating new objects is fine to do from State.DataLoaded.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    63 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    91 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    48 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    105 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    63 views
    0 likes
    Last Post PaulMohn  
    Working...
    X