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

NT8 print data 'strategy' - different bars for NQ than for ES

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

    NT8 print data 'strategy' - different bars for NQ than for ES

    Hi Team,

    I have a strategy made in the Strategy Builder, just used to print data into the output, which I then copy to Excel. I am in Amsterdam, and have been using this for FDAX.

    Now I adjusted the 'strategy' for NQ/ES. The strategy is looking at the data at 15:00 CET (at the NSE market close), and then gets OHLC + volume data for RTH 30 minute bars. I was trying to find the right settings, but I figured out, that setting NT8 to CET time zone, and run the strategy analyser for NQ with trading hours US Equities RTH, would give me the correct data output.

    Next, the only thing that I changed in the strategy analyser was the ticker, from NQ 12-21 to ES 12-21, but then the output is not correct. It is printing complete different bars...

    I attached the code, and the output of both NQ and ES.

    I hope this is clear enough

    Thank you
    Dennis


    Attached Files

    #2
    Hello deetee,

    I reviewed the files however I don't see what difference you are referring to. The timestamps seem to be the same. If the problem relates to timestamps you may need to clear the cache now as you changed the timezone in the platform. I will put steps for that below. If that does not resolve the problem please provide more context on what the specific difference is with the data or what your expectation was.

    To delete the cache, follow the steps below.
    • Shut down NinjaTrader.
    • Open the Documents > NinjaTrader 8 > db folder.
    • Delete the sub-folder named 'cache'.
    • Restart NinjaTrader and test.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hi Jesse, thanks for getting back so fast.

      About the difference between NQ and ES, looking at the 2 output files, 8-11-2021, at the values after the text ‘column’ 09000930:
      NQ open of 16356.5.
      ES open of 4696.75.
      In the attached image, I marked the bars where this data is coming from.
      Now, looking at the NQ/ES chart in TradingView, I see that indeed the data is for the same bar, it's just wrong on the chart.

      So, I have deleted the cache folder as instructed. Reloaded the historical data on the chart, and the difference on the chart is gone. Great

      >>>
      This brings me to the next thing. As I will need this data output every working day, once before the European open (FDAX) and once before the US open (NQ/ES), I would need to change the NT time zone settings twice a day. I understand now that this is not the best way to do get the output. Ideally I would stay in the EU time zone.

      The current strategy code looks at the closing time of the NQ/ES, which is 15:00 in CET time zone and 22:00 in EU time zone. When NT settings are for EU time zone, the data for 'daylight saving time' (=DST) days would not be exported, because there is normally 1 or 2 weeks between the US and EU switching to DST (meaning that for example last week, the US markets close at 21:00 EU time). So, my solution was to change the time zone in NT settings every time I needed the data output.

      I guess there must be a better way to print this US data, while NT system is in EU time zone. The data needed is the OHLC + volume of the day (RTH), plus of each 30min bar during RTH. In my current strategy (as uploaded), it looks at the closing time, but that doesn't seem to work around the DST.

      I hope there is a 'simple' solution for this.

      Thank you
      Dennis
      Attached Files

      Comment


        #4
        Hello Dennis,

        This is Jim responding on behalf of Jesse who is out of the office at this time.

        Timestamps of bars will be translated to the time zone entered in the platform. If you want to print bar timestamps with a different time zone than what is entered in the platform, you could unlock the code and work with C# to adjust the Time[0] (bar timestamp) DateTime's to a different timezone.

        A publicly available article on converting times between time zones with C# is included below:

        Learn to convert times between from one time zone to another in .NET. Also learn to convert DateTimeOffset values that have limited time zone awareness.
        JimNinjaTrader Customer Service

        Comment


          #5
          Thanks Jim, understand that.

          I'm also trying to understand the following, as I feel I'm being played by the time zones and trading hours in NT
          .
          I have set NT time zone on CET and closed NT. I have deleted the cache folder as instructed above.

          When I start NT, and run the strategy with trading hours US Equities RTH, it is now giving me the wrong bars. It's like the condition '15:00' doesn't take the correct time zone. A few days ago the output would show the correct data. But if I change it to 16:00, 21:00 or 22:00, there is no output.

          I'm pretty sure, I used these exact same settings as before.

          Do you have an idea what it going on?
          I attached the output data. The 09000930 is just text and it's showing the OHLCV of the 15:30-16:00 CET bar.
          Click image for larger version

Name:	11-11 NT support ES.jpg
Views:	177
Size:	74.3 KB
ID:	1178218


          Thanks,
          Dennis



          Attached Files

          Comment


            #6
            Hello Dennis,

            I am not yet sure where the hang up is and what is unexpected.

            As discussed, Data is going to be stamped from the provider, and then the data is translated to the timezone configured in the platform.

            Is there a reason why you are using the US Equities RTH instead of CME US Index Futures RTH, which would be applicable for NQ and ES? I have attached screenshots showing US Equities RTH will show some of the ETH data of ES, and the same would apply for NQ.

            I notice you mention testing in the Strategy Analyzer. We should note that if you are connected to the Playback Connection, the data that the Strategy Analyzer can access is modified and we may see some unexpected results because of which. Do you see the same behavior testing regular charts when connected to your data provider?

            If you see the symptom with the original data provider, could you modify the strategy so it only prints what is unexpected? If I am given a test script that only prints out what is unexpected, and if I am given specific steps to reproduce, I will be able to give a closer look. In addition to the simplified script, I would ask for the timezone configured in the platform, the data series settings used for the chart(s), and who you are connected to. I could then reproduce on my end and give better insight.

            If the issue involves unexpected bars, it would be best looking into this on a chart.
            Attached Files
            JimNinjaTrader Customer Service

            Comment


              #7
              Hi Jim,

              Thanks for getting back. Below my replies.

              Originally posted by NinjaTrader_Jim View Post
              Is there a reason why you are using the US Equities RTH instead of CME US Index Futures RTH, which would be applicable for NQ and ES? I have attached screenshots showing US Equities RTH will show some of the ETH data of ES, and the same would apply for NQ.
              I look at US Equities RTH, to get the 'today's' OHLCV for the NSE RTH time. CME RTH has 1 more hour.


              Originally posted by NinjaTrader_Jim View Post
              I notice you mention testing in the Strategy Analyzer. We should note that if you are connected to the Playback Connection, the data that the Strategy Analyzer can access is modified and we may see some unexpected results because of which. Do you see the same behavior testing regular charts when connected to your data provider?
              I'm using indeed the backtest function of the Strategy Analyzer to print the output. I haven't been using playback for about a year.
              I'm connected to Kinetic and Interactive brokers too. In the Market Data properties, Interactive Brokers is only used for real-time future data.


              Originally posted by NinjaTrader_Jim View Post
              If you see the symptom with the original data provider, could you modify the strategy so it only prints what is unexpected? If I am given a test script that only prints out what is unexpected, and if I am given specific steps to reproduce, I will be able to give a closer look. In addition to the simplified script, I would ask for the timezone configured in the platform, the data series settings used for the chart(s), and who you are connected to. I could then reproduce on my end and give better insight.

              If the issue involves unexpected bars, it would be best looking into this on a chart.
              I'm not sure how to define 'unexpected' in the strategy I only see the issue in the output, not on the chart.

              Hope this helps, thank you,
              Dennis

              Comment


                #8
                Hello Dennis,

                Can you isolate the single print that is showing an unexpected result in the output window, and could you add some filtering conditions where it only prints the value that is unexpected?

                Could you then let me know how to reproduce this on a chart, and also share a screenshot of the Data Series settings of that chart?

                If you you are unable to add filtering conditions so the print in question only prints the value in question, could you share a screenshot noting where that specific print is shown, when testing on the chart with data series settings shared? (I would also need a screenshot of the chart data series settings so I can set this up.)

                With that information I should be able to see the same thing on my end, and I know what I should be looking for.
                JimNinjaTrader Customer Service

                Comment


                  #9
                  Hi Jim,

                  Well, all the printed data is unexpected... From the chart (below/attached)), I see that the output prints the 1:30-2:00 CET bar. That why it makes me think it is somehow connected to AMS time, which is 7hrs later than CET.

                  From my (yellow marked) output example from message #5:
                  The yellow marked OHLCV data is 30min bar[13], which is the open of the (US Equities) RTH market, 8:30-9:00 CET. And the 13th bar from 15:00 CET.

                  Please see the cross-hair for the bar+data box.
                  Click image for larger version

Name:	ES chart 13-10-2021.jpg
Views:	164
Size:	91.2 KB
ID:	1178256

                  The print screen of the data series of the chart:
                  Click image for larger version

Name:	Data series ES.jpg
Views:	144
Size:	110.2 KB
ID:	1178257

                  I hope this is enough to help.

                  Thanks
                  Dennis

                  Comment


                    #10
                    Hello Dennis,

                    I am not seeing the same behavior on my end when viewing an ES 12-21 30 minute chart and checking data for October 13th 2021. I am testing with Kinetick as my data provider. I have set my platform time zone to UTC +1 Amsterdam time, and I was sure to clear historical data and clear cache for good measure. I have attached a screenshot of my results.

                    In order to assist further, I will need to get connected with you and see exactly how we are producing your chart.

                    Could you reach out to me at platformsupport [at] ninjatrader [dot] com with the text "Attn Jim 3347761" and include a time in the U.S. Eastern Standard time zone that we can schedule a remote support session? I am personally available after 9:00AM EST and can schedule a remote support session as late as 4:30PM EST. I would also like a phone number where I may reach you.

                    I look forward to hearing from you.
                    Attached Files
                    JimNinjaTrader Customer Service

                    Comment


                      #11
                      Thanks Jim, that's great. Will send an email.
                      Please note that my NT time zone is CET. From your chart, it's this bar (green arrow, so 7 hours later):

                      Click image for larger version  Name:	Arrow.jpg Views:	0 Size:	138.8 KB ID:	1178311

                      Dennis
                      Attached Files

                      Comment


                        #12
                        Earlier when we connected we made sure we were both looking at US Central Standard Time and made sure we:

                        1. Loaded a chart and selected Reload All Historical Data to reload the data after changing timezones
                        2. Confirmed the Trading Hours template assigned in the chart's Data Series window
                        3. Added the strategy to the chart and cleared the output window between tests

                        When we made sure to note the items above, we saw the expected results.
                        JimNinjaTrader Customer Service

                        Comment


                          #13
                          Thank you for your time, appreciated a lot

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by SantoshXX, Today, 03:09 AM
                          0 responses
                          11 views
                          0 likes
                          Last Post SantoshXX  
                          Started by DanielTynera, Today, 01:14 AM
                          0 responses
                          2 views
                          0 likes
                          Last Post DanielTynera  
                          Started by yertle, 04-18-2024, 08:38 AM
                          9 responses
                          41 views
                          0 likes
                          Last Post yertle
                          by yertle
                           
                          Started by techgetgame, Yesterday, 11:42 PM
                          0 responses
                          12 views
                          0 likes
                          Last Post techgetgame  
                          Started by sephichapdson, Yesterday, 11:36 PM
                          0 responses
                          2 views
                          0 likes
                          Last Post sephichapdson  
                          Working...
                          X