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

BarsRequest doesn't process Trading Hours template correctly

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

    BarsRequest doesn't process Trading Hours template correctly

    Hi!

    This can be checked very easily
    1) Open chart and add a) daily, b) 1440minute bars. Daily bars don't support RTH sessions. 1440minu bars are ok.
    2) Make the same with BarsRequest. Both don't show RTH

    Code:
    var bp = new BarsPeriod
    {
    MarketDataType = MarketDataType.Last,
    BarsPeriodType = BarsPeriodType.Day,
    Value = 1
    //BarsPeriodType = BarsPeriodType.Minute,
    //Value = 1440
    };
    
    barsRequest = null;
    
    int barsBack = 0;
    barsRequest = new BarsRequest(SuperDom.Instrument, barsBack + 2)
    {
    BarsPeriod = bp,
    TradingHours = (TradingHoursSerializable.Length == 0 || TradingHours.Get(TradingHoursSerializable) == null) ? SuperDom.Instrument.MasterInstrument.TradingHours : TradingHours.Get(TradingHoursSerializable)
    };

    #2
    Hello fut_practic,

    Thanks for your post.

    This is correct, daily bars are given by the data provider as is. They only have OHLCV points for the day, so it would not be possible to filter the data within that bar so it reflects different trading hours.

    1440 minute bars are built with minute data and the data building that bar can be filtered by trading hours so we end up with a daily bar that is built from that trading hours session.

    Please let us know if you have any questions.
    JimNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Jim View Post
      Hello fut_practic,

      Thanks for your post.

      This is correct, daily bars are given by the data provider as is. They only have OHLCV points for the day, so it would not be possible to filter the data within that bar so it reflects different trading hours.

      1440 minute bars are built with minute data and the data building that bar can be filtered by trading hours so we end up with a daily bar that is built from that trading hours session.

      Please let us know if you have any questions.
      Chart 1440min bars shows RTH correctly, but programmatic solution with BarsRequest doesn't show correct

      Comment


        #4
        Hello fut_practic,

        Thank you for your note.

        If you would like to use the RTH Trading Hours template, you would need to use 1440-Minute bars and not Daily bars since Daily bars will always use the ETH Trading Hours Template.

        To clarify, are you stating that the 1440 minute bars OHLC values do not match the OHLC values of the BarsRequest output?

        I have tested this on our end using the attached example script and I am not able to reproduce the behaving you are reporting. When supplying the RTH Trading Hours template to BarsRequest with a 1440-Minute interval, the values are matching the chart.

        Please let us know if we may assist further.
        Attached Files
        Brandon H.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_BrandonH View Post
          Hello fut_practic,

          Thank you for your note.

          If you would like to use the RTH Trading Hours template, you would need to use 1440-Minute bars and not Daily bars since Daily bars will always use the ETH Trading Hours Template.

          To clarify, are you stating that the 1440 minute bars OHLC values do not match the OHLC values of the BarsRequest output?

          I have tested this on our end using the attached example script and I am not able to reproduce the behaving you are reporting. When supplying the RTH Trading Hours template to BarsRequest with a 1440-Minute interval, the values are matching the chart.

          Please let us know if we may assist further.
          1) Change your local timezone for UTC + 3, UTC and UTC - 3
          2) CME US Index Futures ETH
          3)

          And the open price of the 1440min bars will be wrong. It will be for time 00-00

          Comment


            #6
            Hello fut_practic,

            Thank you for your note.

            The reason you may not be seeing values match is that the previously attached script, BarsRequestTestIndicator, uses the CME US Index Futures RTH Trading Hours template.

            I have changed the BarsRequestTestIndicator to use the CME US Index Futures ETH Trading Hours template. After making that change and testing using a Data Series Trading Hours template of CME US Index Futures ETH with a timezone of UTC, UTC + 3, and UTC - 3. The indicator's output values match the price values on the chart. This is seen in the image I have attached which is using the UTC timezone, the CME US Index Futures ETH Trading Hours template, and 15 days to load.

            I am attaching the indicator with the Trading Hours template change that was made. When testing the indicator with the same settings as above do you see the output values matching the chart?

            Let us know if we may assist further.
            Attached Files
            Brandon H.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_BrandonH View Post
              Hello fut_practic,

              Thank you for your note.

              The reason you may not be seeing values match is that the previously attached script, BarsRequestTestIndicator, uses the CME US Index Futures RTH Trading Hours template.

              I have changed the BarsRequestTestIndicator to use the CME US Index Futures ETH Trading Hours template. After making that change and testing using a Data Series Trading Hours template of CME US Index Futures ETH with a timezone of UTC, UTC + 3, and UTC - 3. The indicator's output values match the price values on the chart. This is seen in the image I have attached which is using the UTC timezone, the CME US Index Futures ETH Trading Hours template, and 15 days to load.

              I am attaching the indicator with the Trading Hours template change that was made. When testing the indicator with the same settings as above do you see the output values matching the chart?

              Let us know if we may assist further.
              What I have on my side for the latest known 1440min bar
              1) UTC+2 and correct open price for ETH session (ETH session starts at 01-00, last known bar 00-00)
              2) UTC and incorrect open price for ETH session (ETH session starts at 23-00, last known bar 22-00)
              3) UTC and price for open ETH session from 00-00 local time, which is totally wrong, because template is for ETH session and ETH session must be the same on every chart and every local timezone - and this is 16-00 of CST time)
              Attached Files

              Comment


                #8
                Hello fut_practic,

                Thank you for that information.

                We have been able to reproduce this and have opened an internal ticket for it. We will follow up as more information becomes available.

                Let us know if we may assist further.
                Brandon H.NinjaTrader Customer Service

                Comment


                  #9
                  Hello fut_practic,

                  Thanks for your patience.

                  Our development team has looked into the issue in question and the fix for this issue will be implemented in the next version release of NinjaTrader (8.0.25.0).

                  When the next version of NinjaTrader is released you'll find information about the added features and bug fixes in the Release Notes:Let us know if we may further assist.
                  Brandon H.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by usazencort, Today, 01:16 AM
                  0 responses
                  1 view
                  0 likes
                  Last Post usazencort  
                  Started by kaywai, 09-01-2023, 08:44 PM
                  5 responses
                  603 views
                  0 likes
                  Last Post NinjaTrader_Jason  
                  Started by xiinteractive, 04-09-2024, 08:08 AM
                  6 responses
                  22 views
                  0 likes
                  Last Post xiinteractive  
                  Started by Pattontje, Yesterday, 02:10 PM
                  2 responses
                  21 views
                  0 likes
                  Last Post Pattontje  
                  Started by flybuzz, 04-21-2024, 04:07 PM
                  17 responses
                  230 views
                  0 likes
                  Last Post TradingLoss  
                  Working...
                  X