Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bug in Pivots Indicator NT 7.0.0.15

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

    Bug in Pivots Indicator NT 7.0.0.15

    The NT pivots indicator occasionally throws Out-of-Range exceptions. It took me about 1 and a half hours of testing to find out what caused the problem, but it is not yet fully reproducible.

    Problem occurs only, when indicator is set to CalcFromIntradayData and applied to a chart with Equidistant Bar Spacing = False. These two conditions are necessary, which can easily be understood, when looking at the indicator code:

    The offensive code is line 390 of the indicator

    Bars.GetTime(Math.Min(Bars.Count - 1, Bars.GetBar(ChartControl.LastBarTimePainted))).Dat e;

    Switching this code off and on caused the out-of-range exception to disappear and reappear, so it is definitely caused by this.

    Now, not every time I created a chart with Equidistant Spacing set to False, it would create an exception. It was more likely, when I had a chart with 2 DataSeries, 2 different instruments and 2 different time intervals such as 5 and 30 min. But I have not found a method yet to make it reproducible. However, once I had a chart that would have the required geometry for causing an exception, it would do so for all indicators that contained the offensive code, and the problem would always go away, when I removed that line (which is needed for error messages only).

    This confirms other problems that are related to Equidistant Bar Spacing, when set to False,
    Last edited by Harry; 05-02-2010, 11:12 AM.

    #2
    Thanks. I have forwarded this to development.
    Also, did you run this on a single series chart? Which instrument and time frame was being used? Thanks.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Worked a little more. Here comes a chart template that allows me to reproduce the bug. The chart template uses only pivots and a dValue indicator.

      The chart template has two data series, ES 30 min (1st data series) and ES 5 min (2nd data series). Both data series are shown on panel 1, the second data series is set to transparent (invisible), as it is only needed to get a higher resolution for the volume profile (dValue indicator). I left the dValue indicator on the chart because it the reason for this specific setup.

      The session templates used are GLOBEX (CME US INDEX FUTURES ETH), or other ETH templates for other instruments, only default templates if NinjaTrader are used.

      System clock was set to Central European Time (this may have an impact on the dValue indicator settings).

      To produce the error

      Import dValue indicator. Open a two dataseries chart for ES 06-10 (30 min for first chart and 5 min for second), lookback 65 days (needed for pivots). Apply the chart template. Connect to data feed.

      I always get the following error message in the trace file, when I connect, or when I load a new instrument, when connected. This is the error message for the three pivots

      2010-05-02 20:21:53:484 ERROR: Error on plotting indicator 'Pivots'. Please check the 'OnBarUpdate' or the 'Plot' method: Bar index needs to be greater/equal 0
      2010-05-02 20:21:53:500 ERROR: Error on plotting indicator 'Pivots'. Please check the 'OnBarUpdate' or the 'Plot' method: Bar index needs to be greater/equal 0
      2010-05-02 20:21:53:500 ERROR: Error on plotting indicator 'Pivots'. Please check the 'OnBarUpdate' or the 'Plot' method: Bar index needs to be greater/equal 0

      Changing from ES to YM or to 6E or any other futures contract

      Sometimes the instrument of the first data series is changed (second instrument remains) and sometimes both instruments are changed. Which of the two is the expected behavior?

      Originally posted by NinjaTrader_Josh View Post
      Thanks. I have forwarded this to development.
      Also, did you run this on a single series chart? Which instrument and time frame was being used? Thanks.
      Attached Files

      Comment


        #4
        Thanks. I have forwarded this to development.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          This should be fixed in the next version of the beta. Thank you for reporting.
          Josh P.NinjaTrader Customer Service

          Comment


            #6
            Pivots not working with double sessions

            Hi Josh,

            me again, have further tested the pivots indicator. It works correctly, if you have one session per day. If you use a template with multiple sessions per day, it does not work correctly, but plots false pivots. This is because it does not select the correct session for the daybreak. Daybreak should be the end of the last session that ends within the day.

            I used a double session for ES, as per screenshot below, reflecting night session and day session. The pivot indicator should then plot pivots for the combined night and day session. However it confuses the daybreak, so it links the day session of the old day to the night session of the new day.

            This shows that bars.Session. GetSessionDate() is not correctly implemented. The key is likely the correct conversion of Time[0] -> time from local PC time to time of exchange. The last session of the exchange market day should make the pivots turn, but with PC settings of CET, it is the night session that ends the day.
            Attached Files
            Last edited by Harry; 05-18-2010, 02:41 PM.

            Comment


              #7
              Harry,

              Maybe I am not understanding you, but when you use double sessions the overnight would have the same pivots as you had during the RTH session for that day. When the a new RTH session begins you get new Pivots after that.

              Please find the attached screenshot in GMT+1 timezone. Please see the corresponding colors. #1's represent RTH session and #2's represent the corresponding overnight for that RTH. Please see the selected Pivot indicator showing the calculations throughout the historical data being the same for each pair of 1 and 2.

              This is what I would expect according to the trading hours outlined here: http://www.cmegroup.com/trading_hours/index.html. The "session" contains everything until the next RTH.
              Attached Files
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                Josh,

                two answers to your post:

                (1) If I look at the session breaks used by the pivots indicator with the template, they are Monday 3:30 PM, Tuesday 3:30 PM, Wednesday 3:30 PM, Thursday 3:30 PM and Thursday 10:15 PM (all times in CET, if converted to Central Time 4 x 8:30 AM and 3:15 PM once ). So there are two session breaks on Thursday, which is inconsistent anyhow.

                (2) The original floor pivots relate to the day session. The day session ends with the settlement, for clearing next day. The night session therefore belongs technically to the day session of the following day. Trades that you enter during the night session Tuesday/Wednesday will be cleared together with trades that you enter during the day session on Wednesday.

                So full session pivots will be calculated for the period 3:30 PM Central Time to 3:15 PM Central Time, and they should be displayed on your chart for the period starting from 3:30 PM and ending 3:15 PM following day. Pivots follow the definition of the trade date, so you need the new pivots right after the night session has started.

                So my answer is "no", you do not get new pivots after the start of the day session, but after the end of the day session.

                Comment


                  #9
                  1. I am not seeing anything at 10:15. Please see the first attachment. Thursday has a break at 15:30 and 22:15 (GMT+1) just like all other week days.

                  2. When you use ETH sessions according to the session outlined on CME website the whole session includes RTH+overnight and is considered one session. As such that whole chunk of time is used into the Pivot calculation for the session date. Just because you split it up into multiples in your Session Manager, it will still behave the same. This stays consistent with the way it works on ETH session template. Your interpretation of floor pivots would require the use of a custom indicator as it is simple a different understanding of how you want to calculate the pivots.
                  Attached Files
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #10
                    1. See chart below for Thursday problem.

                    2. Electronic session for ES-Mini on weekdays copied from the CME website as per your link.

                    15:30-16:30 and 17:00-15:15

                    Session starts at 15:30 is interrupted (technical break) from 16:30 to 17:00 and then continues till 15:15 next day. So the session comprises the night session (first) and ends with the day session (second). The settlement price needed for pivots comes at 15:15 with the end of the day session.
                    Attached Files

                    Comment


                      #11
                      If you want to see the problem, just open a chart with 2 dataseries for ES. Use the CME Index Futures ETH template for the upper data series and the double session template for the lower data series.

                      You should get the same pivots, but what you get is quite different....
                      Attached Files

                      Comment


                        #12
                        1. Your chart is showing it accurately. What you have highlighted is looking at a Sunday session going into a Monday session. This would be accurate. Please also note that you are in Daily mode for calculations so for easiest comparisons would be to use the Intraday Data for calculations so you don't have to transpose daily bars on top to see what is happening.

                        2. If you look at the definitions of S&P500 Futures you then see it listed as "8:30-15:15 then 15:30-16:30 and 17:00-8:15". When you use your session template your session template is more in line with this definition and this definition is more in line with showing pivots as calculated the way it is right now which is RTH+overnight.

                        If you wanted to use the "15:30-16:30 and 17:00-15:15" session you would use the regular ETH as one session and then you would see it that way accurately there as Pivots being overnight+RTH.
                        Josh P.NinjaTrader Customer Service

                        Comment


                          #13
                          Josh,

                          I do not know where this leads to, getting tired to explain you that the pivots do not work corretly.

                          1. With the double session template in CalcFromIntradayData, I get the following results:

                          Pivot for night session ending Monday, May 10 (1109.50)

                          Calculated from close of Friday, 7 May (1107.50) / High of Thursday , 6 May (1165) and Low of Thursday 6 May (1056) -> nonsense

                          Pivot for day session of Monday, May 10 (1145.88)

                          Calculated from close (1153.25) , high (1162) and low (1121.50) of night session ending May 10 -> nonsense

                          Pivot for night session ending Tuesday, May 11 (1145.88)

                          Same as for prior day session, pivot are calculated from high, low and close of the prior night session -> nonsense

                          Pivot for day session of Tuesday, May 11 (1149.42)

                          Calculated from close (1146.00) , high (1162) and low (1140.50) of night session ending May 11 -> nonsense

                          To summarize: all pivots are exclusively calculated from the night session, with the exception of the night session ending Monday, which takes it pivots from a mixture of Thursday's and Friday's values.

                          Let us say that the indicator returns a meaningless collection of various lines with the double session template.

                          2. The S&P 500 future, to which you refer is traded in the pit during the day - night session is electronic and not very liquid. Neither NinjaTrader nor the template will help trading the pits, I am afraid . All of NT customers are trading E-mini, so a double session template would be used for the E-Mini only. The main advantage of such a customized template would be to use it for different indicators, such as opening range, session based VWAP or day session pivots.

                          The pivots indicator should in such a case select the correct daybreak line from the various session lines of the day. The correct day break would be the session break that triggers the settlement, because the settlement (or close) price is needed to calculate the pivots. The settlement session break is usually the last of the day. So the pivots indicator should display the same pivots for ES on a double session as on a single session.
                          Last edited by Harry; 05-18-2010, 06:39 PM.

                          Comment


                            #14
                            Modified code for multiple sessions

                            Have made a few changes to the indicator code:

                            - added two variables cacheSessionBeginTmp (dummy) and cacheSessionDate
                            - removed cacheSessionEndDaily (no longer needed)
                            - changed code for new lines 121,122
                            - replaced the offensive code bars.Session.GetSessionDate()-
                            - reworked private DateTime GetLastBarSessionDate(DateTime time, Data.Bars bars, PivotRange pivotRange)

                            Have tested this on various multiple sessions for ES and FDAX and at least on my machine it worked. The modified code will correctly display pivots for all types of intraday sessions, as long as the close of the last session of the day provides for the correct settlement/closing price.

                            Would appreciate, if you had a look at the code, as it solves the problem.
                            Attached Files

                            Comment


                              #15
                              Thanks again for your patience and your contribution. We'll look into shortly and will get back to you.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              591 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              343 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              103 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              556 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              553 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X