OPEN-SOURCE SCRIPT
Mis à jour Trend Zone Dashboard with Auto S/R [PhenLabs]

Trend Zone Dashboard with Auto Support/Resistance [PhenLabs]
Version: PineScript™ v6

📌 Description
The Trend Zone Dashboard with Auto Support/Resistance is a professional-grade, self-calibrating support and resistance detection system. It automatically scans for pivot highs and lows across a configurable lookback window, clusters them into consolidated price zones using an adaptive tolerance algorithm, then scores each zone by touch frequency and bounce rate. The result is a clean set of actionable S/R zones rendered directly on the chart with an accompanying data-rich dashboard — no manual level-drawing required.
🚀 Points of Innovation
🔧 Core Components
🔥 Key Features
🎨 Visualization
📖 Usage Guidelines
✅ Best Use Cases
⚙️ Settings Overview
```
Version: PineScript™ v6
📌 Description
The Trend Zone Dashboard with Auto Support/Resistance is a professional-grade, self-calibrating support and resistance detection system. It automatically scans for pivot highs and lows across a configurable lookback window, clusters them into consolidated price zones using an adaptive tolerance algorithm, then scores each zone by touch frequency and bounce rate. The result is a clean set of actionable S/R zones rendered directly on the chart with an accompanying data-rich dashboard — no manual level-drawing required.
🚀 Points of Innovation
- Auto Mode with Binary Search Calibration: A built-in iterative algorithm automatically tunes clustering tolerance to converge on a user-defined target number of zones (default: 5), eliminating the need for manual parameter tweaking across different instruments and timeframes.
- Statistical Zone Scoring: Each zone is scored by both touch count (how often price interacts with the zone) and bounce rate (percentage of touches that produced confirmed reversals), giving traders a quantified measure of zone reliability.
- Greedy Merge Clustering: Sorted pivot prices are merged using an ATR-adaptive or percentage-based tolerance, producing naturally consolidated zones that reflect true areas of price memory rather than arbitrary horizontal lines.
🔧 Core Components
- Pivot Detection Engine: Uses `ta.pivothigh()` and `ta.pivotlow()` with configurable strength to identify swing points. Raw pivots are accumulated incrementally across all bars for efficiency, then filtered to the lookback window on the final bar.
- Adaptive Clustering Algorithm: In Auto Mode, a 15-iteration binary search explores tolerance values between 0.1× ATR and 8× ATR, counting the resulting clusters at each step until the output converges to ±1 of the target zone count. In Manual Mode, the user directly sets ATR multiplier or percentage threshold.
- Touch & Bounce Tracker: On the last bar, the engine scans the full lookback window bar-by-bar for each zone. A “touch” occurs when a bar’s high-low range overlaps the zone boundary. A “bounce” is confirmed when the close moves away from the zone midpoint relative to the prior close, distinguishing genuine rejections from breakdowns.
- Directional Pruning System: Zones are intelligently removed only when price has decisively broken through them in the correct direction — support zones are pruned only if price collapses far below them, and resistance zones only if price surges far above. This prevents valid zones from being erroneously discarded.
🔥 Key Features
- Dynamic Dashboard Table: An on-chart table (positionable to any corner) displays each active zone’s price level, type (Support/Resistance), pivot confluence count, touch strength, distance from current price, and bounce rate — all color-coded for instant readability.
- Strength-Scaled Zone Boxes: Zones are drawn as shaded rectangular regions on the chart, with transparency inversely proportional to their strength score. Stronger zones appear more vivid; weaker zones fade into the background.
- Color-Coded Bounce Rate: High bounce rates on support zones glow green; high bounce rates on resistance zones glow red. Low-confidence zones are dimmed to gray, directing attention to the most actionable levels.
- Pivot Confluence Column: Shows how many raw pivot points were merged into each cluster, providing a confluence metric independent of the touch count.
- Info Footer Row: The dashboard footer displays the current mode (Auto/Manual), computed tolerance, total pivot count, and lookback depth for full transparency into the algorithm’s behavior.
🎨 Visualization
- Zone Boxes: Support zones rendered in green, resistance zones in red, extending from the lookback origin to 25 bars into the future. Width reflects the natural spread of the clustered pivot prices.
- Zone Labels: Compact labels at the right edge of each zone box display type, price level, touch count, and bounce rate at a glance.
- Dashboard Table: A 6-column professional table with a blue header row, color-coded data cells, and a gray info footer. Fully repositionable via dropdown input.
📖 Usage Guidelines
- Auto Mode (Recommended): Leave Auto Mode enabled with the default target of 5 zones. The algorithm will self-calibrate to produce approximately 5 meaningful S/R zones on any instrument or timeframe. Increase the target for more granular analysis or decrease it for a cleaner chart.
- Lookback Period: The default of 200 bars works well for most scenarios. Increase to 500+ on higher timeframes (Daily, Weekly) to capture macro structure. Decrease to 50–100 on scalping timeframes for more responsive zones.
- Pivot Strength: Controls the minimum swing significance. Higher values (8–15) produce fewer but more significant pivots. Lower values (2–4) capture minor swings and produce denser zone coverage.
- Manual Mode: Disable Auto Mode to take direct control of clustering tolerance. Use ATR multiplier for volatility-adaptive clustering, or percentage threshold for fixed-width zones relative to price.
- Breakout Pruning: The breakout ATR multiplier (default 2.0) controls how far price must close beyond a zone before it’s considered invalidated. Increase for more persistent zones; decrease for faster pruning.
✅ Best Use Cases
- Key Level Identification: Automatically surface the most statistically significant support and resistance levels without manual drawing, ideal for traders who analyze multiple instruments.
- Zone Quality Assessment: Use the bounce rate column to distinguish between zones that consistently produce reversals versus zones that price tends to slice through — critical for setting stop-loss and take-profit targets.
- Confluence Trading: Zones with high pivot counts AND high touch counts represent areas where price has repeatedly found significance from multiple independent swing points, offering the highest-probability trade setups.
- Breakout Validation: When a zone with a historically high bounce rate is finally broken (pruned from the dashboard), it signals a genuine structural shift rather than a false breakout.
- Multi-Timeframe Analysis: Run the indicator on your execution timeframe with a long lookback to naturally capture higher-timeframe structure within a single instance.
⚙️ Settings Overview
- Auto Mode (Default: On) — Enables intelligent self-calibration of clustering parameters.
- Target Number of Zones (Default: 5) — The desired number of S/R zones in Auto Mode. Range: 2–15.
- Lookback Period (Default: 200) — Number of bars to scan for pivots. Range: 20–1000.
- Pivot Strength (Default: 5) — Left/right bar count for pivot confirmation. Range: 2–20.
- Clustering Method (Default: ATR) — ATR-based or Percentage-based tolerance for manual mode.
- ATR Multiplier (Default: 1.0) — Multiplier applied to ATR for zone merge tolerance in manual mode.
- Percentage Threshold (Default: 0.5%) — Fixed percentage tolerance for zone merging in manual mode.
- Minimum Touches (Default: 2) — Zones with fewer touches are filtered out (manual mode only; auto mode uses 1).
- Maximum Zones (Default: 8) — Hard cap on displayed zones.
- Breakout Pruning (Default: 2.0× ATR) — Distance beyond zone edge required to consider it broken.
- Dashboard Position (Default: Top Right) — Corner placement for the dashboard table.
- Show Zone Boxes (Default: On) — Toggle chart zone rendering.
- Show Zone Labels (Default: On) — Toggle zone annotation labels.
- Support/Resistance Colors — Fully customizable zone and dashboard color scheme.
💡 Note
This indicator performs its full computation on the last bar only (`barstate.islast`), making it lightweight regardless of chart history length. The Auto Mode binary search converges in ≤15 iterations, adding negligible overhead. For best results, ensure your chart has sufficient history loaded (at least 200+ bars) so the pivot detection engine has adequate data to identify meaningful swing points. Always use this tool in conjunction with price action context and broader market structure analysis.
```
Notes de version
Chart updateScript open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
TradingView Charting w/ Crypto Systems: phenlabs.com
Join our growing community: discord.gg/phen
All content provided by PhenLabs is for informational & educational purposes only. Past performance does not guarantee future results.
Join our growing community: discord.gg/phen
All content provided by PhenLabs is for informational & educational purposes only. Past performance does not guarantee future results.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
TradingView Charting w/ Crypto Systems: phenlabs.com
Join our growing community: discord.gg/phen
All content provided by PhenLabs is for informational & educational purposes only. Past performance does not guarantee future results.
Join our growing community: discord.gg/phen
All content provided by PhenLabs is for informational & educational purposes only. Past performance does not guarantee future results.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.