# Bull/bear Flag

Bull/bear Flag is an indicator on [Vela](https://vela.luxalgo.com/chart), our next-generation charting platform, written in Pine Script®.

Bull/bear Flag detects textbook flags: an impulse pole at least 3 ATR tall printed with 60% strong closes, a 4-15 bar counter-drift channel fitted by least squares, and a decisive close out in the pole's direction. Poles, channels, measured targets, and breakout, target, and failure markers plot automatically for continuation traders on any timeframe.

- Indicator in the LuxAlgo Library, by LuxAlgo, published Jun 14, 2026.
- Access: free.
- Concepts: [Bull/bear Flag](https://www.luxalgo.com/library/concept/bull-bear-flag/) (primary)
- Open on Vela: https://vela.luxalgo.com/chart?pineScriptCodeId=wbzlwrf0rq4lb0rltdip9ibz
- Page: https://www.luxalgo.com/library/indicator/bull-bear-flag/

**Bull/bear Flag** detects flags from measured rules rather than trendline eyeballing: a near-vertical pole built from strong closes, a brief counter-drift channel fitted to the pause by least squares, and a decisive close out of the channel in the pole's direction. It is the definitive clean build of the [bull and bear flag](https://www.luxalgo.com/library/concept/bull-bear-flag/) pattern: pole height, flag depth, tilt, and bar-range contraction are all enforced before a label prints.

## How to Trade the Bull/bear Flag?

- **Bull Flag / Bear Flag label**: the pause qualified. The pole and parallel channel draw while the pattern is live.
- **Breakout triangle**: the bar closes outside the flag boundary on the pole's side; a dotted line projects the measured target, pole height from the breakout.
- **Diamond**: the measured target was reached.
- **Cross**: a close beyond the far flag edge (the stop side) invalidates the pattern.

Flags are continuation trades: the pause should be passive profit-taking inside an impulse. The same logic anchors much of the [chart pattern family](https://www.luxalgo.com/library/family/patterns/).

## Bull/bear Flag Settings

- **ATR Length** (default 14): the volatility unit for pole height.
- **Maximum Pole Duration** (default 10): longest span from pole origin to tip.
- **Minimum Pole Height (ATR)** (default 3): smallest qualifying impulse.
- **Strong Closes (%)** (default 60): share of pole bars closing in the impulsive half of their range.
- **Flag Duration** (default 4 to 15): fewest and most pause bars.
- **Maximum Flag Depth (% of Pole)** (default 50): deepest retracement allowed.
- **Maximum With-Trend Tilt (% of Pole)** (default 10): a channel drifting steeply with the pole is rejected.
- **Require Bar-Range Contraction** (default on): flag bars must average smaller ranges than pole bars.
- **Volume Filter** (default off): the classical contraction-then-expansion signature; bypassed without volume data.
- Style toggles (**Show Pole**, **Channel Fill**, **Pattern Labels**, **Show Measured Target**, **Event Markers**, all default on).

## Frequently Asked Questions

### What separates a flag from a pennant?
The shape of the pause. A flag drifts inside two parallel boundaries; a [pennant](https://www.luxalgo.com/library/indicator/pennant/) contracts into a small converging triangle. Both follow the same impulsive pole and share the measure rule.

### Why did a drawn flag disappear?
The candidate degraded (too long, too deep, or tilted with the trend) and was deleted rather than left posing as a pattern. That deletion is the qualification working.

### Is the measured target a prediction?
No. It is the classical first objective, the pole's height projected from the breakout. Treat it as a planning device for partials or risk-reward math rather than an exit promise.

## Related indicators

- [Channel Continuation](https://www.luxalgo.com/library/indicator/channel-continuation/) (Chart & Candlestick Patterns): markdown at https://www.luxalgo.com/library/indicator/channel-continuation.md
- [Rectangle](https://www.luxalgo.com/library/indicator/rectangle/) (Chart & Candlestick Patterns): markdown at https://www.luxalgo.com/library/indicator/rectangle.md
- [Wolfe Wave Detector](https://www.luxalgo.com/library/indicator/wolfe-wave-detector/) (Rising/falling Wedge): markdown at https://www.luxalgo.com/library/indicator/wolfe-wave-detector.md
- [Pennant](https://www.luxalgo.com/library/indicator/pennant/) (Chart & Candlestick Patterns): markdown at https://www.luxalgo.com/library/indicator/pennant.md
- [Half Cup](https://www.luxalgo.com/library/indicator/half-cup/) (Cup & Handle): markdown at https://www.luxalgo.com/library/indicator/half-cup.md
- [Scallop](https://www.luxalgo.com/library/indicator/scallop/) (Chart & Candlestick Patterns): markdown at https://www.luxalgo.com/library/indicator/scallop.md
- [Measured-move Up/down](https://www.luxalgo.com/library/indicator/measured-move-up-down/) (Chart & Candlestick Patterns): markdown at https://www.luxalgo.com/library/indicator/measured-move-up-down.md
- [Gap Fill Breakouts](https://www.luxalgo.com/library/indicator/gap-fill-breakouts/) (Chart & Candlestick Patterns): markdown at https://www.luxalgo.com/library/indicator/gap-fill-breakouts.md

---

Source: https://www.luxalgo.com/library/indicator/bull-bear-flag/ (LuxAlgo Library). Free to use with attribution: https://www.luxalgo.com/library/license/
