To start with, I found this formula for Pivot points on Investopdia and is from Tom Mark at Market Studies, Inc. His chart is located at the bottom of this message.
So I created formulas to try and draw this onto a NT chart but I end up with pivot points that are WAY off the scale. No matter how many times I comb through this code, I cannot find what is causing the lines to be so far off. Here is the code for reference.
//PIVOT POINTS BASED ON RECENT MARKET CONDITIONS
//For Decling market (today's open is lower than yesterday's open)
if ((PriorDayOHLC(BarsArray[1]).PriorOpen[0]) > (Opens[1][0]))
//Upper Pivot Point = sum of yesterday's (((high + close)+(low*2))/2)-low)
PivotUp.Set((((((PriorDayOHLC(BarsArray[1]).PriorHigh[0]) +(PriorDayOHLC(BarsArray[1]).PriorClose[0])) + ((PriorDayOHLC(BarsArray[1]) .PriorLow[0]) * 2))) /2) - (PriorDayOHLC(BarsArray[1]) .PriorLow[0]));
//Lower Pivot Point = sum of yesterday's (((high + close)+(low*2))/2)-high)
PivotDown.Set ((((((PriorDayOHLC(BarsArray[1]).PriorHigh[0]) +(PriorDayOHLC(BarsArray[1]).PriorClose[0]) + (PriorDayOHLC(BarsArray[1]) .PriorLow[0]) * 2))) /2) - (PriorDayOHLC(BarsArray[1]) .PriorHigh[0]));
//For Inclining market (today's open is higher than yesterday's open)
if (PriorDayOHLC(BarsArray[1]).PriorOpen[0] < Opens[1][0])
//Upper Pivot Point = sum of yesterday's (((low + close)+(high*2))/2)-low)
PivotUp.Set ((((((PriorDayOHLC(BarsArray[1]).PriorLow[0]) +(PriorDayOHLC(BarsArray[1]).PriorClose[0]) + (PriorDayOHLC(BarsArray[1]).PriorHigh[0]) * 2))) /2) - (PriorDayOHLC(BarsArray[1]) .PriorLow[0]));
//Lower Pivot Point = sum of yesterday's (((low + close)+(high*2))/2)-high)
PivotDown.Set ((((((PriorDayOHLC(BarsArray[1]).PriorLow[0]) +(PriorDayOHLC(BarsArray[1]).PriorClose[0]) + (PriorDayOHLC(BarsArray[1]).PriorHigh[0]) * 2))) /2) - (PriorDayOHLC(BarsArray[1]) .PriorHigh[0]));
//For Flat Market (today's open is even with yesterday's open)
if (PriorDayOHLC(BarsArray[1]).PriorOpen[0] == CurrentDayOHL(BarsArray[1]) .CurrentOpen[0])
//Upper Pivot Point = sum of yesterday's (((high + low)+(close*2))/2)-low)
PivotUp.Set ((((((PriorDayOHLC(BarsArray[1]).PriorHigh[0]) +(PriorDayOHLC(BarsArray[1]).PriorLow[0]) + (PriorDayOHLC(BarsArray[1]).PriorClose[0]) * 2))) /2) - (PriorDayOHLC(BarsArray[1]).PriorLow[0]));
//Lower Pivot Point = sum of yesterday's (((high + low)+(close*2))/2)-high)
PivotDown.Set ((((((PriorDayOHLC(BarsArray[1]).PriorHigh[0]) +(PriorDayOHLC(BarsArray[1]).PriorLow[0]) + (PriorDayOHLC(BarsArray[1]).PriorClose[0]) * 2))) /2) - (PriorDayOHLC(BarsArray[1]) .PriorHigh[0]));
The rest of my indicator works fine. Any help at all is much appreciated.
Best regards,
Dolfan
Comment