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 Segwin, 05-07-2018, 02:15 PM
    14 responses
    1,789 views
    0 likes
    Last Post aligator  
    Started by Jimmyk, 01-26-2018, 05:19 AM
    6 responses
    837 views
    0 likes
    Last Post emuns
    by emuns
     
    Started by jxs_xrj, 01-12-2020, 09:49 AM
    6 responses
    3,293 views
    1 like
    Last Post jgualdronc  
    Started by Touch-Ups, Today, 10:36 AM
    0 responses
    13 views
    0 likes
    Last Post Touch-Ups  
    Started by geddyisodin, 04-25-2024, 05:20 AM
    11 responses
    63 views
    0 likes
    Last Post halgo_boulder  
    Working...
    X