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 SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    35 views
    0 likes
    Last Post SalmaTrader  
    Started by CarlTrading, 07-05-2026, 01:16 PM
    0 responses
    20 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 06-17-2026, 10:32 AM
    0 responses
    12 views
    0 likes
    Last Post CaptainJack  
    Started by kinfxhk, 06-17-2026, 04:15 AM
    0 responses
    18 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 06-17-2026, 04:06 AM
    0 responses
    20 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X