Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Error in the way NT builds time bars from tick bars.

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

    Error in the way NT builds time bars from tick bars.

    I'm finding that there are persistent differences between minute and day bar data downloaded directly from a broker when contrasted to minute and day bars constructed in NT from the same broker's tick data. In other words, there seems to be a persistent error in the way NT builds time bars from tick bars.

    The errors appear very small for an individual bar but the cumulative effect is to render worthless any backtests based on time-based bars built from tick bars in NT.

    In the attached file, over a 6 month period for NZDUSD (Gain data) using 10-minute HLC bars this resulted in a cumulative difference or error (diff = 10 min broker bars - 10 min NT bars built from tick data) of 71 pips on the Close, 124 pips on the High and 44 pips on the Low.
    Attached Files

    #2
    bluelou,

    Minute bars built from imported tick data only works off timestamps. Whatever the timestamp of the tick determines if it belongs in minute bar A or minute bar B. There is no guarantee this style of generation will match minute bars downloaded from a data provider as those minute bars are generated however the data provider decides to generate them. Tick data sources and minute data sources are not guaranteed to be the same and such discrepancies can exist. Furthermore, when trying to create minute bars from tick data, the tick data you are using only has timestamp granularity up to the second. Bar generation from the data provider may/may not have more granularity than the second which would make a difference in which ticks go to bar A or bar B.

    What I suggest you look at is the actual timestamps of the tick data you are trying to import and compare them against the minute bars generated from the tick data. You will find that the minute bars will only include ticks with a timestamp within the minute range.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Josh,
      Thx for the explanation. I figured something like that was going on. My post was directed more at the NT user community. I think that a word of caution should be in the NT documentation. Maybe it's in there somewhere but I don't recall seeing it. I'm going to have to rework a lot of tests b/c I hadn't considered this possibility.

      ~Lou

      Comment


        #4
        Thanks for the suggestion. We will add a little snippet about this.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Since I've developed several strategies using bogus time-based bars built from tick bars I'm wondering if I can't use these strategies before I re-test all of the affected strategies. So, my question is, how do I create time bars from tick bars in real-time trading that have the same systematic flaws?

          For instance, if I want to build time bars from tick bars in real time I can't use
          Add(PeriodType.Minute, 1)
          since this will add my data provider's time-based bars. Instead, I want the bogus time bars in real-time.

          So, how do I recreate in real-time trading what NT is doing with historical tick data when creating time-based bars?

          Comment


            #6
            bluelou,

            There is no prebuilt solution for this. You would have to run your own logic that checks the timestamp of every single incoming tick and check it against your own variables that are storing high/low to set new highs and lows. Then you would need to store the correct open and close based on timestamp. After all of that you would need to keep history of all these values you create so likely in some array object.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Josh,

              Wouldnt the use of Add(PeriodType.Second, 60) instead of Add(PeriodType.Minute, 1) have a better approximation for bluelou?

              Jon

              Comment


                #8
                Jon,

                Pulling from seconds will use historical tick data. Doing it with 60secs may/may not resolve the issue of trying to match your tick data because it is using the same source, but this does not necessarily mean it will match how your data came out in real-time as your real-time data could be different than the historically saved tick data.
                Josh P.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Sparkyboy, Today, 10:57 AM
                0 responses
                1 view
                0 likes
                Last Post Sparkyboy  
                Started by TheMarlin801, 10-13-2020, 01:40 AM
                21 responses
                3,916 views
                0 likes
                Last Post Bidder
                by Bidder
                 
                Started by timmbbo, 07-05-2023, 10:21 PM
                3 responses
                152 views
                0 likes
                Last Post grayfrog  
                Started by Lumbeezl, 01-11-2022, 06:50 PM
                30 responses
                809 views
                1 like
                Last Post grayfrog  
                Started by xiinteractive, 04-09-2024, 08:08 AM
                3 responses
                11 views
                0 likes
                Last Post NinjaTrader_Erick  
                Working...
                X