OPEN-SOURCE SCRIPT
Auto Support Resistance Channels

Auto Support Resistance Channels
This indicator builds support and resistance zones from confirmed pivot structure and then ranks those zones using a multi-factor scoring model. Its purpose is not simply to mark swing highs and lows, but to convert repeated price interaction into structured channels that reflect how often a level formed, how price reacted from it, and how well it held over time.
This script is inspired by the support/resistance concepts and earlier implementations shared by LonesomeTheBlue. The current version extends that idea with a custom zone construction and scoring model, including pivot clustering, reaction-based weighting, and structural filtering. The implementation and logic have been independently developed and differ from the original approach.
The script begins by detecting confirmed pivot highs and pivot lows using a user-defined pivot length. Each pivot becomes a candidate anchor point for a future zone. Around every pivot, the indicator creates an initial price band whose width is scaled by ATR. This makes the zone size adaptive to current market volatility rather than fixed in ticks or points.
From there, the script groups nearby pivots into shared zones. If multiple pivots occur within the allowed ATR-based distance, they are treated as evidence of the same structural area. This allows the indicator to build broader support or resistance channels from repeated interaction instead of drawing isolated single-price levels.
What distinguishes the script is its scoring framework. Each candidate zone receives a base score from the number of pivots it contains, but that is only the starting point. The script also evaluates the post-pivot reaction: if price moves away from a pivot with sufficient impulse, measured in ATR, and does so without excessive early retracement, that pivot contributes additional reaction score to the zone. In other words, zones are rewarded not only for existing, but for producing meaningful rejection.
The script then applies several penalties that reduce the quality score of weaker zones. If price later closes through the zone, the score is reduced. If candle bodies spend time inside the zone, suggesting acceptance rather than rejection, the score is reduced further. If candles repeatedly close inside the zone, the script applies an additional penalty. These filters are designed to separate cleaner structural rejection zones from areas where price trades through too freely.
A further contextual filter evaluates where the zone sits inside the recent trading range. Zones near the middle of the range can receive a penalty, reflecting the idea that mid-range levels are often less structurally meaningful than levels formed near the outer edges of a swing. Conversely, zones closer to the recent range high or low can receive a swing bonus, which increases the score of edge-of-range structures.
After all candidate zones are scored, the script checks for similar or overlapping zones and merges them where appropriate. It then selects the highest-scoring non-overlapping zones, up to the user-defined display limit. The final result is a ranked map of support and resistance channels, with color intensity reflecting the relative zone score.
This makes the indicator different from simple pivot-based support and resistance tools. It does not plot every swing point indiscriminately. Instead, it evaluates whether repeated pivot clustering, clean reaction, and subsequent holding behavior justify promoting an area into a displayed channel.
Key concepts implemented in the script:
Confirmed pivot high and pivot low detection
ATR-based adaptive zone width
Clustering of nearby pivots into shared zones
Reaction scoring based on post-pivot excursion and retracement quality
Penalties for breaks, dwell inside the zone, and closes inside the zone
Context filter using recent range position
Optional swing-edge bonus for zones near range extremes
Selection of top-ranked non-overlapping zones
How to use:
The plotted boxes represent the highest-ranked support and resistance areas found within the active lookback. Wider ATR multipliers create broader zones, while higher pivot lengths make the script more selective. Increasing the reaction requirements makes the indicator focus more on pivots that produced stronger directional rejection. Increasing the penalty weights makes the scoring stricter and reduces tolerance for zones that price trades through frequently.
Auto Lookback can be used to reset the analysis at the start of each new day, while Manual Lookback keeps the zone construction tied to a fixed historical window. The color gradient helps distinguish relatively weaker zones from stronger ones based on the script’s internal score.
This indicator does not predict future price direction and does not generate standalone trade signals. It is designed to formalize support and resistance channel construction into a repeatable process based on pivot clustering, reaction quality, and subsequent price behavior.
This indicator builds support and resistance zones from confirmed pivot structure and then ranks those zones using a multi-factor scoring model. Its purpose is not simply to mark swing highs and lows, but to convert repeated price interaction into structured channels that reflect how often a level formed, how price reacted from it, and how well it held over time.
This script is inspired by the support/resistance concepts and earlier implementations shared by LonesomeTheBlue. The current version extends that idea with a custom zone construction and scoring model, including pivot clustering, reaction-based weighting, and structural filtering. The implementation and logic have been independently developed and differ from the original approach.
The script begins by detecting confirmed pivot highs and pivot lows using a user-defined pivot length. Each pivot becomes a candidate anchor point for a future zone. Around every pivot, the indicator creates an initial price band whose width is scaled by ATR. This makes the zone size adaptive to current market volatility rather than fixed in ticks or points.
From there, the script groups nearby pivots into shared zones. If multiple pivots occur within the allowed ATR-based distance, they are treated as evidence of the same structural area. This allows the indicator to build broader support or resistance channels from repeated interaction instead of drawing isolated single-price levels.
What distinguishes the script is its scoring framework. Each candidate zone receives a base score from the number of pivots it contains, but that is only the starting point. The script also evaluates the post-pivot reaction: if price moves away from a pivot with sufficient impulse, measured in ATR, and does so without excessive early retracement, that pivot contributes additional reaction score to the zone. In other words, zones are rewarded not only for existing, but for producing meaningful rejection.
The script then applies several penalties that reduce the quality score of weaker zones. If price later closes through the zone, the score is reduced. If candle bodies spend time inside the zone, suggesting acceptance rather than rejection, the score is reduced further. If candles repeatedly close inside the zone, the script applies an additional penalty. These filters are designed to separate cleaner structural rejection zones from areas where price trades through too freely.
A further contextual filter evaluates where the zone sits inside the recent trading range. Zones near the middle of the range can receive a penalty, reflecting the idea that mid-range levels are often less structurally meaningful than levels formed near the outer edges of a swing. Conversely, zones closer to the recent range high or low can receive a swing bonus, which increases the score of edge-of-range structures.
After all candidate zones are scored, the script checks for similar or overlapping zones and merges them where appropriate. It then selects the highest-scoring non-overlapping zones, up to the user-defined display limit. The final result is a ranked map of support and resistance channels, with color intensity reflecting the relative zone score.
This makes the indicator different from simple pivot-based support and resistance tools. It does not plot every swing point indiscriminately. Instead, it evaluates whether repeated pivot clustering, clean reaction, and subsequent holding behavior justify promoting an area into a displayed channel.
Key concepts implemented in the script:
Confirmed pivot high and pivot low detection
ATR-based adaptive zone width
Clustering of nearby pivots into shared zones
Reaction scoring based on post-pivot excursion and retracement quality
Penalties for breaks, dwell inside the zone, and closes inside the zone
Context filter using recent range position
Optional swing-edge bonus for zones near range extremes
Selection of top-ranked non-overlapping zones
How to use:
The plotted boxes represent the highest-ranked support and resistance areas found within the active lookback. Wider ATR multipliers create broader zones, while higher pivot lengths make the script more selective. Increasing the reaction requirements makes the indicator focus more on pivots that produced stronger directional rejection. Increasing the penalty weights makes the scoring stricter and reduces tolerance for zones that price trades through frequently.
Auto Lookback can be used to reset the analysis at the start of each new day, while Manual Lookback keeps the zone construction tied to a fixed historical window. The color gradient helps distinguish relatively weaker zones from stronger ones based on the script’s internal score.
This indicator does not predict future price direction and does not generate standalone trade signals. It is designed to formalize support and resistance channel construction into a repeatable process based on pivot clustering, reaction quality, and subsequent price behavior.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.