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

Indicator To Back and Forward Test Pivots

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

    Indicator To Back and Forward Test Pivots

    Hello,

    May I please have some direction, help locating, or modifying an existing indicator to perform the following:

    1. Auto-Calculate Daily Pivots using Previous Day Open, High, Low, and Close and plot to chart to use in automated sim trading.

    2. I would like to auto-calculate the pivots based on Previous Day Open, High, Low, and Close starting from 9am to 4:30pm central time.

    3. Also, I would like for the indicator to plot the daily pivots, open, high, low, and close to chart for the current day for trading.

    4. I would like to use the indicator with Strategy Analyzer to auto back test strategies, so auto-calculations daily pivots, open, high, low, and close for historical data is required as well.

    Thank you in advance.

    #2
    Hello simple_goodoboy,

    Thanks for your post.

    Please review the two indicators that come with NinjaTrader called PriorDayOHLC and CurrentDayOHL as these will provide the values you are looking for. (Note: there is no "close" value for the current day until the end of the day at which point it becomes the prior day close that is available in the PriorDayOHLC indicator)

    All indicators will provide values over the charted "session" so if you are looking for specific values other than the default "session" based on a certain time range then you will want to develop or use a specific "session" template.

    Please see the helpguide references below to further address your questions:

    PriorDayOHLC: http://ninjatrader.com/support/helpG...r_day_ohlc.htm

    CurrentDayOHL: http://ninjatrader.com/support/helpG...nt_day_ohl.htm

    Session Manager: http://ninjatrader.com/support/helpG...on_manager.htm
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Paul View Post
      Hello simple_goodoboy,

      Thanks for your post.

      Please review the two indicators that come with NinjaTrader called PriorDayOHLC and CurrentDayOHL as these will provide the values you are looking for. (Note: there is no "close" value for the current day until the end of the day at which point it becomes the prior day close that is available in the PriorDayOHLC indicator)

      All indicators will provide values over the charted "session" so if you are looking for specific values other than the default "session" based on a certain time range then you will want to develop or use a specific "session" template.

      Please see the helpguide references below to further address your questions:

      PriorDayOHLC: http://ninjatrader.com/support/helpG...r_day_ohlc.htm

      CurrentDayOHL: http://ninjatrader.com/support/helpG...nt_day_ohl.htm

      Session Manager: http://ninjatrader.com/support/helpG...on_manager.htm
      Thanks for the help

      I will need to study how to create a session chart from 8:30 to 4pm, so I get the right OHLC values I need. I would also like to use the OHLC values to create pivots for the time 8:30 to 4pm.

      Can i please have some help with the questions in the attachments please?

      Thank you
      Attached Files

      Comment


        #4
        Hello simple_goodoboy,

        Thanks for your reply.

        The helpguide for PriorDayOHLC references two "Parameters", in the case of "Period" this would be a documentation error as Period is not a parameter used in the indicator. If you look at the syntax of the various ways to call the indicator, Period is not shown. Sorry for this error and we will review with the documentation team to correct.

        On your question "double value = PriorDayOHLC().PriorLow[0]; what does [0] represent? The [0] is the bars ago index for the indicator and [0] would represent the current bars value of the prior day's low in this example.
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Paul View Post

          All indicators will provide values over the charted "session" so if you are looking for specific values other than the default "session" based on a certain time range then you will want to develop or use a specific "session" template.
          Thank you Paul for response.

          My concern or problem is:

          1. My strategy involves EMAs and Pivots Points (calculated from 8:30am to 4pm central chart bars). Creating a session from 8:30am to 4pm central is no issue, but what about the EMAs? Will the EMAs start calculating from 8:30am and end calculation at 4pm?

          If so, this is a problem for me cause I would like the EMAs to continue to be calculated for 24 hours or as long as the market is open, but I just need the pivots points calculated from 8:30am to 4pm central. Then I will manually start the strategy every day at 8:30am

          The pivots points I will calculate from the PriorDayOHLC indicator in the strategy

          Do you have an idea how I can accomplish this?

          Thank you,
          Last edited by simple_goodoboy; 03-02-2017, 07:39 AM.

          Comment


            #6
            Hello simple_goodoboy,

            Thanks for your reply.

            The session template does limit what you see and what the indicators and strategy see in terms of bars, so yes an RTH (Regular Trading Hours) session template would not allow EMAs to calculate ETH (Extended Trading Hours) hours.

            To use the PriorDayOHLC() with RTH hours in an ETH strategy would not be possible without custom coding added to the PriorDayOHLC indicator to self limit it to working in RTH. If you are interested in having this custom coded for you, we can refer you to 3rd party providers who can provide that service.

            Looking back to your original post I missed that your interest is not obtaining the PriorDayOHLC but you are actually after pivots based on RTH hours. In that case please review the NinjaTrader indicator Pivots. With this indicator set to use daily bars in NT7 you will have pivots based on RTH hours your 24 hours chart. The reason you can do this is because daily bars in NT7 are built using RTH hours only.

            Here is how the Pivots are calculated by the indicator:

            pp = (currentHigh + currentLow + currentClose) / 3;
            s1 = 2 * pp - currentHigh;
            r1 = 2 * pp - currentLow;
            s2 = pp - (currentHigh - currentLow);
            r2 = pp + (currentHigh - currentLow);
            s3 = pp - 2 * (currentHigh - currentLow);
            r3 = pp + 2 * (currentHigh - currentLow);

            If these pivots calculations are not what you are looking for you again have the option to modify them yourself through Ninjascript or through a 3rd party provider. Alternatively, you may want to review other pivots indicators in the file sharing forum located here: http://ninjatrader.com/support/forum...ks.php?catid=4
            Paul H.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_Paul View Post
              Hello simple_goodoboy,

              Thanks for your reply.

              The session template does limit what you see and what the indicators and strategy see in terms of bars, so yes an RTH (Regular Trading Hours) session template would not allow EMAs to calculate ETH (Extended Trading Hours) hours.

              To use the PriorDayOHLC() with RTH hours in an ETH strategy would not be possible without custom coding added to the PriorDayOHLC indicator to self limit it to working in RTH. If you are interested in having this custom coded for you, we can refer you to 3rd party providers who can provide that service.

              Looking back to your original post I missed that your interest is not obtaining the PriorDayOHLC but you are actually after pivots based on RTH hours. In that case please review the NinjaTrader indicator Pivots. With this indicator set to use daily bars in NT7 you will have pivots based on RTH hours your 24 hours chart. The reason you can do this is because daily bars in NT7 are built using RTH hours only.

              Here is how the Pivots are calculated by the indicator:

              pp = (currentHigh + currentLow + currentClose) / 3;
              s1 = 2 * pp - currentHigh;
              r1 = 2 * pp - currentLow;
              s2 = pp - (currentHigh - currentLow);
              r2 = pp + (currentHigh - currentLow);
              s3 = pp - 2 * (currentHigh - currentLow);
              r3 = pp + 2 * (currentHigh - currentLow);

              If these pivots calculations are not what you are looking for you again have the option to modify them yourself through Ninjascript or through a 3rd party provider. Alternatively, you may want to review other pivots indicators in the file sharing forum located here: http://ninjatrader.com/support/forum...ks.php?catid=4
              Thanks Paul,
              Just to make sure we understand each other.

              I trade Pivots from the previous day Open , High low and close regular trading hours.

              So I will need the pivots open high close low and emas all plotted on the extended trading hours chart

              I can not use PriorDayOHLC indicator values in the code to calculate the pivots points I need? And then run it on a 24 hours sessions with my emas?

              How does the PriorDayOHLC indicator work?

              Thanks
              Last edited by simple_goodoboy; 03-03-2017, 06:55 AM.

              Comment


                #8
                PriorDayOHLC()

                Originally posted by NinjaTrader_Paul View Post
                Hello simple_goodoboy,

                To use the PriorDayOHLC() with RTH hours in an ETH strategy would not be possible without custom coding added to the PriorDayOHLC indicator to self limit it to working in RTH. If you are interested in having this custom coded for you, we can refer you to 3rd party providers who can provide that service.
                Paul,

                Please see the two attachments.

                I am currently looking at the PriorDayOHLC() values on the YM chart. And I currently the previous day OHLC data points at this current time 3/3/2017 9:15am central is wrong.

                Currently 3/3/2017 9:15am central OHLC data points
                Open 21074
                High 21130
                Low 20972
                Close 21014

                Yesterday 3/2/2017 from 8:30am to 15:10pm central OHLC data should be:
                Open 21112
                High 21113
                Low 20972
                Close 21006

                Can you please explain the difference please and why show difference?
                Attached Files

                Comment


                  #9
                  Hello simple_goodoboy,

                  Thanks for your posts.

                  I was in the process of answering your previous post when you added you latest.

                  If you set a chart to the default instrument settings for the session template, then in the case of the YM the session template employed is CME US Index futures ETH. The session template for CME US Index futures ETH shows the session hours are from 5:00 PM of one day to 4:15 PM the following day (based on central time zone).
                  Looking at that chart, the PriorDayOHLC indicator shows that the prior day values are:
                  O: 21074
                  H: 21130
                  L: 20972
                  C: 20988

                  If you change the charts session template to use CME US Index Futures RTH, where the session hours are 8:30 AM to 3:15 PM, the PriorDayOHLC shows that the prior day values are:
                  O: 21112
                  H: 21113
                  L: 20972
                  C:21006

                  In both of the above cases, the indicator is showing the level of the previous session. The levels are dependent upon the data provided and the data provided is controlled by the session template utilized.
                  Paul H.NinjaTrader Customer Service

                  Comment


                    #10
                    Originally posted by NinjaTrader_Paul View Post
                    If you change the charts session template to use CME US Index Futures RTH, where the session hours are 8:30 AM to 3:15 PM, the PriorDayOHLC shows that the prior day values are:
                    O: 21112
                    H: 21113
                    L: 20972
                    C:21006
                    Thank you very much. I understand now.

                    Two questions please:

                    1. See the attachment with red boxes. For the those OHLC in quote above, I need to show the the pivots using this numbers in lines as well for the same session and chart. Can the default pivot indicator help me with this please?

                    2. Regarding the EMAs for ETH. Can I create another chart for ETH using the EMAs and have logic in the strategy to get information from both OHLC -Pivots charts and the EMAs chart?

                    Ideally I need the previous day OHLC and Pivots , and EMAs for ETH on the same chart. And then build strategy and back test.

                    Thank you
                    Attached Files

                    Comment


                      #11
                      Hello simple_goodoboy,

                      Thanks for your reply.

                      I previously provided the math used for the Pivots indicator. It is the same math used by the webpage you are showing. The Pivots indicator when added to an ETH chart and when Pivots based on daily bars will provide exactly the same pivots from S3 - R3, please see attached. This means you can put the pivots indicator and your EMAs all on the same ETH chart and the pivots will be calculated of the RTH daily bars.

                      The only difference is that the Pivots indicator does not provide R4 and S4 levels. It is possible that another pivots indicator, available in the forum link I previously provided, may provide the other levels (You would need to review and test).
                      Attached Files
                      Paul H.NinjaTrader Customer Service

                      Comment


                        #12
                        Originally posted by NinjaTrader_Paul View Post
                        Hello simple_goodoboy,

                        Thanks for your reply.

                        This means you can put the pivots indicator and your EMAs all on the same ETH chart and the pivots will be calculated of the RTH daily bars.
                        Thank you so much.

                        Now, I am getting somewhere. Thank you. I finally have the pivots I need on a 24 hour chart and the ema

                        Three questions please:

                        1. Will the pivots update daily, like if I was doing market replay over 30 days will the pivots up date daily? Do I use choose auto scale under visual?

                        2. see attachment. The s3 and r3 pivot formula is different then what I need. Can I modify the default indicator formula for my own usage/indicator.

                        3. When using the Strategy Analyzer to back-test a strategy based on the pivot numbers, will the back test know to use the front month contract data or continuous data? I guess I can do a back test for a year, and scroll back in the Strategy Analyzer chart, say in August 2016, and see if the pivots where calculated corrected using the front month contract data? All my manual back test was done with front month contract pivots data, so now that i go to automated back test strategy development, i want to be sure auto back test use similar data. Or at least understand what it does uses.

                        Thanks
                        Attached Files
                        Last edited by simple_goodoboy; 03-03-2017, 11:46 AM.

                        Comment


                          #13
                          Hello simple_goodoboy,

                          Thanks for your reply.

                          1) Yes they will update. Autoscale is up to you, by default it is turned off because the pivots are usually spaced far apart compared to price and when set to true will cause the bars to compressed vertically so that the full range of pivots can be shown. You can set true or false at any time.

                          2) The pivots indicator is protected from modification (as are all indicators provided by the platform) however, the source code is provided and you may make a copy of the indicator and modify as you wish. Please note In the support department at NinjaTrader we do not create, debug, or modify code for our clients. This is so that we can maintain a high level of service for all of our clients as well as our partners.

                          3) Using MergeBackAdjusted as the merge policy (default) will provide a continuous type contract. Please review the helpguide link here: http://ninjatrader.com/support/helpG...rical_data.htm
                          Paul H.NinjaTrader Customer Service

                          Comment


                            #14
                            Originally posted by NinjaTrader_Paul View Post
                            Hello simple_goodoboy,

                            Thanks for your reply.

                            1) Yes they will update. Autoscale is up to you, by default it is turned off because the pivots are usually spaced far apart compared to price and when set to true will cause the bars to compressed vertically so that the full range of pivots can be shown. You can set true or false at any time.

                            2) The pivots indicator is protected from modification (as are all indicators provided by the platform) however, the source code is provided and you may make a copy of the indicator and modify as you wish. Please note In the support department at NinjaTrader we do not create, debug, or modify code for our clients. This is so that we can maintain a high level of service for all of our clients as well as our partners.

                            3) Using MergeBackAdjusted as the merge policy (default) will provide a continuous type contract. Please review the helpguide link here: http://ninjatrader.com/support/helpG...rical_data.htm
                            Thank you so much. Support here is great.

                            Now I will go figure out how to get precious day OHCL during RTH on the ETH chart with the pivots I have

                            Thanks for the help on pivots

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by CortexZenUSA, Today, 12:53 AM
                            0 responses
                            1 view
                            0 likes
                            Last Post CortexZenUSA  
                            Started by CortexZenUSA, Today, 12:46 AM
                            0 responses
                            1 view
                            0 likes
                            Last Post CortexZenUSA  
                            Started by usazencortex, Today, 12:43 AM
                            0 responses
                            5 views
                            0 likes
                            Last Post usazencortex  
                            Started by sidlercom80, 10-28-2023, 08:49 AM
                            168 responses
                            2,265 views
                            0 likes
                            Last Post sidlercom80  
                            Started by Barry Milan, Yesterday, 10:35 PM
                            3 responses
                            11 views
                            0 likes
                            Last Post NinjaTrader_Manfred  
                            Working...
                            X