Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multiple time frame issue

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

    Multiple time frame issue

    Please help me understand why this is happening.

    simple strategy is added to a 33 tick chart. i have an added time frame of 1 tick and a counter for each tick within BarsInProgress == 1. looks like this:

    Code:
    protected override void Initialize()
    {
           Add(PeriodType.Tick, 1);
           CalculateOnBarClose = true;
    }
    protected override void OnBarUpdate()
    {
        if (BarsInProgress == 1)
        {tickctr++;}
    
        if (BarsInProgress == 0)
        {
               Print ("Tickctr:    "+tickctr);
               Print ("date:  "+ToDay(Time[0])+" time:  "+ToTime(Time[0]));
               Print ("---------------------");
         
               tickctr = 0;
        }
    }
    my assumption of the result was that every Print of tickctr would show 33. not even close to being true. some results are below:

    Tickctr: 41
    date: 20100804 time: 90345
    ---------------------
    Tickctr: 25
    date: 20100804 time: 90350
    ---------------------
    Tickctr: 0
    date: 20100804 time: 90350
    ---------------------
    Tickctr: 0
    date: 20100804 time: 90350
    ---------------------
    Tickctr: 97
    date: 20100804 time: 90352
    ---------------------
    Tickctr: 31
    date: 20100804 time: 90353
    ---------------------
    Tickctr: 42
    date: 20100804 time: 90357
    ---------------------
    Tickctr: 23
    date: 20100804 time: 90400
    ---------------------
    Tickctr: 43
    date: 20100804 time: 90403
    ---------------------
    is my use of / understanding of multiple time frames wrong?

    thanks

    #2
    With your shown code you would only see prints when the primary series (BIP0) updates.

    Comment


      #3
      works in real time but not in strategy analyzer

      the following code works in real time but not in strategy analyzer:
      Code:
      protected override void Initialize()
        {
                  Add(PeriodType.Tick, 1);
                  
                  CalculateOnBarClose = true;
              }
      
              /// <summary>
              /// Called on each bar update event (incoming tick)
              /// </summary>
              protected override void OnBarUpdate()
              {
                  if (BarsInProgress == 1)
                  {
                      tickctr++;
                      Print ("Tickctr:        "+tickctr+" Time: "+ToTime(Time[0]));
                  }
                  
                  else if (BarsInProgress == 0)
                  {
                      Print ("---------------------");
                      Print ("Tickctr:    "+tickctr);
                      Print ("date:  "+ToDay(Time[0])+" time:  "+ToTime(Time[0]));
                      Print ("---------------------");
                      
                      tickctr = 0;
                  }
                              
              }
      the following results are from today the 5th:
      Tickctr: 1 Time: 92645
      Tickctr: 2 Time: 92646
      Tickctr: 3 Time: 92646
      Tickctr: 4 Time: 92648
      Tickctr: 5 Time: 92648
      Tickctr: 6 Time: 92648
      Tickctr: 7 Time: 92648
      Tickctr: 8 Time: 92648
      Tickctr: 9 Time: 92648
      Tickctr: 10 Time: 92648
      Tickctr: 11 Time: 92649
      Tickctr: 12 Time: 92649
      Tickctr: 13 Time: 92649
      Tickctr: 14 Time: 92649
      Tickctr: 15 Time: 92649
      Tickctr: 16 Time: 92649
      Tickctr: 17 Time: 92649
      Tickctr: 18 Time: 92649
      Tickctr: 19 Time: 92649
      Tickctr: 20 Time: 92649
      Tickctr: 21 Time: 92649
      Tickctr: 22 Time: 92649
      Tickctr: 23 Time: 92651
      Tickctr: 24 Time: 92651
      Tickctr: 25 Time: 92651
      Tickctr: 26 Time: 92651
      Tickctr: 27 Time: 92652
      Tickctr: 28 Time: 92652
      Tickctr: 29 Time: 92652
      Tickctr: 30 Time: 92652
      Tickctr: 31 Time: 92652
      Tickctr: 32 Time: 92652
      Tickctr: 33 Time: 92652
      ---------------------
      Tickctr: 33
      date: 20100805 time: 92659
      ---------------------
      the following results are from the 4th using strategy analyzer:
      Tickctr: 1 Time: 143617
      Tickctr: 2 Time: 143617
      Tickctr: 3 Time: 143617
      Tickctr: 4 Time: 143617
      Tickctr: 5 Time: 143617
      Tickctr: 6 Time: 143617
      Tickctr: 7 Time: 143617
      Tickctr: 8 Time: 143617
      Tickctr: 9 Time: 143617
      Tickctr: 10 Time: 143617
      Tickctr: 11 Time: 143618
      Tickctr: 12 Time: 143618
      Tickctr: 13 Time: 143618
      Tickctr: 14 Time: 143619
      Tickctr: 15 Time: 143619
      Tickctr: 16 Time: 143619
      Tickctr: 17 Time: 143619
      Tickctr: 18 Time: 143619
      Tickctr: 19 Time: 143619
      Tickctr: 20 Time: 143619
      Tickctr: 21 Time: 143619
      Tickctr: 22 Time: 143619
      Tickctr: 23 Time: 143621
      ---------------------
      Tickctr: 23
      date: 20100804 time: 143624
      ---------------------
      Tickctr: 1 Time: 143624
      Tickctr: 2 Time: 143624
      Tickctr: 3 Time: 143624
      Tickctr: 4 Time: 143624
      Tickctr: 5 Time: 143624
      Tickctr: 6 Time: 143624
      Tickctr: 7 Time: 143624
      Tickctr: 8 Time: 143624
      Tickctr: 9 Time: 143624
      Tickctr: 10 Time: 143624
      Tickctr: 11 Time: 143624
      Tickctr: 12 Time: 143624
      Tickctr: 13 Time: 143624
      Tickctr: 14 Time: 143624
      Tickctr: 15 Time: 143624
      Tickctr: 16 Time: 143624
      Tickctr: 17 Time: 143624
      Tickctr: 18 Time: 143624
      Tickctr: 19 Time: 143624
      Tickctr: 20 Time: 143624
      Tickctr: 21 Time: 143624
      Tickctr: 22 Time: 143624
      Tickctr: 23 Time: 143624
      Tickctr: 24 Time: 143624
      Tickctr: 25 Time: 143624
      Tickctr: 26 Time: 143624
      Tickctr: 27 Time: 143624
      Tickctr: 28 Time: 143625
      Tickctr: 29 Time: 143625
      Tickctr: 30 Time: 143625
      Tickctr: 31 Time: 143625
      Tickctr: 32 Time: 143625
      Tickctr: 33 Time: 143625
      Tickctr: 34 Time: 143625
      Tickctr: 35 Time: 143625
      Tickctr: 36 Time: 143625
      Tickctr: 37 Time: 143625
      Tickctr: 38 Time: 143625
      Tickctr: 39 Time: 143625
      Tickctr: 40 Time: 143625
      Tickctr: 41 Time: 143625
      Tickctr: 42 Time: 143625
      Tickctr: 43 Time: 143625
      Tickctr: 44 Time: 143625
      Tickctr: 45 Time: 143625
      Tickctr: 46 Time: 143625
      Tickctr: 47 Time: 143625
      ---------------------
      Tickctr: 47
      date: 20100804 time: 143626
      ---------------------
      why is it different?

      Comment


        #4
        Hello Jcash,

        Is it possible here the sequence of ticks is not matching up? Meaning when you start evaluating your 1 tick series-- it's not necessarily the 1st tick in your 33 tick series. It could be the 2nd, third, 33rd etc.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Ryan,

          that could be the problem, but doesn't explain the results of 0 and 97 (2.9x 33 ticks) in my 1st post.

          how would you ensure synchronization of the 1 tick addition on the 33 tick chart in strategy analyzer?

          Comment


            #6
            Maybe you could create a data series from this and sync according to this reference sample:
            Note: In NinjaTrader 8 It is no longer needed to use an indicator to sync a secondary series. This can be done directly from the Series&lt;T&gt; (https://ninjatrader.com/support/helpGuides/nt8/NT%20HelpGuide%20English.html?seriest.htm) constructor. This post is left for historical purposes. Series objects are useful for


            It creates the series on the first OnBarUpdate and then value is set during BIP = 1.
            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
            647 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            368 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            108 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            571 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            573 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X