Identify the triangle without choosing a side
For a symmetrical triangle chart pattern, the upper line slopes down and the lower line slopes up. Their slope magnitudes should be comparable under your chosen definition. A flat upper boundary instead describes an ascending triangle; a flat lower boundary describes a descending triangle. Two lines moving in the same direction need a different pattern classification.
- Four anchors can define a candidate; another alternating touch is a stricter optional requirement. Fix the requirement before reviewing outcomes.
- Keep the instrument, timeframe, session and linear or logarithmic price convention fixed. The equations below use linear prices and bar indices.
| Feature | Rule to specify | Common mistake |
|---|
| Touches | At least two separate swing highs and two separate swing lows, alternating in time | Counting several neighboring candles at one swing as independent tests |
| Tolerance | Maximum distance between a selected touch and its boundary, in price units or a declared scale | Changing tolerance after seeing which patterns won |
| Convergence | Upper slope < 0, lower slope > 0, upper line above lower line during the active window | Extending crossed lines and still calling the gap a triangle |
| Symmetry | A stated acceptable ratio of absolute slope magnitudes | Treating the visual angle on a resized chart as a fixed measurement |
Calculate the apex and the last eligible bar
Write the upper boundary as U(t) = aU + mU × t and the lower boundary as L(t) = aL + mL × t. Each slope is the price difference between its two anchors divided by their bar separation. Their intersection is tA = (aL - aU) / (mU - mL). Require distinct anchor bars, mU < 0, mL > 0 and an apex after the final anchor.
- Let t0 be the first anchor bar. Progress toward the apex is p(t) = (t - t0) / (tA - t0). Remaining time is tA - t bars. These are time measurements, not probabilities.
- An illustrative expiry rule accepts a breakout only while p(t) ≤ 0.90 and U(t) > L(t). The 90% limit is a chosen test parameter, not an established best threshold.
- Freeze the anchor coordinates once a candidate becomes eligible. Evaluate their projected line values on each new bar, without moving the original anchors to rescue a failed setup.
Compare four paths from the same hypothetical triangle
Suppose the selected highs are 108 at bar 10 and 104 at bar 30, with lows of 94 at bar 20 and 98 at bar 40. They give U(t) = 110 - 0.2t and L(t) = 90 + 0.2t, so the apex is bar 50. Use three completed bars on each side to confirm each swing, reject tied extremes, and assume all selected swings pass. The final low becomes known at the close of bar 43. These numbers are illustrative, not historical prices or optimized settings.
- For this example, allow touch error up to 0.25 price units and an absolute slope ratio from 0.5 to 2. Both fitted lines have exact anchor touches and the ratio is 1.
- Assume every close from bar 10 through bar 43 stays between the lines at its own bar. Reject the candidate if an earlier closing break already occurred before the final swing became known.
- Starting at bar 44, accept the first close above U(t) or below L(t), provided the preceding close was inside its own boundaries and the apex deadline has not passed. Consume the candidate after that event; do not take both directions from it.
- A wick above U(44) followed by a close between 98.80 and 101.20 is not a closing breakout. An exact close on either line also does not pass the strict outside rule.
- For failure tracking, inspect subsequent closes before the apex. A close inside the projected triangle or beyond the opposite boundary ends the breakout hypothesis. This custom rule differs from TradingView Auto Chart Patterns status rules.
- A very late break can result from the boundaries converging around nearly unchanged prices. That is why the deadline belongs in the original specification, rather than being added after a losing trade.
| Alternative path | Calculation | Classification |
|---|
| Bar 44 closes at 101.60 | U(44) = 101.20; apex progress = 85% | Eligible upward breakout |
| Bar 44 closes at 98.40 | L(44) = 98.80; apex progress = 85% | Eligible downward breakout |
| First outside close occurs at bar 47 | Apex progress = 92.5%; the last eligible bar was 46 | Too late for this rule; candidate expired |
| Upward break at 44, then close 45 = 100.70 | L(45) = 99; U(45) = 101; close is back inside | Failed breakout under the return-inside rule |
Turn the volume description into a separate filter
TradingView describes declining volume during continuation-pattern formation and higher volume around a breakout. For triangle pattern trading, that description needs a measurable rule before it can filter signals. Price geometry alone does not establish whether the volume condition passed.
- One illustrative formation check compares average volume over bars 31 through 40 with bars 21 through 30, requiring the later average to be lower. It is evaluated when the candidate is confirmed.
- An optional breakout filter requires current completed-bar volume to exceed 1.5 times the average of the preceding 20 completed bars. Exclude the breakout bar from that baseline and apply the same multiplier in both directions.
- If volume is missing or the baseline is zero, mark this filter unavailable rather than treating it as passed. Record the feed and volume units; do not pool unlike volume series in one test.
- With the filter enabled, reject the candidate if its first outside close fails the volume test. Accepting a later outside close would be a different entry rule. Compare filtered and unfiltered samples without claiming that either must perform better.
Separate swing time from signal time on TradingView
TradingView documents 5/5 pivots and closing-price breakouts for its built-in Triangle detector. Its In Progress mode can include final points that are not confirmed pivots. The manual Triangle Pattern drawing tool instead places four points chosen by the user. Drawing a triangle does not itself implement the custom detection or trading rules on this page.
- A swing at bar 40 requiring three right-side bars becomes usable at bar 43, even if its marker is drawn back at bar 40. The hypothetical detector cannot act on the completed triangle at bar 40.
- Keep the swing bar, confirmation bar and breakout bar in separate fields. A historical drawing can conceal the delay between the first two.
- Closed-bar evaluation avoids acting on a temporary intrabar break. It does not eliminate all repainting causes, including revised source data. Review the generated detector bar by bar before using its alerts.
Test direction bias with matched trade rules
A triangle trading pattern becomes a strategy only after entries, exits, sizing and costs are defined. To compare directions, keep those choices matched. An illustrative experiment uses the first eligible breakout, an entry on the next bar open, and equal risk sizing for longs and shorts. It is a research specification, not a recommendation.
- For both directions, set a stop 1% away from the actual entry fill and a target 2% away, on opposite sides of that fill. Add a time exit after 10 complete bars from entry. These percentages are arbitrary test inputs.
- Use the same commission, slippage assumptions and event-order policy. A bar touching both stop and target needs a declared fill model; its OHLC values alone do not reveal which was touched first.
- Report upward and downward signals, expired candidates, failed breaks and trades separately. Keep the prior-trend label as a comparison field before testing a continuation-only filter.
- Ask Pineify AI Coding Agent to draft the explicit rules, including the candidate deadline and confirmation delay. Check the code and syntax, then compare a small replay sample with the specification.
- Once the strategy runs, expose the selected thresholds as inputs for Strategy Optimizer. Compare parameter ranges on a fixed development sample, then evaluate held-out periods. A ranked historical result is not evidence of future profitability.