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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    73 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    39 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    63 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    63 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    53 views
    0 likes
    Last Post CarlTrading  
    Working...
    X