Hi
I know we can use highest https://www.prorealcode.com/documentation/highest/ and lowest https://www.prorealcode.com/documentation/lowest/ but does anyone have the code behind these please?
Thanks
Rob
// 20-period HIGHEST
//
// This is not the official PRT code, but it shouldn't be much different
//
Periods = 20
HighestPrice = 0
FOR i = 0 TO (Periods - 1)
HighestPrice = Max(high[i],HighestPrice)
NEXT
Roberto
Hi Roberto,
Many thanks
It’s close but not quite there. How could you apply this to the close like the PRT indicators are https://www.prorealcode.com/documentation/highest/
Thanks again,
Robert
Replace line 8 with:
HighestPrice = Max(close[i],HighestPrice)
Hi Roberto
Close does the job but how do I reverse this to get lowest please?
Many thanks for you help.
Thanks again
Robert
// 20-period LOWEST
//
// This is not the official PRT code, but it shouldn’t be much different
//
Periods = 20
LowestPrice = 999999
FOR i = 0 TO (Periods – 1)
LowestPrice = Min(close[i],LowestPrice)
NEXT
Many thanks Roberto, gives exactly the same results as the PRT code so thank you again.