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

"Unable to load bars series ... etc. " error in Strategy Analyzer

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

    "Unable to load bars series ... etc. " error in Strategy Analyzer

    "Unable to load bars series. Your NinjaScript may be trying to use an additional data series dynamically in an unsupported manner."

    Hi,

    I'm getting the above error when attempting to run Optimization through the Strategy Analyzer.

    I've read in other posts that we'll have to hard-code values when adding DataSeries to a strategy/indicator. I'm adding the dataseries using the following code:

    Code:
    else if (State == State.Configure)
    {
    if (CalculationType==UniversalCalculationType.SMA || CalculationType==UniversalCalculationType.ATR)
        AddDataSeries(BarsPeriodType.Day, 1);
    }
    What am I doing wrong? Any feedback is much appreciated.

    Thank you.





    #2
    Hello nicbizz,

    What you have shown is variable, its sometimes adding the data and sometimes not depending on your condition. AddDataSeries cannot be conditional, it needs to either always add the hard coded data or not add data, it can't be both.

    If your script in some cases will add data based on that condition you likely need to make a second script for that specific purpose instead of trying to control the secondary series being added.

    The strategy analyzer is not the only location where this could fail, its inconsistent where AddDataSeries can fail when used in a variable way so its best to just always avoid doing that.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Jesse,

      Removing the If condition appears to have fixed the error.

      Thanks!

      Comment


        #4
        Any way to fix this? I can hard-code this for test purposes, but would REALLY like to have this conditional control.

        Comment


          #5
          Hello mase2005,

          At this time there is no option to have AddDataSeries variable. You would need to select the data you wanted to use. The only variable option that AddDataSeries has is for the instrument, you can optionally pass null as the instrument if you wanted to use the same primary instrument. That would help for futures instruments which you use multiple timeframes of the same instrument.
          JesseNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by gravdigaz6, Today, 11:40 PM
          0 responses
          4 views
          0 likes
          Last Post gravdigaz6  
          Started by MarianApalaghiei, Today, 10:49 PM
          3 responses
          9 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by XXtrader, Today, 11:30 PM
          0 responses
          3 views
          0 likes
          Last Post XXtrader  
          Started by love2code2trade, Yesterday, 01:45 PM
          4 responses
          28 views
          0 likes
          Last Post love2code2trade  
          Started by funk10101, Today, 09:43 PM
          0 responses
          9 views
          0 likes
          Last Post funk10101  
          Working...
          X