All indicators

Support Resistance - Aging [Example]

Sep 24, 2020

Static chart image
Support and ResistanceSignalsDashboard

The Support Resistance - Aging [Example] indicator identifies dynamic support and resistance levels using pivot points and tracks their significance over time through an "aging" mechanism.

Usage

The tool identifies potential reversal zones and tracks how long those levels have remained intact. As a level gets "older" (stays active over more candles), its color intensity changes until it eventually expires or is broken by price action. This allows traders to visually assess the freshness and historical relevance of price floors and ceilings.

  • Identifying Levels: Resistance levels are formed at local highs, while support levels are formed at local lows based on the lookback period.
  • Aging Logic: Each level starts at age 0. With every new candle, the age increases. The visual output fades or changes color based on this age, providing a clear indication of how long a level has been held.
  • Level Expiration: Levels are automatically removed from the chart if the price breaks through them or if they reach the maximum age limit of 127 candles.

Details

This script serves as a technical demonstration of advanced array handling in Pine Script. It utilizes 1D arrays to simulate a 2D data structure, storing both the price level and its corresponding age.

The detection of levels is handled by finding the highest and lowest points within a specified window. The aging process is managed by an iterative function that updates the age index of every stored level on each bar. Furthermore, the script includes logic to detect when a level is "broken" by comparing the current closing price to the active array elements, ensuring only relevant levels are displayed.

Settings

  • Pivot Period: Determines the number of bars used to detect local highs and lows for S/R generation (ranges from 4 to 50).
  • Source: Choose between "High/Low" (uses candle extremes) or "Close/Open" (uses candle bodies) to define the S/R levels.
  • SR Color: Sets the base color for the support and resistance lines, with options for Red, Green, or Blue. The brightness of this color will adjust as the level ages.

FAQ

How do I use the aging feature?

The aging feature is automatic; you simply observe the color intensity of the circles. Newer levels appear brighter, while older levels fade out, indicating they may be losing relevance or nearing the maximum tracked duration.

What happens when a level is broken?

If the market price closes above a resistance level or below a support level, that specific level is immediately removed from the array and no longer plotted on the chart.

How can I access this tool?

You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.

Free indicator

Get free access to this indicator on the platforms below.

TradingView
NinjaTrader
MetaTrader 4/5

Unlock the entire LuxAlgo Library

Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.