Aktualisiert
Auto S/R Channels [WillyAlgoTrader]

Auto Support & Resistance Channels is an overlay indicator that algorithmically discovers the highest-quality ascending and descending price channels by evaluating pivot-point combinations, scoring each candidate by how well price is contained within it, and monitoring the active channels for breakouts and boundary reactions in real time.
Channel drawing is one of the most subjective tasks in technical analysis — two traders rarely agree on where the lines should go. This indicator removes that ambiguity: it systematically tests dozens of pivot-pair combinations, builds a trendline + parallel for each, computes a containment ratio (what percentage of bars fit inside), and displays only the best-fitting result. The channel then becomes a live framework — the script detects breakouts when price closes through a boundary, identifies wick-based reactions (bounces) at support and resistance, fires categorized alerts, and automatically replaces stale channels when new pivots produce a superior fit.
🔍 WHAT MAKES IT ORIGINAL
1. Containment-ratio scoring across 40+ candidates. For each direction (ascending and descending), the algorithm evaluates up to 40 pivot-pair combinations (8 most recent pivots × 5 preceding pivots). For each pair it constructs the full channel — base trendline through the two anchors, parallel through the most extreme opposing pivot — then scans up to 300 bars, counting how many bars have their entire range (low to high) inside the channel with a tolerance of 5% ATR. The ratio of contained bars to total bars is the quality score. Only the candidate that scores highest above the minimum threshold (default 55%) is drawn. A new channel replaces the current one only when it scores at least 70% of the existing score AND its base pivots are actually different — preventing cosmetic redraws when the same pivots simply refine their quality metric.
2. Dual-direction parallel search. Both ascending and descending channel searches run on every new pivot (whether it's a high or a low). This ensures neither direction goes stale — a bug common in channel tools that only re-evaluate one direction per pivot type. Both channels can coexist on the chart, naturally capturing wedges, converging structures, and transitional markets.
3. Three-event signal classification.
— Breakout: close beyond the boundary with crossover verification (previous bar was inside or within 1.5× ATR)
— React: wick touches a boundary (within 12% ATR) but close + open remain inside — a bounce/rejection
— Aggregate: events from both channels combine into Buy / Sell / Wait (e.g., react at ascending support = Buy; breakout below descending support = Sell)
Each event type has its own alert toggle, so you can subscribe only to the signals you care about.
4. Five anti-phantom-signal guards.
— Max extrapolation: no detection beyond maxChannelBars past the second base pivot
— Crossover check: previous close must have been within 1.5× ATR of the boundary — no phantom signals when a new channel is drawn behind price that already moved away
— Smart flag reset: on channel rebuild, breakout flags reset only if price is currently inside the new channel (direction-agnostic boundary test)
— Change-gate: labels and flags are only cleared when the channel's base pivots actually change — if the same two pivots refine their quality score, existing signals are preserved
— Full label cleanup: when a channel does change, all labels from the previous version are deleted — no stale artifacts
5. Per-component line styling. Base line, parallel line, and midline each have independent width and style (solid / dashed / dotted). Combined with configurable fill transparency, extension mode (none / right / both), and separate bull/bear colors, the visual output adapts to any chart style.
⚙️ HOW IT WORKS
Pivot detection:
Swing points are identified with ta.pivothigh() and ta.pivotlow() using the configured lookback length. Up to 40 recent pivots of each type are stored. Pivots lag by N bars — standard for all pivot-based tools.
Ascending channel construction:
Pairs of pivot lows where the second is higher than the first (rising slope) and separated by Min–Max Channel Bars define candidate base trendlines. For each pair, the script scans all stored pivot highs within the channel's time span and selects the one with the greatest positive offset from the base — this becomes the parallel (resistance boundary). The channel width equals the maximum perpendicular distance from base to the highest opposing pivot.
Descending channel construction:
Mirror logic: pairs of pivot highs with falling slope define the base. The lowest opposing pivot low sets the parallel (support boundary).
Quality scoring:
Each candidate is scored by iterating up to 300 bars: a bar is "contained" if low ≥ lower boundary − 5% ATR AND high ≤ upper boundary + 5% ATR. The containment ratio (contained / total) is the quality score. The best candidate above the threshold wins. A replacement requires ≥70% of the current score AND different base pivot bars — this balance allows channels to evolve with the market while preventing noise-driven flickering.
Breakout detection:
On every confirmed bar (barstate.isconfirmed), both channel boundaries are interpolated at the current bar index. For an ascending channel: bullish breakout fires when close > parallel AND close[1] ≤ parallel[1] + 1.5× ATR; bearish breakout when close < base AND close[1] ≥ base[1] − 1.5× ATR. Descending channels use mirrored logic with direction-agnostic boundary identification. Breakout flags prevent duplicate signals until price re-enters the channel.
React detection:
A support reaction triggers when the bar's low penetrates the support boundary within 12% ATR tolerance, but the close and open remain above it — a classic wick rejection. Resistance reaction uses the same logic at the upper boundary.
📖 HOW TO USE
Reading the chart:
— Green channel = ascending (bullish bias) — base from pivot lows, parallel through the highest high
— Red channel = descending (bearish bias) — base from pivot highs, parallel through the lowest low
— Midline = channel equilibrium (50%) — frequently acts as intra-channel support/resistance
— "Breakout ▲" / "Breakout ▼" = confirmed close beyond a channel boundary
— Dashboard shows: Trend / Signal (Buy/Sell/Wait) / Strength / Quality % / Active Channels
Trading approach:
— In an ascending channel: look for long entries at base reactions (support bounces), take profit or watch for rejection at the parallel (resistance). A bullish breakout above the parallel may indicate trend acceleration.
— In a descending channel: look for short entries at base reactions (resistance rejections), cover at the parallel (support). A bullish breakout above the base signals a potential trend reversal.
— The midline often acts as an intermediate decision level — watch for stalls and direction changes there.
— Higher Quality % = more bars historically contained = stronger structural validity.
— When both channels are active simultaneously, the market is likely forming a wedge or converging structure — the directional breakout from whichever channel breaks first typically signals the next move.
Timeframe guidance:
— Scalping (1–15min): Pivot Length 3–7, Min Channel Bars 10–20, Quality 0.45–0.55
— Intraday (1H–4H): Pivot Length 8–15, Min Channel Bars 20–50, Quality 0.55–0.65
— Swing (Daily+): Pivot Length 15–30, Min Channel Bars 30–100, Quality 0.6–0.8
⚙️ KEY SETTINGS REFERENCE
— Pivot Length (default 21): bars left/right for swing detection — higher = fewer, stronger pivots
— ATR Length (default 14): tolerance, crossover guard, and quality calculations
— Min Channel Bars (default 10): minimum distance between the two base pivots
— Max Channel Bars (default 400): maximum lookback for pivot pairs and extrapolation limit for signal detection
— Min Channel Quality (default 0.55): minimum containment ratio — higher = stricter, fewer channels
— Extend Channels (default Right): project lines beyond anchor pivots (Right / Both / None)
— Delete Previous (default On): clean up old drawings and labels when a new channel forms
— Show Breakout Label (default On): display Breakout ▲/▼ labels on the chart
— Show Midlines (default On): 50% equilibrium line inside each channel
— Show Channel Fill (default On): subtle fill between boundaries
— Fill Transparency (default 95): 80–99 — higher = more transparent
🔔 Alerts
Three independent, toggleable alert types:
— Breakout: price closes outside a channel boundary (all five guards active)
— Signal: aggregated Buy/Sell from combined channel events
— React: wick rejection at a channel boundary
All alerts support standard TradingView text and optional JSON webhook format for 3Commas, Alertatron, or custom bot integrations.
⚠️ IMPORTANT NOTES
— Breakout and react signals require bar-close confirmation — they do not repaint after the bar closes.
— Channels will update when new pivots produce a higher-quality fit with different base points. This is by design — the indicator always shows the best available channel. All previous drawings and labels are cleaned up automatically on change.
— This is a structural analysis and event-detection tool. It maps the dominant price channel and monitors boundary interactions — it does not predict whether breakouts will follow through or reactions will hold.
— Past channel containment does not guarantee future price behavior within the same structure.
— Works across all asset classes and timeframes. No volume data required.
Channel drawing is one of the most subjective tasks in technical analysis — two traders rarely agree on where the lines should go. This indicator removes that ambiguity: it systematically tests dozens of pivot-pair combinations, builds a trendline + parallel for each, computes a containment ratio (what percentage of bars fit inside), and displays only the best-fitting result. The channel then becomes a live framework — the script detects breakouts when price closes through a boundary, identifies wick-based reactions (bounces) at support and resistance, fires categorized alerts, and automatically replaces stale channels when new pivots produce a superior fit.
🔍 WHAT MAKES IT ORIGINAL
1. Containment-ratio scoring across 40+ candidates. For each direction (ascending and descending), the algorithm evaluates up to 40 pivot-pair combinations (8 most recent pivots × 5 preceding pivots). For each pair it constructs the full channel — base trendline through the two anchors, parallel through the most extreme opposing pivot — then scans up to 300 bars, counting how many bars have their entire range (low to high) inside the channel with a tolerance of 5% ATR. The ratio of contained bars to total bars is the quality score. Only the candidate that scores highest above the minimum threshold (default 55%) is drawn. A new channel replaces the current one only when it scores at least 70% of the existing score AND its base pivots are actually different — preventing cosmetic redraws when the same pivots simply refine their quality metric.
2. Dual-direction parallel search. Both ascending and descending channel searches run on every new pivot (whether it's a high or a low). This ensures neither direction goes stale — a bug common in channel tools that only re-evaluate one direction per pivot type. Both channels can coexist on the chart, naturally capturing wedges, converging structures, and transitional markets.
3. Three-event signal classification.
— Breakout: close beyond the boundary with crossover verification (previous bar was inside or within 1.5× ATR)
— React: wick touches a boundary (within 12% ATR) but close + open remain inside — a bounce/rejection
— Aggregate: events from both channels combine into Buy / Sell / Wait (e.g., react at ascending support = Buy; breakout below descending support = Sell)
Each event type has its own alert toggle, so you can subscribe only to the signals you care about.
4. Five anti-phantom-signal guards.
— Max extrapolation: no detection beyond maxChannelBars past the second base pivot
— Crossover check: previous close must have been within 1.5× ATR of the boundary — no phantom signals when a new channel is drawn behind price that already moved away
— Smart flag reset: on channel rebuild, breakout flags reset only if price is currently inside the new channel (direction-agnostic boundary test)
— Change-gate: labels and flags are only cleared when the channel's base pivots actually change — if the same two pivots refine their quality score, existing signals are preserved
— Full label cleanup: when a channel does change, all labels from the previous version are deleted — no stale artifacts
5. Per-component line styling. Base line, parallel line, and midline each have independent width and style (solid / dashed / dotted). Combined with configurable fill transparency, extension mode (none / right / both), and separate bull/bear colors, the visual output adapts to any chart style.
⚙️ HOW IT WORKS
Pivot detection:
Swing points are identified with ta.pivothigh() and ta.pivotlow() using the configured lookback length. Up to 40 recent pivots of each type are stored. Pivots lag by N bars — standard for all pivot-based tools.
Ascending channel construction:
Pairs of pivot lows where the second is higher than the first (rising slope) and separated by Min–Max Channel Bars define candidate base trendlines. For each pair, the script scans all stored pivot highs within the channel's time span and selects the one with the greatest positive offset from the base — this becomes the parallel (resistance boundary). The channel width equals the maximum perpendicular distance from base to the highest opposing pivot.
Descending channel construction:
Mirror logic: pairs of pivot highs with falling slope define the base. The lowest opposing pivot low sets the parallel (support boundary).
Quality scoring:
Each candidate is scored by iterating up to 300 bars: a bar is "contained" if low ≥ lower boundary − 5% ATR AND high ≤ upper boundary + 5% ATR. The containment ratio (contained / total) is the quality score. The best candidate above the threshold wins. A replacement requires ≥70% of the current score AND different base pivot bars — this balance allows channels to evolve with the market while preventing noise-driven flickering.
Breakout detection:
On every confirmed bar (barstate.isconfirmed), both channel boundaries are interpolated at the current bar index. For an ascending channel: bullish breakout fires when close > parallel AND close[1] ≤ parallel[1] + 1.5× ATR; bearish breakout when close < base AND close[1] ≥ base[1] − 1.5× ATR. Descending channels use mirrored logic with direction-agnostic boundary identification. Breakout flags prevent duplicate signals until price re-enters the channel.
React detection:
A support reaction triggers when the bar's low penetrates the support boundary within 12% ATR tolerance, but the close and open remain above it — a classic wick rejection. Resistance reaction uses the same logic at the upper boundary.
📖 HOW TO USE
Reading the chart:
— Green channel = ascending (bullish bias) — base from pivot lows, parallel through the highest high
— Red channel = descending (bearish bias) — base from pivot highs, parallel through the lowest low
— Midline = channel equilibrium (50%) — frequently acts as intra-channel support/resistance
— "Breakout ▲" / "Breakout ▼" = confirmed close beyond a channel boundary
— Dashboard shows: Trend / Signal (Buy/Sell/Wait) / Strength / Quality % / Active Channels
Trading approach:
— In an ascending channel: look for long entries at base reactions (support bounces), take profit or watch for rejection at the parallel (resistance). A bullish breakout above the parallel may indicate trend acceleration.
— In a descending channel: look for short entries at base reactions (resistance rejections), cover at the parallel (support). A bullish breakout above the base signals a potential trend reversal.
— The midline often acts as an intermediate decision level — watch for stalls and direction changes there.
— Higher Quality % = more bars historically contained = stronger structural validity.
— When both channels are active simultaneously, the market is likely forming a wedge or converging structure — the directional breakout from whichever channel breaks first typically signals the next move.
Timeframe guidance:
— Scalping (1–15min): Pivot Length 3–7, Min Channel Bars 10–20, Quality 0.45–0.55
— Intraday (1H–4H): Pivot Length 8–15, Min Channel Bars 20–50, Quality 0.55–0.65
— Swing (Daily+): Pivot Length 15–30, Min Channel Bars 30–100, Quality 0.6–0.8
⚙️ KEY SETTINGS REFERENCE
— Pivot Length (default 21): bars left/right for swing detection — higher = fewer, stronger pivots
— ATR Length (default 14): tolerance, crossover guard, and quality calculations
— Min Channel Bars (default 10): minimum distance between the two base pivots
— Max Channel Bars (default 400): maximum lookback for pivot pairs and extrapolation limit for signal detection
— Min Channel Quality (default 0.55): minimum containment ratio — higher = stricter, fewer channels
— Extend Channels (default Right): project lines beyond anchor pivots (Right / Both / None)
— Delete Previous (default On): clean up old drawings and labels when a new channel forms
— Show Breakout Label (default On): display Breakout ▲/▼ labels on the chart
— Show Midlines (default On): 50% equilibrium line inside each channel
— Show Channel Fill (default On): subtle fill between boundaries
— Fill Transparency (default 95): 80–99 — higher = more transparent
🔔 Alerts
Three independent, toggleable alert types:
— Breakout: price closes outside a channel boundary (all five guards active)
— Signal: aggregated Buy/Sell from combined channel events
— React: wick rejection at a channel boundary
All alerts support standard TradingView text and optional JSON webhook format for 3Commas, Alertatron, or custom bot integrations.
⚠️ IMPORTANT NOTES
— Breakout and react signals require bar-close confirmation — they do not repaint after the bar closes.
— Channels will update when new pivots produce a higher-quality fit with different base points. This is by design — the indicator always shows the best available channel. All previous drawings and labels are cleaned up automatically on change.
— This is a structural analysis and event-detection tool. It maps the dominant price channel and monitors boundary interactions — it does not predict whether breakouts will follow through or reactions will hold.
— Past channel containment does not guarantee future price behavior within the same structure.
— Works across all asset classes and timeframes. No volume data required.
Versionshinweise
UPDATE v1.6.1 (from v1.4.3)NEW FEATURES
🎯 Measured-Move Targets
Every confirmed breakout now projects the channel width from the broken boundary as a price target — dashed line with a target label at the right edge of the chart. The label gets a checkmark when the target is reached. One active target per channel; it is replaced by a newer breakout and removed when the channel is rebuilt or expires. Webhook JSON now includes a "target" field for automation.
📊 Extended Dashboard
Three new metrics for the active channel: Width (in ATR units), Age (bars since the last base pivot), and Slope (% per bar). Values are tinted in the channel's color so you always know whether they refer to the ascending or descending structure. The indicator version is now shown in the header.
📏 Finite Channel Projection
Channels no longer extend to infinity. Lines now project a configurable number of bars (default 55) past the last chart bar, and the endpoint follows the chart as new candles form. New "Projection Bars" input; "Extend = Both" keeps the infinite left extension.
FIXES
Intrabar repaint fixed. Pivot detection and channel construction previously could react to unconfirmed intrabar data on the realtime bar, causing channels and labels to flicker mid-bar. All pivot acceptance, channel search, and drawing are now strictly confirmed-bar only. Signals were already evaluated on bar close and are unchanged.
Channel lifecycle. In earlier versions an outdated channel could remain drawn indefinitely while its alerts had silently stopped. Channels now fully expire once they exceed Max Channel Bars: drawings, labels, and targets are removed, and the quality slot is freed so fresh market structure can take over.
Gap breakouts. If price escaped a channel by a large gap, a misleading late "Breakout" label could appear on a subsequent retracement. Such moves are now latched silently — no false labels.
Quality scoring. Channel quality is now measured across the entire channel length (previously only the most recent 300 bars). Note: quality readings on long channels may be lower than in v1.4.3 — the new values are the honest ones; the old ones were inflated.
Strength metric. Signal strength is now derived from the quality of the channel that actually produced the signal, not the best of both channels.
Webhook reliability. JSON numeric fields now always emit valid numbers, including on fractional-tick instruments (e.g. treasury futures).
OTHER CHANGES
- Default Pivot Length changed 21 → 10; all tooltips aligned with recommended ranges
- Theme auto-detection improved (luminance-based, works on colored backgrounds)
- Performance: dashboard and projection updates now run on the last bar only; internal dead code removed
Signal logic is unchanged: Buy/Sell signals come from channel boundary reactions and reversal breakouts, evaluated strictly on bar close. As always — this is an analysis tool, not financial advice; no indicator predicts the market.
10 years in trading. For all inquiries, contact me on my Telegram channel: t.me/WillyAlgoTrader or Instagram: @willytraderbtc
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.
10 years in trading. For all inquiries, contact me on my Telegram channel: t.me/WillyAlgoTrader or Instagram: @willytraderbtc
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.