Measure convergence at the same bars
On a linear price scale, write the upper boundary as U(t) = aU + mU × t and the lower boundary as L(t) = aL + mL × t, where t counts bars. Width is W(t) = U(t) - L(t). A rising wedge requires mL > mU > 0 and positive width throughout the formation. Its width decreases by mL - mU price units per bar.
- Higher highs and higher lows are insufficient. A rising parallel channel has both, but no convergence.
- Compare U and L at the same start and end bars. Subtracting a swing low from a swing high on a different bar mixes width with movement along the slope.
- Near-equal slopes need a minimum contraction rule to distinguish a narrow wedge from measurement noise. The numerical threshold below is an example choice.
- Straight lines fitted to logarithmic prices describe different slopes. Keep the price scale and calculation method consistent rather than judging angles from chart pixels.
| Structure | Slope condition | Width |
|---|
| Rising wedge | mL > mU > 0 | Shrinks while both boundaries rise |
| Ascending parallel channel | mL = mU > 0 | Stays constant |
| Ascending broadening wedge | mU > mL > 0 | Expands |
| Ascending triangle | mU = 0 and mL > 0 | Shrinks beneath a flat upper boundary |
Define which swings qualify before looking at the outcome
The following hypothetical specification makes the geometry reproducible. It is a custom detector design, not a reconstruction of TradingView Auto Chart Patterns and not a set of recommended trading parameters. Use ordinary price candles and evaluate a new candidate only when no earlier candidate is active.
- Freeze the selected points and line equations when the candidate qualifies. Continue projecting those same lines; do not refit them to absorb a break.
- The fixed 0.25 tolerance has different significance on a $5 instrument and a $500 instrument. A tick-based or volatility-based allowance is a different specification that needs testing.
- For this example, a break requires two consecutive eligible closes below L(t) - 0.25 or above U(t) + 0.25. Evaluate each close against its own bar boundary. A close back inside resets the count for that direction.
| Decision | Illustrative rule | Purpose |
|---|
| Pivot timing | An extreme has three bars on each side with strictly lower highs or strictly higher lows; reject ties | A point becomes usable three bars after its own bar |
| Selection | Use the latest six confirmed alternating pivots: three highs and three lows; consecutive points are at least four bars apart | Prevent choosing convenient anchors after the result |
| Lines and touches | Join the first two highs and first two lows; each third pivot must be within 0.25 price units of its line | Test each boundary with a separate touch |
| Contraction | Require W(end) / W(start) ≤ 0.50, with positive width and mL > mU > 0 | Demand at least a halving of width between the first and last selected pivots |
| Containment | From the first pivot through candidate confirmation, every close stays between L(t) - 0.25 and U(t) + 0.25 | Reject candidates whose closing break already happened |
| Expiry | After candidate confirmation, allow at most 12 completed bars, counting that bar; stop before W(t) becomes zero or negative | Avoid extending crossed boundaries into a new pattern |
Work through a narrowing range
Assume six hypothetical pivots pass the selection and containment rules. Highs at bars 10, 20 and 30 are 112, 114 and 116. Lows at bars 15, 25 and 35 are 106, 110 and 114. The resulting boundaries are U(t) = 110 + 0.2t and L(t) = 100 + 0.4t. The lower slope is twice the upper slope.
- The contraction ratio is 3 / 8 = 0.375, so the example passes the chosen maximum ratio of 0.50.
- Bar 35 cannot establish the final low at that moment. Bars 36 through 38 must finish before the three-right-bar pivot can qualify.
- The active window runs from bar 38 through bar 49. Bar 50 is excluded both by the 12-bar limit and by the zero-width boundary.
- All prices and event paths here are illustrative. They are not a historical chart, a backtest or a measured success rate.
| Bar | Upper boundary U(t) | Lower boundary L(t) | Width W(t) |
|---|
| 10: formation start | 112.00 | 104.00 | 8.00 |
| 35: final selected pivot | 117.00 | 114.00 | 3.00 |
| 38: final pivot confirmed | 117.60 | 115.20 | 2.40 |
| 40: possible break bar | 118.00 | 116.00 | 2.00 |
| 50: projected intersection | 120.00 | 120.00 | 0.00; no valid wedge width |
Keep downside confirmation and upside continuation separate
These are alternative paths from the same candidate, assuming no earlier qualifying break. The two-close rule confirms a direction at the second close. An upside event cancels the bearish candidate; it does not automatically authorize a long trade. After a confirmed downside event, this example records an early failure warning on the first later close above L(t) + 0.25 while width remains positive.
- A rising lower boundary can move above price even while closing prices rise. A boundary break is a relative-price event, not necessarily a falling close.
- A third close outside illustrates continuation; it does not establish a durable trend. A later reversal remains possible.
- The reclaim warning is a chosen evaluation rule, not the official TradingView Failed status and not a specified stop order. A trade model must define its own stop and exit timing.
| Hypothetical path | Rule result | Interpretation |
|---|
| Bar 40 low 115.50, close 117.00 | Close stays inside the boundaries | A wick below support is not a closing breakdown |
| Bar 40 close 115.50; bar 41 close 116.00 | Both closes are below their thresholds: 115.75 and 116.15 | Downside confirmation at bar 41, despite the second close being higher |
| After that downside confirmation, bar 42 closes at 117.30 | Close exceeds L(42) + 0.25 = 117.05 | Confirmed breakdown followed by a reclaim warning; preserve both events |
| Alternative: bar 40 close 118.50; bar 41 close 119.00; bar 42 close 119.50 | First two closes exceed 118.25 and 118.45; the next remains above U(42) | Upside break followed by continuation in this example; bearish interpretation fails |
| No two consecutive qualifying closes by bar 49 | Window expires | Unconfirmed candidate, not a losing trade |
What the TradingView drawing can and cannot tell you
TradingView documents 5/5 pivots for its Rising Wedge detector and uses closing prices for breakout recognition. Its In Progress mode may include final points that are not yet pivots. Its Pattern Breakout alert registers only the target direction; an opposite-direction break does not trigger that alert. An upward break is among its failure conditions. Those settings differ from the custom three-bar pivots and two-close rule above.
- Log the pivot bar, the bar when it became confirmed and the break-confirmation bar separately. A line drawn back onto an earlier swing is not evidence that the swing was known then.
- Completed bars settle the changing prices of that candle. They do not eliminate every source of repainting, such as revised data or changes in the loaded history.
- Keep rejected candidates, expired candidates and failed breaks in the review sample. Examining only the surviving drawings cannot establish detector performance.
Turn the geometry into a testable script specification
Give the AI Coding Agent the pivot definition, point-selection order, slope inequalities, contraction ratio, tolerance, expiry and confirmation rule. Ask for separate candidate, downside, upside and reclaim events. Review the generated Pine Script and its event times before adding trading orders.
- For a strategy experiment, define entry timing, position size, stop, profit exit and maximum holding period. A wedge detector alone is not a complete strategy.
- Expose touch requirements, contraction limits and confirmation windows as supported strategy inputs before comparing them with Strategy Optimizer. Keep a fixed baseline so a parameter change can be traced to changed candidates and trades.
- Use commissions, slippage and a separate evaluation period. Selecting settings because they scored highest on one historical sample does not establish future performance.
- TradingView strategies normally fill a market order on the next available tick, often the following historical bar open. A confirming close is not a promised fill price.