Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Get a strategy to wait for indicator dataload to be complete

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

    Get a strategy to wait for indicator dataload to be complete

    In my strategy, I am calling a few indicators that use detailed secondary dataseries (Ticks and Seconds), and I am getting such errors:
    Default,'Indicstor2' tried to load additional data. All data must first be loaded by the hosting NinjaScript in its configure state
    Is there a way for the strategy to wait until these indicators will complete the data load?

    #2
    Hello Shai Samuel,

    The error means you have called AddDataSeries() in a hosted indicator, but you have not also called that same AddDataSeries() call in the host strategy.

    From the help guide:

    "Should your script be the host for other scripts that are creating indicators and series dependent resources in State.DataLoaded, please make sure that the host is doing the same AddDataSeries() calls as those hosted scripts would. For further reference, please also review the 2nd example below and the 'Adding additional Bars Objects to NinjaScript' section in Multi-Time Frame & Instruments​"


    "Note: To maximize data loading performance, any NinjaScript object (indicator or strategy as host) which references a multi-series indicator which calls AddDataSeries must include it's own calls to AddDataSeries(). For example, if the code above was included in an indicator, and that indicator was referenced in a NinjaScript strategy, then the hosting strategy will need to include the same calls to AddDataSeries(). When the strategy adds the additional Bars objects, the calls to AddDataSeries() within the indicator will be ignored. If the Bars objects are not added by the strategy in such cases, and error will be thrown in the Log tab of the Control Center that would read - "A hosted indicator tried to load additional data. All data must first be loaded by the hosting NinjaScript in its configure state.""


    To resolve the error, copy and paste the AddDataSeries() call that is in the indicator to the host script that is calling that indicator (in State.Configure).


    Is there a way for the strategy to wait until these indicators will complete the data load?
    There is not as it would be necessary to freeze the thread which would freeze the indicator as well. But that would not resolve this error. Even if you waited until all indicators loaded historical data before the strategy began processing, this error would still occur as you must call the same AddDataSeries() in the host as the hosted indicator.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by burtoninlondon, Today, 12:38 AM
    0 responses
    5 views
    0 likes
    Last Post burtoninlondon  
    Started by AaronKoRn, Yesterday, 09:49 PM
    0 responses
    12 views
    0 likes
    Last Post AaronKoRn  
    Started by carnitron, Yesterday, 08:42 PM
    0 responses
    11 views
    0 likes
    Last Post carnitron  
    Started by strategist007, Yesterday, 07:51 PM
    0 responses
    13 views
    0 likes
    Last Post strategist007  
    Started by StockTrader88, 03-06-2021, 08:58 AM
    44 responses
    3,982 views
    3 likes
    Last Post jhudas88  
    Working...
    X