OPEN-SOURCE SCRIPT

Rising & Falling Wedge Detector [HexaTrades]

3 798
Overview

Wedge Detector automatically identifies and draws the two most actionable wedge patterns: the Rising Wedge (bearish) and the Falling Wedge (bullish). It marks each as a converging cone, validates the geometry, waits for a bar-close breakout, then plots a measured-move target and a structure-based stop without repainting the pattern structure.

It is built around quality over quantity: a strict, perfect-shape gate ensures only genuinely converging, textbook wedges appear. Every part of the logic is transparent and tunable. Ideal for swing and intraday traders who trade chart patterns and want an objective, rules-based way to spot wedges and define risk.


What it detects

Rising Wedge( bearish)
Higher highs and higher lows, but the lows rise faster than the highs (the lines converge upward). Signals a likely breakdown confirmed on a close below the lower trendline.

Falling Wedge ( bullish)
Lower highs and lower lows, but the highs fall faster than the lows (the lines converge downward). Signals a likely breakout confirmed on a close above the upper trendline.


How the Indicator Works

- Pivots: confirmed swing highs/lows (locked pivotLen bars after they occur).
- Boundaries: upper line from the two most recent swing highs; lower line from the two most recent swing lows, projected as straight lines.
- Slope & convergence: rising = both up, lows rising faster; falling = both down, highs falling faster (set by Convergence strictness).
- Perfect-shape gate: no crossing inside, real narrowing, minimum contraction, apex ahead, sensible duration, minimum ATR height.
- Forming preview: dashed shaded cone while developing.
- Breakout: bar-close below lower line (rising → bearish) / above upper line (falling → bullish).
- Filters: optional EMA trend, volume, breakout-candle ATR size.
- Targets/stops: measured-move target + opposite-boundary stop, drawn as persistent right-extending lines.


Features

- Automatic detection of rising & falling wedges from confirmed pivots.
- Perfect-shape validation rejects crossing, barely-narrowing, diverging, past-apex, too-small or too-long shapes.
- Forming preview dashed shaded cone before breakout.
- Bar-close breakout confirmation, no intrabar fakes.
- Measured-move target + structure stop (opposite boundary).
- EMA trend filter, volume filter, breakout-candle ATR filter (all optional).
- Theme-aware dashboard + shaded wedge zone + 3 alerts.


Dashboard

Status: Forming while developing → Confirmed on breakout
Last wedge: Rising Wedge / Falling Wedge
Bias: Bearish / Bullish
Target: Projected take-profit level
Stop: Structure-based invalidation level
Filters: EMA / Volume / ATR shown as On / Off


Settings

Detection:
Pivot length: swing sensitivity. Lower = more (and smaller) wedges.
Min wedge height (ATR): rejects wedges smaller than this many ATR.
Convergence strictness: how strongly the lines must converge (higher = stricter).
Min width contraction: minimum narrowing from start to breakout.
Max wedge duration: rejects over-stretched patterns.
Show forming wedge: preview wedges before breakout.

Filters:
EMA trend filter: only confirm breakouts aligned with the EMA (falling wedge above EMA, rising wedge below).
Volume confirmation: requires above-average volume on the breakout candle.
Min breakout candle size: require a breakout candle of at least N×ATR.
Visuals
Toggle target/stop lines, colors for bullish/bearish / forming, and the dashboard.

Alerts:
Rising Wedge breakdown:bearish confirmation.
Falling Wedge breakout: bullish confirmation.
Any wedge confirmed - either of the above.
Create alerts with “Once per bar close” for non-repainting behaviour.


Trading Guide

- Identify: dashboard Status = Forming + clean dashed cone.
- Enter: on the bar-close breakout (▲/▼) in the wedge's direction.
- Avoid: when filters reject the breakout, or in choppy ranges.
- Stop: the drawn SL (opposite boundary). Target: the drawn TP (measured move).
- Risk: size so breakout→stop is an acceptable risk; R:R = (TP−entry) ÷ (entry−SL).


Bullish Example (Falling Wedge)
Down-trend forms a dashed falling cone → a candle closes above the upper line → ▲ prints, wedge turns solid green, Status = Confirmed → enter, SL = lower line, TP = breakout + wedge height.
cuplikan


Bearish Example (Rising Wedge)
Up-grind forms a dashed rising cone → a candle closes below the lower line → ▼ prints, wedge turns solid red → enter short, SL = upper line, TP = breakout − wedge height.
cuplikan


Best Markets & Timeframes
Markets: works on crypto, forex, stocks, indices, futures, commodities. Best on liquid instruments with clean swings (the volume filter is most meaningful on stocks/indices).
Timeframes: 5m/15m = more signals, more noise (use stricter filters); 1H/4H = the sweet spot; Daily/Weekly = highest quality, fewer & slower.


We would love to hear your suggestions. If you have ideas for new features, indicators, analytics, or improvements, please share your feedback. Your input helps guide future updates and improve the indicator for all traders.


Wedge pattern detector indicator is for educational and analytical purposes only. It is not financial advice. Trading involves risk. Always use proper risk management and combine this indicator with your own analysis before taking any trade.


Pernyataan Penyangkalan

Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.