Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multi-timeframe, no data backfill

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

    #16
    Hi Ray,

    I do set it to zero, just as the gentlemen in the thread below was doing. I have the exact same problem as him -- when I add day bars to my multi instrument strategy, if you backtest for just the most recent day, it wont process anything. If you backtest just a few days back, it will process everything.

    unfortunately, it seems when i run my strategy live it also won't get any signals. Im sure if i let it run for several days it would work, but it has to be restarted daily due to broker disconnects, etc.

    This seems like such a common use case i am surprised it hasn't happened to other folks. Basically, it seems specifically related to using day bars in a multi time frame/multi instrument strategy. I commented out the day bars add, and it immediately works properly. I should note that i am also using minute bars, 5 minute bars, and hour bars. None of those seem to cause a problem.

    Thanks!

    Comment


      #17
      Ray,

      Do all the bars added to my strategy observe and obey the min bars required config parameter set when i run the strategy? Or does that only apply to the default bar?

      I always set that value to zero. The odd thing is i only need to backtest back about 5 business days and the strategy runs (and day bars are definitely causing it)!

      thanks

      Comment


        #18
        bridenour,

        All bar series need to have the "Min. bars required" met before any OnBarUpdate() will happen. What you can try is just load more days and this check in your OnBarUpdate() to prevent processing on historical data.

        Code:
        if (Historical)
             return;
        Josh P.NinjaTrader Customer Service

        Comment


          #19
          Josh,

          As i indicated below, i always set min bars required to zero. Thats the same thing the other guy indicated he was doing.

          Im missing the logic in your explanation -- if i set it to zero, why does it have to wait for anything?

          Thanks!

          Comment


            #20
            You may still have CalculateOnBarClose = true which still means no processing till that day bar closes.
            Josh P.NinjaTrader Customer Service

            Comment


              #21
              So if i have calculateOnBarClose = true, and I use day bars, then by definition i have to have minBarsRequired set to some value greater than zero?

              Otherwise, it will take at least a day for the script to begin processing (which doesn't work when you restart it daily)

              Just want to make sure i am clear on what the cause is...

              thanks

              Comment


                #22
                It is not greater than zero. You are not processing the day bars till the close. Try just changing the CalculateOnBarClose.
                Josh P.NinjaTrader Customer Service

                Comment


                  #23
                  My strategy basically uses minute bars for most processing logic. However, I do use a long term moving average on daily bars to get a read on the trend -- but thats all i use the daily bars for.

                  If i change the setting as you recommend, that is going to drastically change how the logic executes on the 1 minute, 5 minute, and one hour bars that i primarily use in my strategy.

                  All i want to be able to do is get a 200 EMA on the daily bars and use that data in other parts of my system. Unfortunately, as soon as i include the daily bars, the strategy will never process, within the same day, in real time mode.

                  I understand what you are saying with regard to onbarclose, but this would wreak havoc with the overall logic processing.

                  It seems like what I am trying to do is simple and wouldn't be that uncommon (get a moving average at the daily level, and use it at the minute level), but I am hitting a wall in getting it to work.

                  Thanks,
                  Brandon

                  Comment


                    #24
                    Just because you have CalculateOnBarClose set to false doesn't need to change any logic.

                    With it set to false you can mimic a true setting through this technique:
                    Code:
                    if (FirstTickOfBar)
                    {
                         // All logic goes inside this if statement
                    }
                    When you do this you will also need to reference 1 bar back in the [] indexing. Instead of [0] you want to use [1] to get the bar that just closed.

                    I have outlined several options available. You can either use CalculateOnBarClose = false and try it that way, or just load more days back. You can't calculate anything based off of the daily time frame when you aren't even loading 1 bar's worth of it.
                    Josh P.NinjaTrader Customer Service

                    Comment


                      #25
                      ok thanks, let me monkey around with some of these options.

                      br

                      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