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 1 month ago.

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

    Rhiannon
    • Topics: 1
    • Replies: 0
    • Posts: 1

    Evening,

    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.

    highbars

    Thanks!

    #47303
    Darren
    Darren
    • Topics: 24
    • Replies: 98
    • Posts: 122

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

    Capture

    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

Share This

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.

Close