Wedge Reversal Detector [AGPro Series]Wedge Reversal Detector
🔷 Overview
Wedge Reversal Detector is a focused chart-pattern engine built for one specific structure: the rising wedge and falling wedge. Instead of scanning every possible reversal pattern, drawing broad support and resistance, or behaving like a generic breakout dashboard, this script studies the geometry of a wedge itself: confirmed pivot boundaries, slope convergence, pattern maturity, reversal break quality, projected reaction zone, and invalidation context.
The goal is to make wedge analysis cleaner and more objective on a live chart. A valid wedge is not treated as just two random trendlines. The script requires a confirmed pivot structure, a meaningful initial width, a narrowing final width, and the correct slope relationship for either a rising wedge or a falling wedge. Once a qualified structure is active, it draws the converging boundaries directly on the chart and waits for a reversal-side break.
The detector also includes two visual preparation layers. The developing-wedge preview layer can draw dashed boundaries before the structure is fully armed. The Wedge Radar layer keeps the latest compression window visible when no confirmed candidate is active. Radar projection is capped so higher-timeframe charts stay clean, and low-compression radar states can remain boundary-only until the structure becomes visually meaningful. Break labels, reaction zones, and invalidation guides remain reserved for stricter confirmed candidates. This keeps the chart visually informative without weakening the actual confirmation logic.
The visual layer includes compact boundary tags that label the upper and lower rails directly on the right side of the structure. These tags are designed as chart annotations, not signal spam: they identify whether the rail is acting as a rejection rail, compression rail, reclaim rail, break rail, or invalidation rail. A single optional compression tag can also summarize the current radar or wedge state.
🔶 Why This Is Different
Many wedge indicators stop at pattern drawing. Others become broad pattern scanners that mix wedges with channels, double tops, double bottoms, triangles, support and resistance zones, and unrelated reversal signals. Wedge Reversal Detector intentionally stays narrower.
Its edge is the sequence:
1. Detect a qualified rising or falling wedge from confirmed pivots.
2. Measure whether the boundaries are genuinely converging.
3. Grade wedge maturity before any break occurs.
4. Confirm the reversal-side break with an optional close-based rule and ATR buffer.
5. Score break quality using maturity, boundary expansion, candle structure, close location, and volume participation.
6. Project a concept-native reaction zone from the wedge width.
7. Display a clean invalidation guide so the structure remains readable after the break.
This makes the script a wedge lifecycle tool, not a general reversal scanner.
💎 Unique Edge
The most important difference is that the script treats a wedge as a living geometric compression structure. It does not simply connect the latest two highs and lows and call the pattern complete. A candidate must pass span, width, convergence, and slope requirements before it becomes active.
For rising wedges, the script looks for rising pivot highs and rising pivot lows where the lower boundary is climbing faster than the upper boundary. This creates upward compression, which is the core geometry behind a rising wedge. For falling wedges, it looks for falling pivot highs and falling pivot lows where the upper boundary is falling faster than the lower boundary. This creates downward compression, which is the core geometry behind a falling wedge.
That difference matters because many weak wedge tools confuse ordinary channels with wedge compression. This script separates those structures by requiring the final width to be materially smaller than the starting width.
🔹 Methodology
The engine begins with confirmed pivot highs and pivot lows. The user controls the pivot confirmation length, which allows the detector to be tuned for intraday, swing, or higher-timeframe charts.
From the latest confirmed swing pair, the script builds two boundary lines:
- Upper boundary from confirmed pivot highs
- Lower boundary from confirmed pivot lows
The detector then evaluates:
- Pattern span in bars
- Initial boundary width measured against ATR
- Final boundary width relative to the starting width
- Upper boundary slope
- Lower boundary slope
- Correct rising-wedge or falling-wedge geometry
Only when those requirements align does the pattern become an active wedge.
🔸 Break Quality Model
A wedge break is scored only after the reversal-side boundary is broken. The break quality score is built from multiple factors:
- Wedge maturity
- Distance beyond the broken boundary
- Candle body participation
- Close location inside the break candle
- Volume ratio versus recent average volume
The score is translated into a simple grade so the chart stays easy to read. This does not claim that a break must continue. It gives the user a structured read of how strong the confirmed break appears under the script's own rules.
🎯 Projected Reaction Zone
After a confirmed wedge reversal break, the script projects a reaction zone using the initial wedge width. This zone is not a generic support/resistance box. It is tied directly to the wedge geometry and appears only after the structure confirms. The goal is to show the next area where price may naturally react after escaping the compression.
The zone width and projection length are configurable, so users can keep the chart compact or allow more forward context depending on timeframe and style.
🧭 Invalidation Context
The script also draws an invalidation guide after a confirmed break. For a bullish falling-wedge break, invalidation is tracked below the opposite wedge boundary with an ATR buffer. For a bearish rising-wedge break, invalidation is tracked above the opposite wedge boundary with an ATR buffer.
This keeps the post-break structure organized without adding trade instructions or turning the script into a strategy.
📊 Panel
The compact AGPro panel summarizes the current wedge lifecycle:
- Wedge Type
- Maturity
- Break Quality
- Target Zone
Panel location, panel theme, and panel font size are adjustable from settings. The first panel row uses the AGPro standard: one merged blue header row containing only the panel title.
⚙️ Key Settings
- Pivot Confirmation Length controls how strict the swing structure is.
- Minimum Wedge Span filters out tiny patterns.
- Maximum Final Width Ratio controls how much convergence is required.
- Developing Wedge Preview Ratio controls how early dashed formation boundaries can appear.
- Wedge Radar controls the latest-window visual radar that prevents panel-only charts while waiting for confirmed wedge geometry.
- Radar Projection Bars limits how far radar boundaries extend into future bars.
- Radar Fill Threshold keeps low-compression radar structures from creating oversized filled areas.
- Boundary Tags add compact right-side rail annotations so the structure is easier to read without covering candles.
- Compression Tag shows one status label for radar compression or armed-wedge maturity.
- Boundary Break Buffer ATR adds confirmation distance beyond the wedge boundary.
- Volume Confirmation Ratio contributes to break quality scoring.
- Projection Length Bars controls how long the reaction zone extends forward.
- Label Font Size and Label Offset ATR help maintain a clean chart presentation.
🧩 How It Differs From Other AGPro Tools
This script is intentionally separate from AGPro channel, breakout, liquidity, and broad reversal tools.
It is not a channel map. Channel tools organize parallel or multi-family structure. Wedge Reversal Detector only studies converging wedge geometry.
It is not a double top or double bottom detector. Those patterns are based on repeated horizontal rejection and neckline behavior. This script is based on converging diagonal boundaries.
It is not a broad reversal scanner. It does not combine every reversal pattern into one dashboard. It stays focused on wedge compression, wedge maturity, reversal break, projected reaction zone, and invalidation.
It is not a generic breakout quality tool. Break quality is evaluated only after a valid rising or falling wedge exists.
🔔 Alerts
The script includes alerts for:
- Bullish falling wedge break
- Bearish rising wedge break
- High quality wedge break
- Wedge invalidation
These alerts are event notifications for the detected structure, not automated trading instructions.
✨ Best Use Case
Wedge Reversal Detector is best suited for traders who already watch chart patterns, market structure, compression, and failed trend continuation. It helps reduce manual drawing by highlighting qualified wedge structures, then keeping the chart organized through the confirmation, projection, and invalidation phases.
The result is a clean, premium, wedge-specific workflow designed for public chart reading: fewer random lines, fewer noisy labels, and a clearer view of whether the wedge structure is still forming, breaking, projecting, or invalidating.
Pine Script®指标






















