VALYNOXSTRATEGY RESEARCH TECHNOLOGY
AlphaPrimeAlphaPrime
ACADEMY / Indicators and signals

Bull flag pattern: rules for bull and bear flags you can test

A bull flag is a sharp rise, a short pause that tilts against it, and a breakout above the pause. It only becomes a testable rule once the pole is measured in ATR, the flag in bars and depth, and the breakout as a close beyond a line. Write those thresholds first, then test with costs.

By · Published · updated · Editorial policy

Contents
  1. What is a bull flag pattern and how do you identify one?
  2. What is the difference between a bull flag and a bear flag?
  3. How do you define pole size and flag slope in numbers?
  4. Where do you enter, where does the stop go, and how do you calculate the target?
  5. How do you write flag rules a backtest can run?
  6. How often do bull flags fail, and what does a test with costs show?
  7. Frequently asked questions
  8. References

What is a bull flag pattern and how do you identify one?

A bull flag pattern is a sharp rise (the pole), a short pause that tilts down against it (the flag), and a breakout above the flag. To identify one for a test, write each part as a number: pole height in ATR, flag length in bars, flag depth as a share of the pole, and the breakout as a close above the flag line.

The three parts have plain names. The pole is a run of bars that moves price a long way in one direction in a short time. The flag is the pause that follows: a few bars that drift slowly against the pole, between two roughly parallel lines. The breakout is the bar whose close moves beyond the upper flag line in the direction of the pole. Think of a sprinter who runs hard for a hundred metres, walks a few steps to catch breath, then runs again. The pattern says nothing until the second run starts; the flag alone is just a pause.

The claim this article defends is simple: the picture is not the rule. Two traders looking at the same chart will draw different flags, because "sharp", "short" and "tilts" are opinions. A backtest cannot run on opinions. It needs thresholds, and once you write the thresholds down you find that most arguments about whether flags work are really arguments about which thresholds were used. The guide to technical analysis tools and indicators you can actually test sorts chart ideas by this same question: can it be written as a number?

The three parts of a bull flag: a steep rise called the pole, a short downward channel called the flag with its high and low marked, and a breakout bar that closes above the upper flag line, which completes the pattern A flag has three parts Complete only at the breakout close Flag high Flag low Pole Flag Breakout Before the close, it is a candidate. So: count it only at the close.
The three parts of a bull flag. The pattern is only complete at the breakout close; before that it is a candidate.

What is the difference between a bull flag and a bear flag?

A bear flag pattern is a bull flag turned upside down: a sharp fall, a short pause that drifts up, and a breakout below the lower flag line. Every part keeps its job and reverses its direction, so the rule is the same list of checks with the signs flipped and the orders placed on the other side.

Both are continuation patterns, which means they expect the move before the pause to carry on after it. That separates them from reversal patterns such as the hammer, where a single bar is read as a turn; the test design for a single-bar reversal is covered in how to test the hammer candlestick against the hanging man. The table lists what flips between the two flags.

PartBull flagBear flag
Pole directionSharp riseSharp fall
Flag tiltDrifts down (lower highs, lower lows)Drifts up (higher highs, higher lows)
BreakoutClose above the upper flag lineClose below the lower flag line
Entry orderBuy on the next barSell short on the next bar
StopBelow the flag lowAbove the flag high
TargetEntry plus pole heightEntry minus pole height
Bull flag and bear flag side by side: the bull flag rises, pauses downward and breaks out up with the stop below and the target above; the bear flag is the mirror image with the stop above and the target below A bear flag is a mirror Same checks, opposite signs Target Stop Target Stop Bull flag Bear flag Every part flips its direction. So: test each side on its own.
Bull flag and bear flag side by side. Same checks, opposite signs, orders on the other side.

One practical point: test the two sides as separate strategies, not as one combined result. Index futures tend to fall faster than they rise, so the same thresholds can produce many more bear-flag poles than bull-flag poles in the same history, and the flags that follow them behave differently. A combined number hides which side did the work.

How do you define pole size and flag slope in numbers?

Measure the pole as a multiple of ATR over a fixed bar count, and measure the flag by three numbers: its length in bars, its depth as a share of the pole, and the direction of its slope. With those four thresholds written down, two traders reading the same chart get the same flags, and a program gets the same flags as both of them.

ATR (average true range) is the average distance price travels in one bar, including any gap from the previous close, over a chosen number of bars. It is the market's normal step size. A 100-point rise is a pole on a market whose ATR is 25 points and ordinary noise on a market whose ATR is 150 points, so measuring the pole in ATR makes the rule portable across markets and years. The ATR indicator page covers the calculation; the point here is how to use it as a yardstick. The idea of defining a chart pattern as a sequence of measurable highs and lows that a computer can search for goes back at least to Lo, Mamaysky and Wang (2000), and the yardstick itself to Wilder (1978).

MeasureExample thresholdWhat it rules out
Pole heightAt least 3 ATR gained within 10 bars or fewerSlow drifts that are not a sprint
Flag length4 to 12 barsOne-bar pauses and long sideways ranges
Flag depthNo more than 50 percent of the pole heightPullbacks that give back the pole
Flag slopeAgainst the pole, or flat; never with itA second leg up mistaken for a pause

The flag line used for the breakout is the line through the flag's highs for a bull flag (the lows for a bear flag). The simplest testable version is a straight line through the first flag high and the most recent flag high, extended one bar forward; a stricter version requires at least two touches of that line before a breakout counts.

Hypothetical example

An index future with a 14-bar ATR of 25 points rises from 5,000 to 5,100 in 8 bars. The pole is 100 points, which is 4 ATR in 8 bars, so it passes a "3 ATR within 10 bars" threshold. Over the next 6 bars price drifts down to a low of 5,060. The flag depth is 40 points, which is 40 percent of the pole, inside a 50 percent limit. The flag highs step lower each bar, so the slope is against the pole. All four checks pass; the pattern is now waiting for a breakout.

Four measurements turn a bull flag into a rule: pole height of at least 3 ATR within 10 bars, flag length of 4 to 12 bars, flag depth of no more than half the pole, and a flag slope that runs against the pole Four measurements, one rule Example thresholds, bull flag Pole height ≥3 ATR, ≤10 bars Flag length 4 to 12 bars Flag depth ≤50% of the pole Flag slope Against the pole
Four measurements turn the picture into a rule. Change any one of them and you change which flags the backtest finds.

Each threshold is a parameter, and parameters need the same plateau check as any other setting: a pole limit of 3 ATR should find roughly the same flags, with roughly the same result, as 2.5 or 3.5 ATR. If 3 ATR is good and both neighbours are poor, the number is describing the history, not the pattern.

Where do you enter, where does the stop go, and how do you calculate the target?

Enter on the bar after a close beyond the flag line, put the stop just beyond the far side of the flag, and set the target by adding the pole height to the entry price (subtracting it for a bear flag). This target is called the measured move, and because the stop and target are both known before the fill, the reward-to-risk ratio is known before the trade.

The measured move is the assumption that the second run will be about as long as the first. Whether that assumption holds on your market is what the backtest will tell you; the rule itself only needs to be fixed in advance. The reward-to-risk ratio is the distance from entry to target divided by the distance from entry to stop. The only formula you need for this:

target = entry + pole height (bull flag), where entry is the price you expect to be filled at on the bar after the breakout close and pole height is the distance from the start of the pole to its high. For a bear flag the plus becomes a minus.

Hypothetical example

Continuing the flag above: the upper flag line sits at 5,090 on the breakout bar, and that bar closes at 5,094. The order goes in on the next bar and fills at 5,092. The stop is placed 5 points under the flag low of 5,060, at 5,055, so the risk is 37 points. The target is 5,092 + 100 = 5,192, so the reward is 100 points. The reward-to-risk ratio is 100 ÷ 37, about 2.7 to 1. A rule could require at least 2 to 1 and skip flags whose stop is too far away.

The measured move with hypothetical prices: a 100-point pole is copied again from the entry to a target 100 points higher, with the stop 37 points below the entry under the flag low, giving about 2.7 to 1 reward to risk The measured move Points from entry, hypothetical 100 100 Target +100 Entry Stop −37 Risk 37, reward 100: about 2.7 to 1. So: know both before the fill.
The measured move: the pole height is copied once more from the entry. Stop and target are known before the fill, so the reward-to-risk ratio is too.

Two practical details. First, the stop distance changes from flag to flag, so the number of contracts should change with it; the free position size calculator for a fixed account risk turns a stop distance in points into a contract count. Second, points become money through the contract's point value, which the exchange's contract page lists and exchanges can change; the futures contract calculator for tick and point values does that conversion for the common contracts. A flag breakout is also a channel breakout with extra conditions attached, which is why the Donchian channel breakout rule and its settings makes a natural stand-in to compare against: it buys new highs without asking for a pole or a flag first.

How do you write flag rules a backtest can run?

A testable flag rule is an ordered list of conditions checked on every bar, from pole detection to flag end to breakout, with every threshold written down before the first run. The program moves through the list like a checklist on a clipboard: it cannot look at step 4 until steps 1 to 3 have passed, and a failed step sends it back to the start.

  1. Pole found. Over the last N bars (for example 10), the close has gained at least X ATR (for example 3). Record the pole start, the pole high and the pole height.
  2. Flag forming. Each later bar stays below the pole high, and the flag highs do not rise above a line drawn through the earlier flag highs. Count the flag bars.
  3. Flag depth within the limit. The lowest low since the pole high is no deeper than a set share of the pole (for example 50 percent). If it goes deeper, the candidate is cancelled and the search for a new pole restarts.
  4. Breakout. A bar closes above the flag line while the flag bar count is between the minimum and maximum (for example 4 to 12). If the maximum is reached without a breakout, the candidate expires.
  5. Order on the next bar. Buy at the open of the next bar, with the stop under the flag low and the target at entry plus pole height. Commission and slippage are charged on both the entry and the exit.
The five checks of a testable flag rule in order: pole found, flag forming, depth within the limit, breakout close, and an order on the next bar; a flag that retraces too deep at the depth check is cancelled Check in order, every bar A failed check restarts the search Pole Flag Depth Close Order Too deep: cancelled Each check waits for the one before. So: write all five before the run.
The order of checks. A candidate that fails the depth check is dropped, and the search begins again from the next pole.

Three rules keep the test honest. Only one candidate is alive at a time per direction, so overlapping flags do not stack orders. Every check uses data up to the current bar's close and nothing after it, which is the same one-bar discipline that any pattern test needs; the same structure, written for a different shape, appears in exact double bottom rules and how to test them. And the thresholds are ranges to be searched, not single values to be defended: a pole of 2 to 4 ATR, a flag of 3 to 15 bars, a depth limit of 30 to 60 percent, each stepped through, with the plateau check from the previous section applied to the result.

How often do bull flags fail, and what does a test with costs show?

Flags fail for three measurable reasons: the pole was too small to count as a sprint, the flag gave back too much of it, or commission and slippage ate the measured move. There is no reliable universal failure rate to quote, because the rate depends on the thresholds, the market and the bar size; the honest answer is a count on your own data, after costs, compared with a simple stand-in rule on the same bars.

Failure causeWhat you see in the trade listThreshold that catches it
Pole too smallBreakout runs a few bars, then the stop is hitRaise the minimum pole size in ATR
Flag too deepPrice breaks out, then falls through the flag lowLower the depth limit as a share of the pole
Flag too longBreakout from a range that stopped being a pauseLower the maximum flag length in bars
Costs too large for the moveWinners and losers both shrink; the average trade turns negativeRequire a minimum measured move in ticks relative to round-trip cost

The cost check matters most on small bars. A flag on 1-minute bars may have a measured move of a handful of ticks, and a round trip of commission plus one tick of slippage on each side can take most of it. On daily bars the measured move is usually many times the round trip, so the question becomes whether the breakout carries on at all. Park and Irwin (2007), reviewing decades of studies on technical rules, found that results depend heavily on costs and on how many rules were tried, which is exactly why the comparison below is against a stand-in and after costs.

The box below is not a flag test. It is a run on ES daily bars from 2019-01-02 to 2025-06-30, long and short with one contract, using a Reflex rule as its only entry and exit, with no stop, no target and no filters: a stand-in built from standard indicators, not the bull flag pattern itself. It is the one candidate the search kept out of 1,024 it tried, chosen for its return against its drawdown, and picking the kept one after the fact flatters it. It is here to show what a plain rule on the same market and bar size looks like once commission and slippage are charged, so that a flag rule has something to be measured against. The box comes from AlphaPrime (Valynox), whose backtesting charged the $20 commission and $25 slippage inside every one of those evaluations and filled on the bar after the signal, which is the same way the five-step flag rule above should be run.

Source: AlphaPrime product engine (CPU), run 2026-10-31. ES daily bars, 2019-01-02 to 2025-06-30, long and short, 1 contract, $20 commission and $25 slippage per trade.

NumberResult
Net profit (closed trades)$19,262.5
Max drawdown$16,735
Trades30
Win rate60%
Profit factor1.559
Average trade$642.08
Time in market5.79%
Five steps to test a flag rule: write the rules as numbers, pick one market and bar size, add costs and next-bar fills, tune on older data and test unchanged on newer data, then check the average trade against cost and read the drawdown From rule to result in five steps Step 4 keeps new data untouched 1 2 3 4 5 Write the rules as numbers Pick one market, one bar size Add costs and next-bar fills Tune on old data, test on new Check cost and drawdown
Look at the long flat stretches between trades, where the rule held no position, and at how deep the drawdown runs compared with the climb before it; the out-of-sample stretch is marked. ES · daily · 2019-01-02 to 2025-06-30 · CPU engine backtest

Read the box as a reference point, not as a result the Reflex rule earned or that a reader can expect. Thirty trades over six and a half years is too few to trust a per-trade figure, and the max drawdown of $16,735 against a net profit of $19,262.5 says the kept candidate spent much of its gain on one bad stretch. Bailey, Borwein, López de Prado and Zhu (2014) show why the best of many tries is inflated: with 1,024 candidates compared on one history, the winner carries a selection bonus that new data will not pay. A flag rule gets the same treatment. If your flag thresholds produce, say, 25 trades on daily bars, the comparison tells you little either way; moving to hourly bars, or to a basket of markets, raises the count to something that can be judged.

Here is a concrete next step. Take your own daily or hourly bars for one market, write the four thresholds and the five checks on paper, and run the flag rule and a Donchian breakout rule on the same data with the same commission and slippage. Count the completed trades on each, compare the average trade after costs, and then rerun the flag rule with each threshold moved one step in each direction. If the result holds across the neighbours and across both halves of the history, the pattern has earned a place in the next round of validation.

Frequently asked questions

How do you identify a bull flag pattern on a chart?

Look for three things in order: a steep rise over a short number of bars (the pole), a few bars that drift slowly down between two roughly parallel lines (the flag), and a bar that closes above the upper flag line (the breakout). To make the identification repeatable, measure the pole in ATR, the flag in bars and as a share of the pole, and require the breakout to be a close, not a wick.

What is the difference between a bull flag and a bear flag?

A bear flag is a bull flag mirrored. The pole falls instead of rises, the flag drifts up instead of down, and the breakout is a close below the lower flag line. The entry becomes a short sale, the stop goes above the flag high and the target is the entry minus the pole height. Test the two as separate strategies, because index futures fall and rise in different ways.

How do you calculate a bull flag target price?

Add the pole height to your entry price. The pole height is the distance from where the sharp rise began to where it ended. If the pole was 100 points, the target sits 100 points above your fill price. This is called the measured move, and because the stop sits under the flag low, the reward-to-risk ratio is known before the trade is placed.

How often do bull flags fail?

There is no single failure rate that applies everywhere, because the answer changes with the thresholds you use, the market and the bar size. The useful number is your own: run the rule with commission and slippage on your data and count how many breakouts reach the target before the stop. Flags fail most often when the pole is small, when the flag gives back more than about half of the pole, or when the measured move is only a few ticks larger than the round-trip cost.

What is the difference between a flag and a pennant?

Both follow a pole and both are continuation patterns. In a flag the pause runs between two roughly parallel lines that tilt against the pole; in a pennant the two lines converge, so the pause narrows toward a point. For a backtest the pennant needs one extra measurement, the rate at which the range narrows, while the pole, depth and breakout rules stay the same.

References

  • Lo, A. W., Mamaysky, H., & Wang, J. (2000). Foundations of Technical Analysis: Computational Algorithms, Statistical Inference, and Empirical Implementation. The Journal of Finance, 55(4), 1705–1765.
  • Wilder, J. W. (1978). New Concepts in Technical Trading Systems. Trend Research.
  • Park, C.-H., & Irwin, S. H. (2007). What Do We Know About the Profitability of Technical Analysis? Journal of Economic Surveys, 21(4), 786–826.
  • Bailey, D. H., Borwein, J., López de Prado, M., & Zhu, Q. J. (2014). Pseudo-Mathematics and Financial Charlatanism: The Effects of Backtest Overfitting on Out-of-Sample Performance. Notices of the American Mathematical Society, 61(5), 458–471.