Blog / Strategy
Strategy

Flag Pole Projection

Disclaimer: This article is for educational and informational purposes only. It does not constitute financial or investment advice. Trading forex and CFDs carries significant risk of loss. Past performance of any strategy — including backtests — does not guarantee future results. Never trade with money you cannot afford to lose.

What Is This Strategy?

Flag Pole Projection is a pure price-action, trend-continuation strategy built around one of the most recognizable formations in technical analysis: the bull flag and bear flag. A flag pattern is a brief, tight consolidation that forms after a sharp directional move, and traders have studied it for decades as a sign that an existing trend may resume rather than reverse. What makes this Expert Advisor (EA) distinctive is that it uses no indicators at all — no moving averages, no RSI, no ATR, no channels. Every decision is made from raw candle geometry: the size, direction, and shape of recent bars.

The strategy is designed for trending instruments such as gold (XAU/USD) or GBP/USD on intraday timeframes like M15 and H1, though it will technically run on any liquid symbol. Its trading style is best described as a measured-move continuation breakout — it waits for a powerful impulse (the "pole"), then a shallow pause (the "flag"), and only acts when live price actually breaks out of that pause in the same direction as the original thrust.

As a learning tool, Flag Pole Projection is well suited to traders who want to understand how classic chart patterns can be expressed in objective, rule-based code. Because it relies entirely on geometry rather than lagging indicators, it is a clear example of how to translate a discretionary visual concept — "a flag on a chart" — into precise, testable conditions. This article frames the EA as a strategy analysis for study, not as a profit opportunity.

How It Works

The strategy re-evaluates the chart once per newly-closed bar and looks for a two-part structure: an impulsive pole followed by a tight flag. It only acts when a position is not already open and the live spread is within an acceptable limit.

flag pole breakout MT5 EA
Illustrative example of the strategy’s entry and exit logic — not real trading results.

Strategy Parameters

Parameter Default Min Max Description
PoleBars 5 3 12 Number of candles that form the impulsive pole.
PoleFactor 2.00 1.20 5.00 Pole's net move must be at least this multiple of the pre-pole average bar range.
PoleDominance 0.55 0.30 0.90 Fraction of the pole's high-low range that its net directional travel must cover (filters chop).
FlagBars 4 2 10 Number of candles that form the consolidation flag.
FlagMaxFrac 0.50 0.20 1.00 Flag range and give-back from the pole extreme must each stay within this fraction of pole height.
BaselineLookback 20 10 50 Quiet stretch of bars before the pole used to calculate the average-range baseline.
TargetFrac 1.00 0.30 2.00 Measured-move target as a multiple of pole height, projected from entry.
BufferFrac 0.10 0.00 0.50 Breakout and stop buffer expressed as a fraction of the flag range.
MaxSpreadPoints 30 1 200 Skip the trade if the live spread (in points) is wider than this.
Lots 0.10 0.01 1.00 Order volume (fixed lot size).
Magic 7411 0 9,999,999 Magic number used to identify and manage this EA's trades.
flag pole breakout MT5 EA — MQL5 source code

Recommended Chart Settings

Flag Pole Projection was designed with trending instruments in mind — particularly XAU/USD (gold) and GBP/USD — on the M15 or H1 timeframe. These markets tend to produce the clean, impulsive thrusts followed by tight pauses that the strategy is built to detect. That said, the EA will run on any liquid symbol and whatever single primary timeframe you select at backtest time.

Keep in mind that pattern behavior, volatility, and spread characteristics differ from one symbol and session to another. Results will vary considerably across different market conditions, and a setting that looks reasonable on one instrument may behave very differently on another. Always test on the exact symbol and timeframe you intend to study before drawing any conclusions.

How to Install on MetaTrader 5

What to Consider Before Using This EA

The main strength of this approach is its clarity and objectivity. By translating the well-known flag pattern into measurable geometric rules, the strategy removes much of the subjectivity that plagues discretionary pattern trading. The "fresh break" filter is a thoughtful touch — it prevents the EA from entering long after a move has already played out, which historically is one of the most common ways breakout traders give back gains. The structural stop and measured-move target also give every trade a defined, logical risk-to-reward framework.

There are real limitations to be aware of, however. Flag patterns are a trend-continuation concept, so the strategy is at its most vulnerable in choppy, sideways, or range-bound markets where impulsive poles fail to follow through. Breakouts can be prone to false breaks — price pokes past the flag, triggers an entry, then reverses. Because entries are taken at the live Ask or Bid, the strategy also pays the spread on every breakout, which is why the spread gate matters and why high-spread symbols or volatile news periods can erode the edge. Finally, the measured-move target assumes the pole's height projects forward cleanly; in practice, price may stall well short of, or run far beyond, that level. This EA is best understood as a structured way to study flag breakouts, not as a complete or guaranteed system.

Risk Management Tips

Sound risk management matters far more than any single entry rule. Consider these general principles as you study the strategy:

Risk Warning

Trading foreign exchange, CFDs, and other leveraged financial instruments involves substantial risk of loss and is not suitable for all investors. The strategies and tools discussed on this page are provided for educational purposes only and do not constitute financial advice, investment recommendations, or solicitation to trade. Always consult a qualified financial adviser before making trading decisions. Past backtest performance is not indicative of future results.

Downloads

← Back to Blog