• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy output error: A hosted indicator tried to load additional data.

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

  • Strategy output error: A hosted indicator tried to load additional data.

    Hi,

    This is a low importance error/issue (for now). I got the following error when trying to check if the current close is below/above a pivot point (R1/S1) before entry. When I run backtest, I get no executions but following error:

    Code:
    A hosted indicator tried to load additional data. All data must first be loaded by the hosting NinjaScript in its configure state.
    1) What does the error mean?
    2) Can pivot point indicator be used in a strategy (to check if close is less or greater than R1/S1 etc.)?

    br,
    Chris

  • music_p13
    replied
    Yes, thanks for reply, adding 1 minute and daily dataseries fixed the issue.

    I am good now, thanks

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello music_p13,

    The error message is that the indicator called is adding a dataseries that is not being added to your script (the host).

    Is amaPivotsDaily an open source indicator you can see the code of?

    What data series has the indicator added with AddDataSeries()?

    Leave a comment:


  • music_p13
    replied
    Originally posted by suroot View Post
    Hi,

    This is a low importance error/issue (for now). I got the following error when trying to check if the current close is below/above a pivot point (R1/S1) before entry. When I run backtest, I get no executions but following error:

    Code:
    A hosted indicator tried to load additional data. All data must first be loaded by the hosting NinjaScript in its configure state.
    1) What does the error mean?
    2) Can pivot point indicator be used in a strategy (to check if close is less or greater than R1/S1 etc.)?

    br,
    Chris
    Hello,

    I am getting same error when adding amaPivots indicator..

    A hosted indicator tried to load additional data. All data must first be loaded by the hosting NinjaScript in its configure state.

    Here is the code I've built with Strategy Builder, but still getting an error...

    Any help?

    namespace NinjaTrader.NinjaScript.Strategies
    {
    public class TestAmaPivots : Strategy
    {
    private NinjaTrader.NinjaScript.Indicators.LizardIndicator s.amaPivotsDaily amaPivotsDaily1;

    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Description = @"Enter the description for your new custom Strategy here.";
    Name = "TestAmaPivots";
    Calculate = Calculate.OnBarClose;
    EntriesPerDirection = 1;
    EntryHandling = EntryHandling.AllEntries;
    IsExitOnSessionCloseStrategy = true;
    ExitOnSessionCloseSeconds = 30;
    IsFillLimitOnTouch = false;
    MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix;
    OrderFillResolution = OrderFillResolution.Standard;
    Slippage = 0;
    StartBehavior = StartBehavior.WaitUntilFlat;
    TimeInForce = TimeInForce.Gtc;
    TraceOrders = false;
    RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose;
    StopTargetHandling = StopTargetHandling.PerEntryExecution;
    BarsRequiredToTrade = 20;
    // Disable this property for performance gains in Strategy Analyzer optimizations
    // See the Help Guide for additional information
    IsInstantiatedOnEachOptimizationIteration = true;
    }
    else if (State == State.Configure)
    {
    AddDataSeries(Data.BarsPeriodType.Day, 1);
    }
    else if (State == State.DataLoaded)
    {
    amaPivotsDaily1 = amaPivotsDaily(Close, amaPivotFormulaPD.Floor_Trader_Pivots, amaSessionTypePD.Daily_Bars, amaCalcModePD.Intraday_Data);
    }
    }

    protected override void OnBarUpdate()
    {
    if (BarsInProgress != 0)
    return;

    if (CurrentBars[0] < 1)
    return;

    // Set 1
    if (CrossAbove(amaPivotsDaily1.PP, Close, 1))
    {
    EnterLong(Convert.ToInt32(DefaultQuantity), "");
    }

    }
    }
    }

    Thanks

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello saltminer,

    There is undocumented code shared by Matthew that demonstrates detecting the backtest type.
    https://ninjatrader.com/support/foru...231#post431231
    https://ninjatrader.com/support/foru...296#post431296


    That said, it is still not supported to dynamically add data series including using branching commands (if statements).

    Leave a comment:


  • saltminer
    replied
    Hi,
    is there a way in State.Configure to detect that the strategy is being optimised, and thus the code will ALWAYS (as if hard coded) load the additional dataseries?
    saltminer

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello saltminer,

    It is not supported to have dynamic variables in the AddDataSeries method.

    From the help guide:

    "Arguments supplied to AddDataSeries() should be hardcoded and NOT dependent on run-time variables which cannot be reliably obtained during State.Configure (e.g., Instrument, Bars, or user input). Attempting to add a data series dynamically is NOT guaranteed and therefore should be avoided. Trying to load bars dynamically may result in an error similar to: Unable to load bars series. Your NinjaScript may be trying to use an additional data series dynamically in an unsupported manner."

    https://ninjatrader.com/support/help...dataseries.htm

    Leave a comment:


  • saltminer
    replied
    Problem only when optimizing

    Hi,
    I have a strategy that can load its own intrabar granularity for more accurate backtests. It can use either 1 Minute or 1 Tick dataseries.
    It works fine on a chart and in a backtest, but during an optimise the "hosted indicator tried to load additional data" error stops the optimise immediately.

    I'm using AddDataSeries(...) in State.Configure. Depending on a user input enum parameter, the AddDataSeries will either be not called, or will be called to add a Minute DataSeries or add a Tick DataSeries.

    Is this not possible in the Optimizer, even when this granularity parameter is fixed and not changing throughout the optimisation?

    Thanks,
    saltminer

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hi saltminer,

    Please send an email to platformsupport [at] ninjatrader [dot] com for further assistance.

    In the email please include a short description that backtesting the SampleMACrossOver with a custom trading hours template is causing an error to appear in the log.

    Leave a comment:


  • saltminer
    replied
    Hi Chelsea,
    there is a bug somewhere in this regard. I was having trouble with a custom strategy, but could not see any error in programming. Then, I was able to produce the error with the built-in "SampleMACrossOver" strategy.
    I had cloned a Session Template and changed its hours, because I needed to test something starting up on time. When this Session Template is used, the error occurs.

    "A hosted indicator tried to load additional data. All data must first be loaded by the hosting NinjaScript in its configure state."

    I've attached a pic of the session template. I tried trashing charts and creating new ones, different instruments etc, but the problem remained persistent.
    This is v8.0.8

    Cheers,
    saltminer
    Attached Files

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello Chris,

    The error indicates that an indicator added a dataseries with AddDataSeries() but the host strategy or calling indicator did not.

    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"
    http://ninjatrader.com/support/helpG...dataseries.htm

    "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.""
    http://ninjatrader.com/support/helpG...tToninjascript

    Leave a comment:

Latest Posts

Collapse

Topics Statistics Last Post
Started by RandanAL, Today, 05:13 PM
0 responses
1 view
0 likes
Last Post RandanAL  
Started by timko, Today, 05:06 PM
0 responses
3 views
0 likes
Last Post timko
by timko
 
Started by ballboy11, Today, 01:04 PM
1 response
9 views
0 likes
Last Post NinjaTrader_PaulH  
Started by Linda1507, Today, 01:22 PM
2 responses
15 views
0 likes
Last Post Linda1507  
Started by ntbone, Today, 12:15 PM
1 response
14 views
0 likes
Last Post NinjaTrader_Jesse  
Working...
X