Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Instrument name for indicator of State.Configure

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

    Instrument name for indicator of State.Configure

    I have an indicator that uses property NinjascriptBase.Instrument within OnStateChange when State is State.Configure. Applying this indicator to a chart there are no issues, but using this indicator from a strategy, NinjascriptBase.Instrument is null. What's the correct way to get the instrument name? Or maybe the question is what's the correct way to use the indicator from the strategy so Instrument is not null? Right now as a work around I added a NinjaScriptProperty to pass the IntrumentName from the strategy but I'm assuming there's a better way.

    #2
    Hello Philmera,

    Thank you for your post.

    In NinjaTrader 8 you cannot rely on the instrument information to be loaded in Configure which would occur before the DataLoaded State. If you need to pull instrument information from the Indicator I would wait until a state after DataLoaded. You can take a look at the order of the States at the following link: http://ninjatrader.com/support/helpG...tatechange.htm

    With that said, it means calling an indicator from a strategy where the indicator is accessing or adding a series based on any of the Instrument items will not work. There is no guarantee the information would be loaded when the strategy calls the indicator. It would be recommend to add or call any data based on the Instrument from within the calling strategy or indicator.

    Instrument data such as BarsPeriod would not be available in State.Configure and would return null. If you wanted to dynamically add another bar series based on the bar type and value of the primary series, you could not do so in NinjaTrader 8.

    Please let me know if you have any questions.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by AttiM, 02-14-2024, 05:20 PM
    12 responses
    213 views
    0 likes
    Last Post DrakeiJosh  
    Started by cre8able, 02-11-2023, 05:43 PM
    3 responses
    237 views
    0 likes
    Last Post rhubear
    by rhubear
     
    Started by frslvr, 04-11-2024, 07:26 AM
    8 responses
    116 views
    1 like
    Last Post NinjaTrader_BrandonH  
    Started by stafe, 04-15-2024, 08:34 PM
    10 responses
    47 views
    0 likes
    Last Post stafe
    by stafe
     
    Started by rocketman7, Today, 09:41 AM
    3 responses
    11 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Working...
    X