Find high or low between bars

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #189597 quote
    krogenkrogen
    Participant
    New

    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

    #189603 quote
    robertogozzirobertogozzi
    Moderator
    Legend

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

    krogen thanked this post
    #189658 quote
    krogenkrogen
    Participant
    New

    Thanks Robert! Wow, I never would’ve figured that out. Thanks again!

    #238626 quote
    D.tradingD.trading
    Participant
    New

    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"
    Screenshot-2024-10-07-at-17.11.16.jpg Screenshot-2024-10-07-at-17.11.16.jpg
    #238628 quote
    fifi743fifi743
    Participant
    Master

    highest[2](close)  :   search for the number of times, the highest number in brackets of what is in brackets

    D.trading and robertogozzi thanked this post
    #238630 quote
    D.tradingD.trading
    Participant
    New

    Thank you so much! That’s done the trick.

    #238648 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    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.

    D.trading thanked this post
Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Find high or low between bars


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
krogen @krogen Participant
Summary

This topic contains 6 replies,
has 4 voices, and was last updated by robertogozzirobertogozzi
1 year, 11 months ago.

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 03/08/2022
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...