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

Load additional history for one instrument

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

    Load additional history for one instrument

    Hi,

    In a multi instrument and multi timeframe strategy is it possible to load additional history for one instrument only? For example I may want to perform calculations on the last 60 days of daily bars but only the last two days on 15 min bars. I.e. Is there a function I can call which explicitly loads a defined range of history for a specified instrument and timeframe and doesn't load this data form other instruments in the strategy.

    Aim is to maintain performance of strategy by only processing required data.

    This is applicable to both backtesting and live strategies.

    Thanks

    #2
    Actually I've just seen this

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

    I'm assuming if I set the primary bar series on a strategy to be 15 mins and history to be 20 days when used the above set at 60 days it would meeting the requirements?



    Thanks

    Comment


      #3
      Hello tmfdouglas,

      You could use the AddDataSeries syntax,

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

      Which allows you to specify how many bars to load of the secondary data series. However you would have to hard code the instrument name which would have to be changed on any roll if you’re trading futures.

      A better approach might be to just set maximumbarslookback to 256, which would limit the secondary series to 256 bars. Whether your strategy pulls 2 bars or 256 bars, I think the impact on performance is minimal. See the following section of our helpguide,



      Please let us know if you need further assistance.
      Alan P.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by tkaboris, Today, 08:01 AM
      0 responses
      1 view
      0 likes
      Last Post tkaboris  
      Started by BarzTrading, Today, 07:25 AM
      1 response
      11 views
      1 like
      Last Post NinjaTrader_Clayton  
      Started by EB Worx, 04-04-2023, 02:34 AM
      7 responses
      161 views
      0 likes
      Last Post VFI26
      by VFI26
       
      Started by Mizzouman1, Today, 07:35 AM
      1 response
      9 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by Radano, 06-10-2021, 01:40 AM
      20 responses
      616 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Working...
      X