Announcement

Collapse
No announcement yet.

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.

    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.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Yesterday, 05:17 AM
          0 responses
          54 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          130 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          70 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          44 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          49 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X