% Below ATH

Optuma Forums Optuma Scripting % Below ATH


Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #52825
    • Topics: 1
    • Replies: 0
    • Posts: 1

    Does anyone know the correct script to get the “percent below all-time high” for an issue. I am using the following but noticing the data is not correct. 

    (HIGHESTHIGH(RANGE=All Time)-close(0))/close()

    • Topics: 4
    • Replies: 216
    • Posts: 220

    Hi Steven,

    You don’t need to do the calculation manually, there is a function that does it automatically called Range from Extremes RFE()  

    An example script for % from All Time high would be:

    On a show view the result would look like this:


      Show View using the above script has a value of 12.07% from AAPLs all time high.

    • Topics: 31
    • Replies: 49
    • Posts: 80

    What about that black line at the ATH.


    Can’t we plot a code on the chart that says ATH – the date & then also list the % that the share has until it reaches the ATH? 


    This way the chart can dynamically update. Without having a show view tab below chart … ?

    • Topics: 4
    • Replies: 216
    • Posts: 220

    You don’t need to script it, you can use the Range from Extremes tool itself to plot the ATH / ATL on the chart, and the date will appear when you hover over the line for each…


    You can see more information on the tool here:



    • Topics: 43
    • Replies: 304
    • Posts: 347

    Note if you want to display as % in a watchlist divide by 100 and change the column type to Percentage:

    RFE(BACKTYPE=All Time)/100

    Also you can colour-code the cells based on values by right-clicking on the column title and going to Custom Labels, so within 5% of ATH set to green:


    • Topics: 4
    • Replies: 12
    • Posts: 16

    52 week drawdown

    Also, Darren gave me this code for 52 week drawdown.  It has worked well for me.  I do like the RFE as I was trying to find the distance above recent highs, and that may work well.  Thanks.

Viewing 6 posts - 1 through 6 (of 6 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.