Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multi-series script: Historical data availability

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

    Multi-series script: Historical data availability

    I am developing a multi-series strategy script that models a Relative Strength approach of ranking stocks. The Initialize() method uses the Add method to include daily data for thousands of instruments. But OnBarUpdate() is only triggered on dates that are covered by every instrument.

    For example, if my Initialize() method adds the two instruments Apple (AAPL) and Facebook (FB), and I try to run a backtest for the past two years, OnBarUpdate is only triggered starting on May 2012, despite the presence of many years of historical data for AAPL. The triggering starts on May 2012 since this is when the FB stock data begins.

    Is it possible to cause OnBarUpdate to trigger for earlier dates even when certain instruments don't have complete data? Most of the instruments I've added have many years of data, and the younger stocks seem to be preventing OnBarUpdate() from being triggered on past days.

    If it is not possible to cause OnBarUpdate to trigger for earlier dates, then is there an easy way to get NinjaTrader to tell me the earliest dates of historical data for all the symbols in my instrument list? That way I can filter out stocks that have insufficient historical data.

    Thanks!

    #2
    Hello doranchak,
    Unfortunately this is expected.

    You can however add the scripts in an indicator and refer that indicator to the strategy.

    Please let me know if I can assist you any further.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Can you explain what you mean by "add the scripts in an indicator"? Do you mean calling the Add method from an indicator instead of a strategy?

      Comment


        #4
        Hello doranchak,
        Yes, add the additional bar series in an indicator (using the Add method) and calculate any custom values from the indicators. You can then refer to that value from your strategy.
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          OK. I just tried adding the instruments in the indicator script instead, and have confirmed that its OnBarUpdate method fires for every tick in the backtest date range, including the "gaps" represented by stocks that do not have historical data covering the entire range.

          Thanks!

          Comment


            #6
            Hello doranchak,
            Glad to know everything is working fine as per your expectations.

            Please let me know if I can assist you any further.
            JoydeepNinjaTrader Customer Service

            Comment


              #7
              OK, so the way my relative strength indicator works is that it looks at hundreds of stocks that were added in the Initialize() method. It ranks them on performance and then generates a list of instrument names. I want to trigger the calling strategy to enter long positions based on the list of instrument names the indicator is outputting. Is this possible, since my strategy is not being invoked against the entire universe of instruments?

              Comment


                #8
                Hello doranchak,
                The strategy itself should able to do it. Since you are loading hundreds of additional bar series, the code may be locked up while pulling data for a whole lot instrument.

                I would suggest you trim down the number of instruments added, and then see if the strategy is able to start or not.
                JoydeepNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by sjsj2732, Yesterday, 04:31 AM
                0 responses
                33 views
                0 likes
                Last Post sjsj2732  
                Started by NullPointStrategies, 03-13-2026, 05:17 AM
                0 responses
                286 views
                0 likes
                Last Post NullPointStrategies  
                Started by argusthome, 03-08-2026, 10:06 AM
                0 responses
                285 views
                0 likes
                Last Post argusthome  
                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                0 responses
                133 views
                1 like
                Last Post NabilKhattabi  
                Started by Deep42, 03-06-2026, 12:28 AM
                0 responses
                91 views
                0 likes
                Last Post Deep42
                by Deep42
                 
                Working...
                X