Automatic Support & Resistance
May 26, 2026

The Automatic Support & Resistance indicator automatically identifies significant price pivots to plot dynamic key levels, helping traders visualize potential supply and demand zones.
Usage
The Usage section describes how the script can be used to identify key market structures. By detecting local peaks and troughs, the tool highlights areas where price is likely to face rejection or find support.
- Identifying Resistance: The top levels (1, 3, 5, 7) represent historical price ceilings. If price approaches these levels from below, they may act as selling zones.
- Identifying Support: The bottom levels (2, 4, 6, 8) represent historical price floors. If price approaches these levels from above, they may act as buying zones.
- Trend Context via Color: The levels dynamically change color based on price action. A green level indicates the current price is trading above it (potential support), while a red level indicates the price is trading below it (potential resistance).
- Sensitivity Adjustments: Users can toggle between "Regular" and "Quick" pivots to capture either long-term structural shifts or short-term price fluctuations.
Details
The script utilizes ta.pivothigh() and ta.pivotlow() functions to detect significant price turning points. It operates using a hierarchy of eight levels: four derived from recent resistance pivots and four from support pivots.
The detection logic incorporates two different "speeds":
- Regular Pivots: Confirmed after a set number of
Right Bars, providing stable long-term levels. - Quick Pivots: Confirmed using the
Quick Rightsetting, allowing the indicator to respond faster to recent price movements.
To maintain chart clarity, the script uses the show_last=1 parameter to display only the most recent segment of each level and trackprice=true to extend these lines to the right axis for real-time reference. The logic is non-repainting; while the colors update dynamically based on the Close price, the level positions themselves only lock in once the confirmation period (Right Bars) has passed.
Settings
- Left Bars: The number of bars required to the left of a high or low to qualify it as a pivot.
- Right Bars: The number of bars required to the right to confirm a regular pivot level.
- Quick Right: A smaller confirmation window used for more sensitive, faster-reacting pivot levels.
- Source: Determines whether the script calculates pivots based on the "Close" price or the "High/Low" values.
FAQ
How do I adjust the indicator for different timeframes? For higher timeframes like Daily or Weekly, you may want to decrease the Left and Right bar counts to find more levels, whereas on lower timeframes like the 1-minute or 5-minute, increasing these values can help filter out market noise.
What does it mean when a level changes from red to green? A level turns green when the current price closes above it, suggesting the previous resistance may now act as support. Conversely, it turns red when price closes below it.
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.
Unlock the entire LuxAlgo Library
Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.