OPEN-SOURCE SCRIPT

KeyLevelsPivots

352
Indicator Name: Key Levels with Pivots

This indicator identifies key support and resistance levels using pivot high and pivot low values derived from TradingView’s built-in functions (ta.pivothigh and ta.pivotlow). When a new pivot is detected, the indicator checks if a similar level—within a specified percentage threshold (for example, ±1%) of the pivot value—already exists. If no such level is present, a horizontal line is drawn at that pivot level.

The drawn level extends to the right, automatically updating until one of two conditions occurs:

A breakout takes place—defined as the price moving beyond the level by the specified percentage—and then the level is fixed (truncated) at the bar where the breakout occurred.

The level reaches a maximum age (expressed in bars, e.g., 750 bars for a daily timeframe which approximates 3 years). In this case, the level is fixed at that maximum age.

Once fixed, the level no longer updates, allowing traders to view historically significant support and resistance levels from today's date up to approximately three years back. Additionally, the indicator prevents the re-plotting of a level if a similar level already exists within the defined percentage threshold, thereby avoiding duplicate reflections of the same level unless a breakout occurs.

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.