PROTECTED SOURCE SCRIPT

ATH Line with Date (Editable)

41
Overview:

This indicator draws a continuous horizontal line at the instrument’s All-Time High (ATH) and annotates it with a label that shows the date the ATH was set in dd-mmm-yyyy format. The label is fully configurable (text prefix, side, position, colors, vertical offset), and you can optionally append the ATH price formatted as $ 1.234,56. Built for Pine Script™ v6 and works on any symbol or timeframe.

How it works
• Maintains a running maximum of high.
• Detects the bar where the current ATH occurred and extracts its date.
• Renders a horizontal line extended both sides at the ATH level.
• Places an optional label on the last bar or on the ATH bar.
• Triggers an optional alert when a new ATH is printed.

Inputs
• Line color / width / style – customize the ATH line appearance.
• Show label – toggle label on/off.
• Label text (prefix) – default ATH ►.
• Label text color / background – visual customization for the tag.
• Label side – left or right-anchored label.
• X location – Last bar or ATH bar.
• Label vertical offset (%) – moves the label above/below the line.
• Show price – appends the ATH price in the format $ 1.234,56

Notes & behavior:

• Repainting: The ATH level is stable until a higher high appears. When a new ATH is set, the line and date update accordingly—this is expected behavior.
• The ATH is computed from the chart’s current timeframe/history. If the symbol has limited history on your chart, the ATH reflects only the available data.
• No external libraries; no user data is collected.

Alerts:

• Includes New ATH alert condition. Fire it to be notified when price sets a new all-time high.

Tips:
• Use Last bar placement to keep the label visible at the right edge while scrolling.
• If the label overlaps candles or drawings, add a small positive vertical offset.

Version:

• Pine Script™ v6. Indicator only; no trading signals or orders.

Disclaimer:

For educational purposes only. This script does not constitute financial advice or a recommendation to buy or sell any security. Always do your own research and manage risk appropriately.

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.