rebParticipant
Master
Hi
I am using as part of an indicator the code of Pivot point as below :
If OpenDayOfWeek = 1 Then
Ht = DHigh(2)
Bs = DLow(2)
C = DClose(2)
Endif
If OpenDayOfWeek => 2 and dayofweek < 6 Then
Ht = DHigh(1)
Bs = DLow(1)
C = DClose(1)
Endif
Pivot = (Ht + Bs + C) / 3
I have noticed sometimes differences between the code and my eye. After some reseachs, I have found the reason of those discrepencies: the Pivot point calculation.
To simplify, the indicator could be : if close > Pivot, it returns 1 and if close < Pivot, it returns -1
the black line is the native Pivot from PRT and the purple one the result of the above the code.
For a reason I don’t understand the Pivot value at the current bar is different. (see pic below)
This difference disappears if I reload PRT, and it comes back the next bar
Do you have an idea about this issue ?
Thanks in advance
Reb
reb – Topic moved to ProBuilder forum as it is an indicator issue. I have also inserted the code that you posted using the ‘Insert PRT Code’ button. Please ensure that you do the same with all future posts that include code. I have edited your post and inserted the code.
There have been several posts recently about DCLOSE, DHIGH, DLOW and DOPEN not returning the correct values and whilst we wait for PRT to provide a fix it is best to use MTF to return the daily time frame high, low, open and close values rather than use DCLOSE, DHIGH, DLOW and DOPEN.
rebParticipant
Master
ok thanks Vonasi for your answer
rebParticipant
Master
Here is the new code
timeframe( daily)
If OpenDayOfWeek = 1 Then
Ht = High[2]
Bs = Low[2]
C = Close[2]
Endif
If OpenDayOfWeek => 2 and dayofweek < 6 Then
Ht = High[1]
Bs = Low[1]
C = Close[1]
Endif
Pivot = (Ht + Bs + C) / 3
@reb
Always use the ‘Insert PRT Code’ button when putting code in your posts to make it easier for others to read.
Thank you 🙂