PP calculation wrong
Forums › ProRealTime English forum › ProBuilder support › PP calculation wrong
- This topic has 3 replies, 2 voices, and was last updated 12 months ago by LucasBest.
-
-
01/27/2024 at 9:13 PM #226968
Hi,
i need a indicator which show den last 3 PP’s. I wrote this one, but something is wrogn. The red line in the picture is the PP form my PP calculations for the current day, the black line is the PP from antoher indicator from pro Real Trader. Don’t knwo whats wrong. It would be nice if someone can help me.
123456789101112131415161718192021222324252627282930313233Timeframe (1 Day)PPCurrentDay = (High[1] + Low[1] + Close[1])/3 //PP of the current DayPPoneDaybefore = (High[2] + Low[2] + Close[2])/3 //PP Tradeday beforePPtwoDaybefore = (High[3] + Low[3] + Close[3])/3 //PP two Tradedays before//checked if the PP one Tradeday ago was reachedIf High[1] > PPoneDaybefore and low[1] < PPoneDaybefore thenPPoneDaybeforereached = 1elsePPoneDaybeforereached = 0endif//checked if the PP two Tradedays ago was reachedIf High[3] > PPtwoDaybefore and low[3] < PPtwoDaybefore thenPPtwoDaybeforereached = 1elsePPtwoDaybeforereached = 0endifTimeframe (60 Minutes)If High > PPCurrentDay and Low < PPCurrentDay thenPPreached = 1elsePPreached = 0endifPRINT(PPoneDaybefore) as "PPoneDaybefore" COLOURED("Black") FILLCOLOR("Green")PRINT(PPtwoDaybefore) as "PPtwoDaybefore" COLOURED("Black") FILLCOLOR("Green")PRINT(PPCurrentDay) as "PPCurrentDay" COLOURED("Black") FILLCOLOR("Green")//PRINT(PPoneDaybeforereached) as "PPoneDaybeforereached" COLOURED("Black") FILLCOLOR("Green")//PRINT(PPtwoDaybeforereached) as "PPtwoDaybeforereached" COLOURED("Black") FILLCOLOR("Green")Return PPCurrentDay01/28/2024 at 12:05 AM #226970The problem is allways at the first day of the week, The problem occurs on Mondays, if it is a holiday then Tuesday.
01/28/2024 at 9:56 AM #226972This could be a part pf the prblem, PP on Sunday? Never ever, but its every Sunday.
01/28/2024 at 4:44 PM #226976It is because of sunday of course. Here’s the formula i made to find the good Pivot Point (same pivot point as prorealtime embeded ones), which works in any time frame below 1 day. You don’t need to use timeframe instruction to get the Daily Pivot Point.
DailyPP that is accurate12345678910IF (DAYOFWEEK=DAYOFWEEK[1] and DAYOFWEEK<>DAYOFWEEK[2] and dayofweek>1) or (dayofweek<DAYOFWEEK[1]) thenIF dayofweek <> 1 or (dayofweek<DAYOFWEEK[1]) THENDailyPP = (DHigh(1) + DLow(1) + DClose(1)) / 3Elsif dayofweek = 1 thenDailyPP = (DHigh(2) + DLow(2) + DClose(2)) / 3endifdrawvline(barindex)endifReturn DailyPPI have an other code that is even more accurate (in my point of view)… Because, Prorealtime Pivot Point is little wrong every Tuesday. It does not take into account the low of the first candle of sunday (whatever the timeframe).
2 users thanked author for this post.
-
AuthorPosts