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.
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。