Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Pivot indicator montly pivots not correct.

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

    Pivot indicator montly pivots not correct.

    I've determined that the calculations for monthly pivots in the Pivot indicator are off by one day which causes the monthly pivots to be different than expected. My Pivot indicator settings are as follows:

    PivotRangeType: Monthly
    PriorDayHLC: DailyBars

    As an example, if I display monthly bars of the Aussie dollar futures contract built from historical daily data (example historical daily data attached), I get the following values for the month of March 09:

    High: 0.706
    Low: 0.6247
    Close: 0.6924 (the close of 3/31/09)

    The calculated pivot point is (0.706 + 0.6247 + 0.6924) / 3 = 0.6744.

    What I've determined is that the Pivot indicator uses the daily close of 4/1/09 (0.6941) instead of the 3/31/09 close. The March 09 pivot calculation is done in OnBarUpdate on 4/2/09 rather than on 4/1/09. Using the 0.6941 close of 4/1/09 gives a different pivot point:

    NinjaTrader monthly pivot point = (0.706 + 0.6247 + 0.6941) / 3 = 0.6749.

    Since all other monthly floor pivots are based on the pivot point, the error grows with each pivot level calculation.

    I think the problem is caused by these lines of code in the Pivot indicator:

    if (pivotRangeType == PivotRange.Monthly)
    currentMonth = RoundUpTimeToPeriodTime(Time[0].AddSeconds(-1).Date, PivotRange.Monthly);

    which sets the currentMonth after the check for the month change is made. Since the currentMonth is set to the previous day (i.e. AddSeconds(-1)), the logic is always looking two days back when determining a month change.

    Regards,

    David
    dbw451
    Attached Files

    #2
    We will take a look. Thanks.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      David,

      Thank you for bringing this to our attention. This will be fixed in NT7.
      Josh P.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      144 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      71 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      125 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      79 views
      0 likes
      Last Post PaulMohn  
      Working...
      X