Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Mixed minute/daily time frames?

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

    Mixed minute/daily time frames?

    Can I mix minute and daily timeframes in a strategy? Seems on a 10 minute chart, if I use Add(PeriodType.Day, 1); then my strategy does not run, but Add(PeriodType.Minute, 60); runs fine.

    #2
    Assuming your data provider supports daily bars then, yes it should be fine.

    If this is still not the case, can you elaborate on what you mean by not running? Error messages in the log? No OnBarUpdate() being called etc..
    RayNinjaTrader Customer Service

    Comment


      #3
      I have IB and OpenTick. Looks like OnBarUpdate is not being called. I have a Print statement in Iniialize and one in OnBarUpdate, I get the Print form Initialize, but not the one from OnbarUpdate

      Originally posted by NinjaTrader_Ray View Post
      Assuming your data provider supports daily bars then, yes it should be fine.

      If this is still not the case, can you elaborate on what you mean by not running? Error messages in the log? No OnBarUpdate() being called etc..

      Comment


        #4
        Please check your logs for any errors and ensure you do in fact get daily data.

        I just ran a quick test using code below on an eSignal connection and I got the output I expected.

        protectedoverridevoid Initialize()
        {
        Add(
        "DELL", PeriodType.Day, 1);
        CalculateOnBarClose =
        true;
        BarsRequired =
        0;
        }
        ///<summary>
        /// Called on each bar update event (incoming tick)
        ///</summary>
        protectedoverridevoid OnBarUpdate()
        {
        Print(BarsInProgress +
        " " + Time[0]);
        }
        RayNinjaTrader Customer Service

        Comment


          #5
          No errors in the logs. IB's TWS is not accessible right now on a Saturday, but I am connected to Opentick, and as far as I know Opentick provides daily data for the YM.

          Comment


            #6
            I am getting the following behavior that I do not expect

            Using DAILY chart
            --------------
            protected override void Initialize()
            {
            CalculateOnBarClose = false;
            Add(PeriodType.Day, 1);
            }

            protected override void OnBarUpdate() {
            Print("BarsInProgress " + BarsInProgress);
            }

            BarsInProgress 0
            BarsInProgress 1
            BarsInProgress 0
            BarsInProgress 1
            BarsInProgress 0
            BarsInProgress 1
            ...and so on


            Using DAILY chart
            --------------
            protected override void Initialize()
            {
            CalculateOnBarClose = false;
            Add(PeriodType.Minute, 10);
            Add(PeriodType.Day, 1);
            }

            protected override void OnBarUpdate() {
            Print("BarsInProgress " + BarsInProgress);
            }

            BarsInProgress 1
            BarsInProgress 1
            BarsInProgress 1
            BarsInProgress 1
            BarsInProgress 1
            BarsInProgress 1
            ...and so on


            Using 10min chart
            --------------

            protected override void Initialize()
            {
            CalculateOnBarClose = false;
            Add(PeriodType.Day, 1);
            }

            protected override void OnBarUpdate() {
            Print("BarsInProgress " + BarsInProgress);
            }

            No Print output


            Using 10min chart
            --------------
            protected override void Initialize()
            {
            CalculateOnBarClose = false;
            Add(PeriodType.Minute, 10);
            Add(PeriodType.Day, 1);
            }

            protected override void OnBarUpdate() {
            Print("BarsInProgress " + BarsInProgress);
            }

            No Print output

            Comment


              #7
              Is this the print report from backtesting or real-time?
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                from backtesting.

                Originally posted by Josh View Post
                Is this the print report from backtesting or real-time?

                Comment


                  #9
                  The behavior you see in all cases are how you should expect them.

                  Add Time[0] to your print functions to better understand the chronological order that things are executed on.
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #10
                    Why would there be no Print output in the latter 2 cases?

                    Originally posted by Josh View Post
                    The behavior you see in all cases are how you should expect them.

                    Add Time[0] to your print functions to better understand the chronological order that things are executed on.

                    Comment


                      #11
                      I suspect not enough data issues on your end? I get prints just fine.

                      Case3:
                      5/22/2007 4:20:00 PM BarsInProgress 0
                      5/22/2007 4:30:00 PM BarsInProgress 0
                      5/22/2007 4:40:00 PM BarsInProgress 0
                      5/22/2007 4:50:00 PM BarsInProgress 0
                      5/22/2007 5:00:00 PM BarsInProgress 0
                      5/22/2007 12:00:00 AM BarsInProgress 1

                      Case4:
                      5/9/2007 4:30:00 PM BarsInProgress 0
                      5/9/2007 4:30:00 PM BarsInProgress 1
                      5/9/2007 4:50:00 PM BarsInProgress 0
                      5/9/2007 4:50:00 PM BarsInProgress 1
                      5/9/2007 5:00:00 PM BarsInProgress 0
                      5/9/2007 5:00:00 PM BarsInProgress 1
                      5/9/2007 12:00:00 AM BarsInProgress 2
                      Josh P.NinjaTrader Customer Service

                      Comment


                        #12
                        Problem is caused by multiple time frames

                        Hi, I just came across this and I was having the same problem. The way that I solved it was to set my session template to "Default 24/7". For some reason if you use "US Equities RTH" or something restricting the strategy won't run if you have both PeriodType.Minute and PeriodType.Day bars.

                        Comment


                          #13
                          Hi rlim00,

                          Thanks for the post and welcome to the NinjaTrader forums. Yes, you ran into an issue discovered in release 6. We will fix it for the next release which should be out soon. The work-around you're using is fine until then.
                          Ryan M.NinjaTrader Customer Service

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                          0 responses
                          650 views
                          0 likes
                          Last Post Geovanny Suaza  
                          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                          0 responses
                          370 views
                          1 like
                          Last Post Geovanny Suaza  
                          Started by Mindset, 02-09-2026, 11:44 AM
                          0 responses
                          109 views
                          0 likes
                          Last Post Mindset
                          by Mindset
                           
                          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                          0 responses
                          574 views
                          1 like
                          Last Post Geovanny Suaza  
                          Started by RFrosty, 01-28-2026, 06:49 PM
                          0 responses
                          577 views
                          1 like
                          Last Post RFrosty
                          by RFrosty
                           
                          Working...
                          X