Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Multi timeframe synchronization issue

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

    #16
    The very first bar event is for a 3min bar at 8:03AM -
    The time for first 1 minute bar is also 8:03AM

    Comment


      #17
      Originally posted by afshinmoshrefi View Post
      The very first bar event is for a 3min bar at 8:03AM -
      The time for first 1 minute bar is also 8:03AM
      Hm. I am stumped. I thought that maybe your 1 minute barSeries did not start on a 3 minute boundary. Evidently it did.

      Comment


        #18
        I do all calculations on BarsInProgress == 1 however, I need to place arrows on 3 min chart. The problem is reference to the corresponding 3min bar is incorrect for one of the 1 min bars.

        If this behavior is normal, I can hack the code but I rather figure out the issue first.

        Having to hack a trading platform is not a comfortable feeling.
        Last edited by afshinmoshrefi; 03-06-2013, 04:50 PM.

        Comment


          #19
          afshinmoshrefi, which broker or feed do you test with? If this is a non natively stamped feed, please ensure the local PC clock in accurately synched up.

          I tried reproducing here using CQG but was unable to, see for example this sequence from realtime run on CalculateOnBarClose = true.

          3/7/2013 7:06:00 AM BIP 1: CurrentBar= 5- Open[0]= 1536- High[0]= 1536- Low[0]= 1536- Close[0]= 1536
          3/7/2013 7:07:00 AM BIP 1: CurrentBar= 6- Open[0]= 1536- High[0]= 1536- Low[0]= 1536- Close[0]= 1536
          3/7/2013 7:08:00 AM BIP 1: CurrentBar= 7- Open[0]= 1536- High[0]= 1536- Low[0]= 1535.75- Close[0]= 1535.75
          3/7/2013 7:09:00 AM BIP 0: CurrentBar= 3- Open[0]= 1536- High[0]= 1536- Low[0]= 1535.75- Close[0]= 1535.75

          Also keep in mind we're stamping the bars end of bar, so that means in the above example the 3 minute series ending 7:09 will contain the data from 7:06:00 - 7:08:59

          Any tick coming in beyond that would close the bar and create a new bar then (purely event based framework).
          BertrandNinjaTrader Customer Service

          Comment


            #20
            I am using Kinetick from Ninja - I understand how the time stamp is supposed to work based on the Ninja documentation. If you observe the GIF I've attached, you see that last of the 3, 1 minute bars is reported with the incorrect 3 minute bar. There is a synchronization issue. If I understand correctly, either this is a bug with Ninja software or with Kinetick data.

            What you are showing above seems to work correctly however you need more data to verify. I am using YM data from 2/28/2013. On my test, I see that the highs and lows of the 3 min bars match 1 minute bars that belong to 2 different 3 minute bars.

            The only way around it is to hack the code, however if this issue is fixed or is a problem with Kinetick, my indicator will start failing with other data providers.


            Afshin

            Comment


              #21
              Afshin, for the lines in your GIF - you see the last 1 minute having the high value you would have then on the 3 minute - as they end on the same timestamp, you see the BarsInProgress 0 call first - which would be expected.

              The syncronnization example that has been mentioned here would be for a custom dataseries, as those are synched to the primary series per default. But this is not related to how you see the bars objects themselves getting updated in an event based environment.
              BertrandNinjaTrader Customer Service

              Comment


                #22
                Look at CurrentBars[0] for the 1 minute bars - this can't be correct. If this is the way Ninja works then it should be clearly marked that CurrentBars[0] for additional timeframes are not necessarily correct. I really can't see how this is expected behavior.

                Comment


                  #23
                  CurrentBars[0] is your primary series all the time Afshin, this is an array and you pass in the bars index (here 0) you're interested in. This will not work in the context of the OnBarUpdate() calling frame.
                  BertrandNinjaTrader Customer Service

                  Comment


                    #24
                    ok - thanks

                    Comment


                      #25
                      Figured out my issue

                      I finally understood how the multi bar synchronization exactly works - hope this information helps someone else.

                      This sequence is by design:

                      1-1min bar
                      2-1min bar
                      3-3min bar
                      4-1min bar

                      closing tick and time of 3min bar and the last 1min bar are the same; for that reason, 3min bar is returned first before the last 1min bar is returned.

                      to fix my indicator, I now use the closing price of the 3min bar as the closing value of the 3rd 1min bar - I then ignore the 3rd 1min bar which is returned after the 3min bar.

                      Afshin
                      Last edited by afshinmoshrefi; 03-28-2013, 05:02 AM. Reason: post was corrected

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by pmachiraju, 11-01-2023, 04:46 AM
                      8 responses
                      148 views
                      0 likes
                      Last Post rehmans
                      by rehmans
                       
                      Started by mattbsea, Today, 05:44 PM
                      0 responses
                      5 views
                      0 likes
                      Last Post mattbsea  
                      Started by RideMe, 04-07-2024, 04:54 PM
                      6 responses
                      33 views
                      0 likes
                      Last Post RideMe
                      by RideMe
                       
                      Started by tkaboris, Today, 05:13 PM
                      0 responses
                      5 views
                      0 likes
                      Last Post tkaboris  
                      Started by GussJ, 03-04-2020, 03:11 PM
                      16 responses
                      3,282 views
                      0 likes
                      Last Post Leafcutter  
                      Working...
                      X