Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnBarUpdate broken with multiple instruments

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

    OnBarUpdate broken with multiple instruments

    Hi all,

    I've been pretty silent on my project for the last month, waiting patiently for NT to issue an update to a few major bugs that makes it inusable with TD-Ameritrade. So far, no luck. But can't afford to wait any longer, so am getting back into it.

    And immediately found myself stuck on what I consider a major bug which wasted me several days.

    Basically, if you have multiple instruments added to your strategy... but the beginning historical data isn't fully available for even ONE of these instruments, then OnBarUpdate isn't called for ANY of the instruments until historical data *is* available.

    In other words:

    Add("AMZN", PeriodType.Minute, 5);
    Add("GOOG", PeriodType.Minute, 5);

    Let's say you run your strategy analyzer starting from 9/17/2008... but for whatever reason, your historical database for AMZN doesn't contain data until 9/20/2008. (I don't really know the reason; this failure happens repeatedly, invisibly to me. I have three different data feeds; even if part of the historical data isn't available, NinjaTrader doesn't go back to retrieve it as long as it has some of the data.)

    Then your OnBarUpdate() will not be called for ANY symbol in your strategy until the first bar of 9/20/2008.

    In my case, I had over 40 symbols running in my strategy. I had no idea why the results I was getting were so completely wacky... until I put in a brain-dead test that was only printing out Time[0]. I then realized the strategy run wasn't starting when I thought it was starting.. and several wasted days later, I realized it was starting on a much later date because *one* of the 40 symbols didn't have available historical data.

    #2
    Hi heech, this is expected: the strategy will calculate once all data for the needed / added symbols used by the strategy is present (take also min. bars required in consideration). When you are connected live, NinjaTrader will try to fill the gaps present in your data, for more info when NinjaTrader loads historical data, please check this link - http://www.ninjatrader-support.com/H...ricalData.html

    Comment


      #3
      Thanks Bertrand. I guess I can understand the logic behind the decision... I guess my ultimate gripe, at the end of the day, is still the mysterious behavior with historical data filling.

      I've looked at the link you sent explaining "When does NinjaTrader Load Historical Data". I'm not really able to process what it's telling me, however. Does this apply only to *charting*? Is it different behavior from the strategy analyzer?

      Or does this apply only to the primary symbol, rather than anything I add() in a multi-instrument strategy?

      I'm positive I'm connected to a data feed, but historical data remains missing without any notification that it's not there. The only way to consistently force a reload is to delete historical data for the entire time period... but with 40 symbols, and without an easy "delete all historical data" button, it's really not viable to do that for me on a regular basis.

      Comment


        #4
        You are welcome Heech, it applies to all symbols and is not limited to charting.

        Are you sure your datafeed has backdata this far present for all symbols you need in your strategy?

        For the Strategy Analyzer we would recommending disconnecting before doing backtest, this way you won't get stuck in data requests where a specific provider can't deliver the needed days back data.

        Comment


          #5
          Originally posted by NinjaTrader_Bertrand View Post
          You are welcome Heech, it applies to all symbols and is not limited to charting.

          Are you sure your datafeed has backdata this far present for all symbols you need in your strategy?

          For the Strategy Analyzer we would recommending disconnecting before doing backtest, this way you won't get stuck in data requests where a specific provider can't deliver the needed days back data.
          Bertrand,

          Yes, I'm positive the datafeed has backdata available... once I delete historical data and re-open the chart, it is able to retrieve the full set of data correctly. The mention of getting "stuck' in a data request is interesting...

          I'm not clear how disconnecting would help, though. If data isn't available, then disconnecting means it's *still* not available... and I still have no way of realizing it's not available.

          It would be incredibly helpful to have a "delete all historical data" button, or the option to turn on a warning that historical data isn't available for the data range requested.

          Comment


            #6
            heech,

            Running a strategy on partial data does not make sense. It throws off any logic that tries to run on the instruments and as such NT requires you to have data for ALL series before starting up the script.

            If you delete data but still had the chart open when you did this the data was not deleted. You cannot have any instance of the data open at the time you delete it. Please ensure this is the case. Then you can reload the data from your data provider.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_Josh View Post
              heech,

              Running a strategy on partial data does not make sense. It throws off any logic that tries to run on the instruments and as such NT requires you to have data for ALL series before starting up the script.
              Thanks for the reply, Josh.

              I think I understand the logic behind that decision, although in my case... running a strategy on partial data *does* make sense. I'm running multi-instrument for convenience, not because the strategy is looking at interaction between different instruments.

              But it would be no fun not knowing whether any of the Bars etc. arrays are valid or not for certain symbols at certain points... although you could add something like a Valids[BarInProgress] array to let me check...

              Comment


                #8
                Thank you for the suggestion. I have forwarded it to development.
                Josh P.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                633 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                364 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                105 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                567 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                568 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X