Hi there,
I know there is a way to find the high or low of a number of bars BACK from the current bar, but is there a way to say “find me the highest close value between bar index 2 and 10”?
So between two arbitrary bars, find the highest or lowest value. I can probably script something up but thought there must be a function to do this!
Thanks again
k
This is the code to find “the highest close value between bar index 2 and 10”:
HH = highest[9](close[2])
it will scan bars 2 through 10 (9 bars).
Thanks Robert! Wow, I never would’ve figured that out. Thanks again!
Hello Roberto, this is an extremely helpful snippet of code. Thanks for sharing.
However I use it and don’t fully understand the results of the Highest function.
Can you please help me to understand why searching for a recent high using the “HIGH” function gets a different result from the “HIGHEST” function?
The image attached shows my result and you can find the code below.
As far as I understand, both should return the same result.
I am relatively new to PRT, so apologies if I’ve missed something obvious.
Thanks,
David.
HH1 = High[1]
HH2 = High[2]
HH = highest[2]
HHH = MAX(HH1,HH2)
Return HH AS "Recent Highest", HHH AS "Recent MAX"
highest[2](close) : search for the number of times, the highest number in brackets of what is in brackets
Thank you so much! That’s done the trick.
Use
HH1 = High
HH2 = High[1]
to match
highest[2]
as bars are identified from 0 (the current one, i.e. the first, or rightmost, bar) up to BarIndex; HIGH[BarIndex] is the HIGH of the leftmost bar, the very first bar.