Finding multiple bars in a row with the same high

Optuma Forums Optuma Scripting Finding multiple bars in a row with the same high

This topic contains 1 reply, has 2 voices, and was last updated by Darren Darren 8 months, 1 week ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #47263

    • Topics: 3
    • Replies: 0
    • Posts: 3


    Please forgive my newness to Optuma scripting… no idea where to start for this one.

    I’m keen to run a scan that shows multiple bars in a row that have the same high (or low). A bonus would be if it could have a tolerance, as in within x% or points of each other. Image below for reference, don’t need a blue line, just a pointer as to where it is.



    • Topics: 31
    • Replies: 172
    • Posts: 203

    Hi Rhiannon,

    You can use the following in a Show Bar, which will highlight consecutive highs:

    HIGH() == HIGH(1)

    where HIGH() is the current bar, and HIGH(1) is the previous bar. To build a 1% tolerance you could do something like:

    (HIGH() > (HIGH(1)*0.99)) and (HIGH() < (HIGH(1)*1.01))


    For a scan you can use the BARSTRUE() function (Lecture 3 here), so where at least 3 highs are within 1% of each other:

    BARSTRUE((HIGH() > (HIGH(1)*0.99)) and (HIGH() < (HIGH(1)*1.01)), LOOKBACK=3) == 3

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

You must be logged in to reply to this topic.

Pin It on Pinterest

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.