Period of highest price

Viewing 3 posts - 1 through 3 (of 3 total)
  • #31538

    Hi,

    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’.

    Thanks,

    Simon

    #32120

    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!

    #32179

    Thanks for the feedback Nicolas,

    This is the FOR-loop I managed to write:

    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!

Viewing 3 posts - 1 through 3 (of 3 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login