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
Comment