Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Load Multiple Series with different lengths

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

    Load Multiple Series with different lengths

    Hello NinjaTrader,

    I have an indicator I'm developing and it works on the 5min chart, the problem is I need some data from the monthly series, and sometimes it may need to go back up to 5 or 10 years.

    Is there a way I can load the secondary monthly series without needing to also load 5 minute data for 5-10 years? I only want monthly OHLC.

    I see this function is not available and it also has a warning:

    "AddDataSeries(string instrumentName, BarsPeriod barsPeriod, int barsToLoad, string tradingHoursName, bool? isResetOnNewTradingDay)"

    > When adding multiple Data Series of the same instrument and the same Bar Type, the 'barsToLoad' property will only be effective on the first added series. Subsequent series with a different barsToLoad setting will not load a different number of bars than the first series.

    Do I have an alternative?

    Thanks for your support



    #2
    Hello Waxavi,

    When you say the method is not available what do you mean? That code can be used.

    The BarsToLoad would only apply to the first added series, if you continue to add more series with the same instrument the bars to load can't be changed and will be reused so each secondary series would use that amount as well.

    Comment


      #3
      Hello Jesse,

      Thanks for replying to me, I managed to get it working.

      However since I have weekly and monthly bars also, this can't be done?

      Code:
      //load 20 weeks
      AddDataSeries(Instrument.FullName, new BarsPeriod { BarsPeriodType = BarsPeriodType.Week, Value = 1 }, 20, "Default 24 x 7", true);
      //load 60 months
      AddDataSeries(Instrument.FullName, new BarsPeriod { BarsPeriodType = BarsPeriodType.Month, Value = 1 }, 60, "Default 24 x 7", true);

      Comment


        #4
        I have confirmed from the example above that it only loads 20 bars even if I request 60 bars for monthly, would be nice to have an alternative to this limitation.

        Regards


        Comment


          #5
          Hello Waxavi,

          Yes that is the comment from the help guide, for the secondary series you would have to choose the greater value that is used to be used across the series. If you need 60 for the months you will also have to load 60 for the weeks so the first set value is used for months as 60.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          558 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          324 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          545 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          547 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X