I have been trying to figure out how I can receive the period of the highest price if I consider a look-back period of, lets say 60 days. For example, if the price peaked 26 days ago, I want to receive the integer ’26’.
A solution would be to use a FOR / NEXT loop to find the previous bar that made the highest high in the last X bars.
You can find an example to build this kind of loop in our online documentation : https://www.prorealcode.com/documentation/for/
Let me know if you need more support!
I will be using it for the look-back period to determine divergence patterns for OBV, MACD etc.. Although there may surely be several other applications. If anyone has more applicable ideas I am all ears!
To help us continually offer you the best experience on ProRealCode, we use cookies. By clicking on "Continue" you are agreeing to our use of them. You can also check our "privacy policy" page for more information.Continue