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

Multitime series daily bar control

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

    Multitime series daily bar control

    I can't get accurate daily bars when they are added as a secondary series with:
    Add( PeriodType.Day, 1);

    I'm trying to incorporate a secondary data series of daily bars into my strategy running in a 5 minute chart. I can add the series and run an indicator study on that daily bar series. I have some questions and problems.

    Btw, this is all using the ES with Zen-Fire. I have the session template for the 5 minute primary series on the chart set to default 24-7.

    I setup a single chart with the 5 minute ES and inserted a strategy that adds a daily bars in the Initialize() method:
    Add(PeriodType.Day, 1 );

    In the OnBarUpdate() I call an indicator on these daily bars by passing the bars array for it:
    MyIndicator( BarsArray[1], .... )

    I output some diagnostics to the output window that allow me to figure out if this indicator is performing the same way it does when it's simply inserted into a chart iwth just the daily bars on it. I noticed that my indicator study on this secondary series does not at all match up with the same indicator run on a separate chart in which the daily bars are the primary series.

    To help myself understand what's going on I decided to create a chart with both a 5 minute and a daily set of bars. The daily bars in this multiple time frame chart are not the same as the daily bars if only the daily bars are in the chart. The difference seems to be that the daily bars in this multiple time frame chart are capturing a 24 day that begins and ends at midnight ( a calendar day ). They of course need to be associated with the trading session.

    I attached a couple of screen shots of the charts with 2 symbols that show the daily bars together with the 5 minute bars. I used two different sessions trying to get the daily bars to be correct.

    Ultimately I just want to be able to process daily bars from a strategy that is running in a smaller time frame like the 5 minute. How can I get accurate daily bars?

    Thanks for staying with me through this explanation!
    Attached Files

    #2
    Hello Brillo,

    Thanks for the detailed description.

    Just so I'm following correctly - you are saying that the indicator calculates correctly when manually adding daily bars to your chart, but you are experiencing issues when calling via the Add() method?

    As a quick test, can you try using 1440 minute bars from the Add() method and test to see if you see the same issues?

    Are you on NT V7.0.1000.6?

    I look forward to your results.
    MatthewNinjaTrader Product Management

    Comment


      #3
      Normally when we add "daily" bars to a chart by themselves and configure the session that the security trades in, the OHLC of the bar is equal to the OHLC of the session in which it trades. For the ES, trading begins at 6pm EST and ends the following CALENDAR day at 4:15pm EST. The bar is stamped with the closing calendar dates day at 4:15pm.

      When we add 5 minute bars to a chart by themselves and configure the session that the security trades in, the OHLC of each bar and the timestamp for them conincide with the real world trading.

      When we add both, 5 minute bars and daily bars to a chart the following situation happens:
      1. The 5 minute bars are the same as they are as described above.
      2. The "daily" bars are DIFFERENT. Instead of the OHLC and the timestamps coinciding with the trading session, they OHLC and timestamps conincide with a 24 hour period of time that begins and ends at midnight. Each bar ends at midnight and a new one begins. This completely throws off the data.

      You can easily see this yourself. Just create a chart of the ES. Insert a 5 minute chart for the 1st series, then a daily chart for the second series. Then create a separate, seconde chart window that has only the daily ES in it. Then compare any bar in that 2nd chart with the same "day" as the daily part of the 1st chart. The bars are different.

      I'm having the same issue with the daily DataSeries in a strategy when I Add() the daily in. The data is wrong.

      I tried to program around this. If it would be possible for the Ninja architecture to allow us programmers to implement our own IDataSeries objects then we could create a series of daily close prices that we derive from processing OnBarUpdates of 5 minute data. But the Ninja runtime throws a runtime exception when we try to pass our own implementation of IDataSeries to any indicator.

      Comment


        #4
        Brillo, could you please clarify if you're currently working on NT7 R6 here as this happens? There's a known bug in R6 that is likely coming into play here as you would need to use the Default session templates determining the timestamp seen on those bars. A workaround could for example be adding a 1440 min series which would be tied to the session template times used.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Hi Bert. Yes it is NT7 R6. I tried the 1440 minute bars. When compared to the daily bars ( running on a chart by themselves ) the 1440 minute bar Close prices match ( except for the holiday weekend where I got very confused trying to match things up ). The Open/High/Low prices don't match at all. The 1440 minute bars continue to behave the same when inserted as a secondary series into a chart with a primary series of 5 minute bars ( both templates set to CME US Index Futures ETH ). I will have to research further if I can sue the 1440 minute bars in my strategy as the secondary series.
          In the mean time, can you explain why the Open/High/Low is different for 1440 minute bars than they are for Daily bars?

          Comment


            #6
            Brillo,

            Can you clarify who you connect to for data?

            Which instrument are you seeing these results? Can you send a screen shot of the 5 minute vs 1440 bars in which you're having issues?
            MatthewNinjaTrader Product Management

            Comment


              #7
              Hi Matt. I'm getting along fine now with the 1440 chart. Thank you for helping me. I'm still a little confused. The default session template for the ES symbol is CME US Index Futures RTH. When I use that template with daily bars, no bars plot. I have to change it to CME US Index Futures ETH to get the daily bars. The 1440 series does not suffer from this limitation.
              I'm on the latest NT7 64bit.
              I'm connected to Zen-Fire first. Then the FREE version of Kinetick 2nd.
              On the Zen-Fire connection, Historical Data is enabled and the backup feed is "none" Should Historical data be disabled? Should I be setting the backup datafeed to something?
              I'm about to purchase a Kinetick data package and the instructions say to disable the historical data for Zen-Fire. But I didn't see anything about the backup data connection.

              Comment


                #8
                Brillo,

                This is due to an unfortunate bug in NT V7.0.1000.6 with Daily Bars and the RTH session template which will be resolved in the upcoming release of NT V7.0.1000.7. I do not have an ETA on when to expect delivery on this new version, however this issue should be resolved then.

                As a workaround, you can either use the1440 minute bars, or you can revert back to NT V7.0.1000.5.


                You do not need to create a backup connection.


                You can disable the historical data on zen-fire if you plan on getting this from Kinetick.

                Please let me know if you have additional questions.
                MatthewNinjaTrader Product Management

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by ct, 05-07-2023, 12:31 PM
                6 responses
                202 views
                0 likes
                Last Post wisconsinpat  
                Started by kaywai, Today, 06:26 AM
                1 response
                2 views
                0 likes
                Last Post kaywai
                by kaywai
                 
                Started by kevinenergy, 02-17-2023, 12:42 PM
                118 responses
                2,778 views
                1 like
                Last Post kevinenergy  
                Started by briansaul, Today, 05:31 AM
                0 responses
                9 views
                0 likes
                Last Post briansaul  
                Started by traderqz, Yesterday, 12:06 AM
                11 responses
                28 views
                0 likes
                Last Post NinjaTrader_Gaby  
                Working...
                X