All Time High (ATH) Levels

All Time High (ATH) Levels

All-Time Highs (ATH) represent significant psychological barriers in financial markets. They act as “ceilings” where price discovery occurs, often triggering breakouts or strong rejections.

The ATH Levels indicator (by LuxAlgo) automates the detection of these historical peaks. Unlike a simple “Max Price” line, this tool identifies a sequence of significant historical highs and projects them forward, classifying them as dynamic Support or Resistance levels based on subsequent price action.

How it Works

This indicator scans the entire loaded history of an asset to identify every instance where a new All-Time High was established. However, simply plotting every single high would clutter the chart. To solve this, the indicator employs a smart filtering and classification system:

ATH Detection & Filtering:

The indicator tracks the global maximum price. It uses an ATR (Average True Range) filter to ensure that only distinct, significant levels are displayed. If a new ATH is too close to a previous one (based on the distMult setting), it is merged or ignored to keep the chart clean.

Dynamic Support/Resistance (S/R) Classification:

  • The indicator calculates how price interacts with each level after it was created.

  • Support (Bullish – Teal): If the price spends significant time above an old ATH level, that level is considered valid Support.

  • Resistance (Bearish – Red): If the price remains below an old ATH level, it acts as Resistance.

  • Visual Gradient: The lines change color dynamically. The solid lines are drawn from the historical point of the ATH extending to the right of the current price, making it easy to identify relevant levels for the current trading session.

Note: This indicator uses DEFPARAM DrawOnLastBarOnly = True. This means it is optimized for market analysis and chart reading, drawing the lines only on the most recent update to ensure fast performance.

Settings & Configuration

You can customize the sensitivity and visual style of the indicator by modifying the variables at the beginning of the code:

  • showLast (Default: 50): Determines the maximum number of historical ATH lines to display on the chart. Reducing this number improves performance on charts with massive amounts of data.

  • duration (Default: 3): The minimum duration (in bars) required to confirm a new ATH level. Higher values filter out “noise” spikes.

  • distMult (Default: 3.0): This is the ATR Multiplier. It dictates the minimum vertical distance required between two ATH levels for them to be displayed separately.

    • Increase this value to see fewer, more significant levels.

    • Decrease this value to see more granular levels.

  • showClassification (Default: 1): Set to 1 to display text labels ([S] for Support, [R] for Resistance) and the price level. Set to 0 to hide text.

  • minSr (Default: 0): A filter for the strength of the Support/Resistance. Increasing this value will hide levels that are “neutral” (where price oscillates around the line without clear direction), showing only strong S/R levels.

The Code

Share this

Risk disclosure:

No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.

ProRealTime ITF files and other attachments : How to import ITF files into ProRealTime platform?

PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials

avatar
Register or
Related users ' posts
mscharstrom Hi @robertogozzi, I really love this indicator. However, I'd like to tinker with it to fit ...
Ahimsa Hi Roberto I cannot thank you enough for writing this code. It could help me more than you ...
Nicolas With PRT v11, you have to click on "price" at the upper left side of the price chart.
Nicolas Sure, I suggest you open a new topic in the forum to discuss about your ideas.
hdgm Bonjour Nicolas, est ce que l'on peut en faire une stratégie de trading automatisée ?
Nicolas Non, pas en utilisant l'indicateur zigzag traditionnel de la plateforme.
Gianluca ok i fixed it i hope is ok like this: //TAC trader zone 10.2 | indicator //01.01.2018 //R...
TAC Bolsa Hello try this new version or view the blog with the new indicators .. https://www.t...
TAC Bolsa Sorry, TAC Trader Zone V2 https://www.tiburonesdealetacorta.com/2018/11/indicador-tac-tr...
FULVIO09 Attualmente non c'è sufficiente volatilità : la condizione "C0 = AverageTrueRange[1500](Clos...
vlongobardo67 Ma io intendevo in backtest ! Scusa non l’ho menzionato.
ciniselloftse salve fulvio .il trading sistem e sempre profittevole?
cervantes2 Buenas tardes y gracias por este magnifico indicador. Queria saber si tienes un proscreener ...
cervantes2 Que busque los valores que la linea verde acaba de cruzar al alza o a la baja
AngelPujalt Tenéis algún screener de este indicador?
Yannick Hello There is a mistake in trailing stop code, I think that this should fix the problem s...
Paul About the trailing-stop the way it's coded. That works for backtesting only, just look at th...
Jonny sorry paul, but system says that is not possible to put many stop order combined...what have...
rb-72 Thank you, area of twist by dilatacion of the price, missing part of the code that is not pu...
Thomas007 after reading your blog now I understand why there is only a part of your code here. I'm try...
Juanjo Hola¡¡ la estrategia se podria aplicar sobre acciones con marco temporal diario?? gracias.
Leo Hi all, I posted a new version of this indicator ( I just add arrows to spot the local maxi...
Trading_En_El_Ibex35 Muchas Gracias por compartir este interesante indicador. Un saludo
xavieralava hola gracias leo
Nicolas https://www.prorealcode.com/topic/ayuda-screener-indicador-perfect-trend-line/#post-51291
Manu L. Bonjour Nicolas, suite a une de mes precedentes demande dans le forum indicateur, j'ai touv...
AntoGH C'est selon moi le meilleur indicateur, que j'ai vu, si vous trouvez mieux dîtes moi car dif...

Top