An illustrative specification for a bull flag chart pattern
There is no single threshold set implied by the name bull flag. This example uses a deliberately simple fixed-window definition, ordinary price candles and positive prices. Choose a start bar before examining its outcome. Let S be its close, E the close six bars later, and H = E - S. The next six completed bars form the proposed flag. These choices are hypothetical research rules, not recommended settings or the TradingView built-in algorithm.
- Before confirmation, reject at a completed bar if its low is below E - 0.40H or its close is below L(t). Check rejection before breakout on the same bar. If neither occurs by the close of flag bar 10, expire the candidate.
- The first-to-last-high line is a strict custom construction. A visually plausible flag can fail it. Do not move an anchor after seeing a breakout just to admit that example.
- For an automated scan, also specify how start bars are selected and whether overlapping windows are allowed. This worked example classifies one preselected window; it does not define a market-wide scanner.
| Feature | Rule for this example | Meaning |
|---|
| Upward pole | H / S is at least 8%; at least five of the six close-to-close changes are positive | A concentrated advance rather than a small drift |
| Channel slope | Join the highs of flag bars 1 and 6; slope m = (high6 - high1) / 5. Require -0.03 ≤ m / H ≤ 0 | Flat to downward slope, normalized by the pole height |
| Parallel boundaries | U(t) = high1 + m × (t - 1). Reject if any of the six highs exceeds U(t). Set W to the largest U(t) - low(t), and L(t) = U(t) - W | A fixed upper line and parallel lower line enclosing the six bars |
| Width and retracement | Require 0 < W / H ≤ 20% and 0 ≤ (E - lowest flag low) / H ≤ 40% | The pause stays narrow and gives back a limited part of the advance |
| Confirmation window | Evaluate only flag bars 7 through 10; require close > U(t) | The channel is known before the first eligible signal |
Read the formation one bar at a time
This hypothetical bull flag pattern chart is represented as a price table so each observation can be checked. The pole closes at bars 0 through 6 are 100, 102, 104, 103.5, 106, 108 and 110. The gain is 10%, with five positive changes. Thus E = 110 and H = 10. The following rows are the six consolidation bars; t counts from the first bar after the pole.
- At bar 12, m = (108.60 - 109.80) / 5 = -0.24 price units per bar. The normalized slope is -2.4% of the pole per bar. W = 1.20, or 12% of H; the deepest retracement is (110 - 107.40) / 10 = 26%. All pass the stated limits.
- The equations become U(t) = 109.80 - 0.24 × (t - 1) and L(t) = U(t) - 1.20. Their anchors stay fixed, but their prices continue to change with each bar.
- Bar 13 is not a confirmed breakout: 108.20 is below 108.36. Bar 14 is the first eligible closing break. A close exactly on the line would not qualify.
- An alternative bar 14 closing below L(8) = 106.92 would invalidate the candidate. A low below 106 would also invalidate it, even if the close finished above the upper line.
| Chart bar / t | High | Low | Close | Information available |
|---|
| 7 / 1 | 109.80 | 108.80 | 109.20 | First proposed flag bar |
| 8 / 2 | 109.30 | 108.36 | 108.80 | The six-bar window is incomplete |
| 9 / 3 | 109.20 | 108.50 | 108.90 | Still forming |
| 10 / 4 | 109.08 | 108.30 | 108.70 | Still forming |
| 11 / 5 | 108.60 | 107.90 | 108.20 | One more completed bar is needed |
| 12 / 6 | 108.60 | 107.40 | 108.00 | Freeze the channel at this close |
| 13 / 7 | 108.60 | 107.50 | 108.20 | Wick crosses U = 108.36; close does not |
| 14 / 8 | 109.00 | 107.80 | 108.70 | Close exceeds U = 108.12: confirmation |
Compare a flag with a pennant, a pullback and a failed continuation
StockCharts distinguishes flags by their parallel boundaries and pennants by their converging boundaries. Both require a preceding impulse. An ordinary pullback is a broader description: it need not fit either geometry. Keep those classifications separate when reviewing a bullish flag chart pattern.
- For this example, label a continuation failed if any of the next three closes is below the saved breakout-boundary value, 108.12. A close of 107.90 at bar 16 meets that definition. This custom label is neither a protective stop nor the TradingView built-in Failed status.
- Keep the bar 14 confirmation in the record after failure. Deleting losing signals or retaining only completed targets makes historical pattern displays misleading.
- Volume is optional in this numerical example. If adding a breakout-volume filter, define its baseline, multiplier and behavior when volume is missing before comparing results.
| Observed structure | Classification | Decision |
|---|
| Strong advance, short parallel pause | Bull flag candidate | Wait for the defined closing break |
| Strong advance, narrowing triangle | Bullish pennant candidate | Use a convergence rule instead of this parallel channel |
| Decline after an advance, no qualifying channel | Ordinary pullback | Reject from this flag sample without predicting its next move |
| Valid upper break followed by a return below the saved breakout level | Possible failed continuation | Apply the failure horizon chosen before the test |
TradingView drawings and usable signals have different timestamps
TradingView documents 5/5 pivots for its Bullish Flag indicator and uses closing prices to fix breakouts. A five-bar right-side pivot cannot be confirmed on the original swing bar. Its In Progress mode can include final points that are not yet pivots. That mechanism differs from the fixed-window example above.
- Record the swing bar, the bar when its geometry became known, and the breakout bar separately. A drawing anchored in the past does not establish that an alert could have fired there.
- If a custom pivot detector sees a break before all required anchors are confirmed, define whether to reject it or record a provisional event. Do not backdate the trade when later candles confirm the anchors.
- Completed-bar checks avoid acting on an unfinished close. They do not remove every repainting cause; TradingView also documents historical plotting and data revisions.
Test the trading rules after checking the detector
A pole-length projection from the example breakout boundary is 108.12 + 10 = 118.12. It is a geometric reference, not a forecast or a measured probability. Before using it as an exit, define the entry, stop, position size and maximum holding period. A strategy can lose even when its detector follows every rule.
- With default TradingView strategy behavior, an order created at a bar close fills at the next available tick, normally the next historical bar open. The bar 14 closing price of 108.70 is not evidence of an executable fill there.
- Include commission and slippage, preserve gap effects, and keep chart type, session and timeframe fixed. Check the event sequence separately from the profit report.
- Expose pole threshold, channel slope, retracement and expiry as inputs only after their definitions are complete. Compare parameter sets with the same trade and cost model, then examine a separate period. Selecting the best historical result does not demonstrate a durable edge.
- Give the written specification to Pineify to draft the detector or strategy. Request a syntax check and inspect the generated events. Strategy Optimizer can then compare supported strategy input combinations; it cannot decide whether your definition of a flag is economically useful.