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?
The Williams Fractal Trend Breakout is a trend-filtered breakout strategy that combines Bill Williams fractals — a classic swing-point indicator — with a dual exponential moving average (EMA) trend filter to decide when a genuine breakout is worth trading. A fractal marks a confirmed pivot in price: an "up" fractal is a bar whose high sits strictly above the highs of a set number of bars on either side (a confirmed swing high), while a "down" fractal is the mirror image (a confirmed swing low). Rather than chasing every wiggle, this strategy waits for a bar to close beyond the most recent confirmed swing point before it acts.
Unlike pullback or mean-reversion systems, this is a momentum-oriented approach. It is designed for liquid, trending markets — think major forex pairs such as GBPUSD, metals like XAUUSD (gold), or major stock indices — where price tends to expand in one direction once a key level gives way. The EMA trend filter is what keeps it disciplined: long breakouts are only considered when the fast EMA is above the slow EMA (an uptrend), and short breakouts only when the fast EMA is below the slow EMA (a downtrend). Breakouts that fight the trend are simply ignored.
As a learning tool, the Williams Fractal Trend Breakout is well suited to traders who want to study how objective swing detection, trend confirmation, and volatility-based risk sizing fit together in a single rules-based system. Because every stop and target is scaled by Average True Range (ATR) — a measure of recent volatility — the logic adapts to whatever symbol or timeframe it runs on. Frame this as a study of how a breakout system is structured, not as a shortcut to results.
How It Works
The strategy evaluates its rules only once per freshly closed bar, which avoids reacting to the noise of an unfinished candle. Here is what happens on each completed bar:
- Fractal detection (arming the level): The strategy looks back a fixed number of bars (the "wing") and checks whether the centre bar is a confirmed swing. If the centre bar's high is strictly greater than the highs of every bar within the wing on both sides, it becomes the new long breakout level. If its low is strictly lower than the lows on both sides, it becomes the new short breakout level. Confirmation deliberately lags by the wing count — that lag is exactly what filters out minor, insignificant swings.
- Trend filter: The strategy calculates a fast EMA and a slow EMA of closing prices. When the fast EMA is above the slow EMA, only long breakouts are permitted (an uptrend). When the fast EMA is below the slow EMA, only short breakouts are permitted (a downtrend).
- Long entry signal: The strategy signals a buy when a bar closes above the most recent up-fractal level and the trend filter shows an uptrend. Once that level is broken, it is "consumed" so the same swing is never traded twice — the strategy waits for a fresh fractal before it can arm another long.
- Short entry signal: The strategy signals a sell when a bar closes below the most recent down-fractal level and the trend filter shows a downtrend. That level is likewise consumed on the break.
- One position at a time: The strategy holds only a single position per symbol at once. While a trade is open, no new breakout is taken.
- Stop-loss logic: The stop-loss is placed at a distance of ATR multiplied by the stop multiple from the entry price — below entry for longs, above entry for shorts. Because it is ATR-based, the stop automatically widens in volatile conditions and tightens in calm ones.
- Take-profit logic: The take-profit is placed at ATR multiplied by the target multiple from entry — above entry for longs, below for shorts. With the default settings the target distance is twice the stop distance, giving a baseline reward-to-risk ratio of roughly 2:1.
In short, the strategy signals a trade only when a confirmed swing point is broken in the direction of the prevailing trend, and it manages that trade with volatility-scaled exits.

Strategy Parameters
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
| FractalWing | 2 | 2 | 5 | Half-width of the fractal — the number of bars required on each side of a swing before it is confirmed. Larger values demand more significant swings and confirm more slowly. |
| FastEma | 20 | 5 | 60 | Period of the fast EMA used in the trend filter. A shorter period reacts more quickly to price. |
| SlowEma | 50 | 20 | 200 | Period of the slow EMA used in the trend filter. The relationship between fast and slow EMA defines the trend direction. |
| AtrPeriod | 14 | 7 | 30 | Lookback period for the ATR used to size the stop-loss and take-profit. |
| AtrSlMult | 1.5 | 0.5 | 4.0 | Stop-loss distance as a multiple of ATR. Higher values give the trade more room but risk more per position. |
| AtrTpMult | 3.0 | 1.0 | 6.0 | Take-profit distance as a multiple of ATR. Sets the profit target and, together with the stop multiple, the reward-to-risk ratio. |
| Lots | 0.10 | 0.01 | 1.0 | Fixed trade size in lots for each position. |
Note that the strategy keeps the slow EMA strictly slower than the fast EMA and the fractal wing at a minimum of two bars, adjusting the inputs internally if a chosen combination would break that rule.

Recommended Chart Settings
The Williams Fractal Trend Breakout was designed with liquid, trending instruments in mind — for example GBPUSD, XAUUSD (gold), or major indices — on intraday-to-swing timeframes such as the M30, H1, or H4 charts. Importantly, the code is not locked to any single timeframe: every bar read uses the chart's own timeframe, so the strategy runs on whatever chart you attach it to. This makes it a useful sandbox for studying how the same logic behaves across different symbols and timeframes.
Because breakout behaviour depends heavily on volatility and trend persistence, results will vary considerably across different market conditions. A setting that looks reasonable on gold may behave very differently on a range-bound currency pair. Always test any configuration on your own data and broker feed before drawing conclusions.
How to Install on MetaTrader 5
- Download the .ex5 file from the link below
- Copy it to your MT5
MQL5\Expertsfolder - Restart MetaTrader 5 or refresh the Navigator panel
- Drag the EA onto a chart matching the recommended symbol and timeframe
- Configure the input parameters and enable Algo Trading
What to Consider Before Using This EA
Every strategy has strengths and trade-offs, and understanding them is part of trading education.
Strengths of this approach:
- Objective swing detection. Fractals give a mechanical, unambiguous definition of a swing point, removing the guesswork of drawing levels by hand.
- Built-in trend alignment. The dual-EMA filter prevents the strategy from taking breakouts against the dominant direction, which historically is where many false breaks occur.
- Volatility-adaptive risk. ATR-based stops and targets mean the strategy self-scales to the instrument and market regime rather than using fixed pip distances.
- No repeated trades on stale levels. Consuming a level once it breaks avoids re-entering the same swing over and over.
Known limitations:
- Breakouts can fail. Price frequently pushes just beyond a swing and then reverses — the classic "false breakout" or "fakeout." No filter eliminates these entirely.
- Confirmation lag. Because a fractal needs the wing bars to confirm, the strategy reacts after the swing has fully formed, which can mean a later entry.
- Whipsaw in ranges. In sideways or choppy markets, the EMAs can cross back and forth and breakouts may not follow through. Breakout systems generally underperform when there is no sustained trend.
- Single fixed lot size. The default sizing does not scale to account equity, so risk per trade in percentage terms changes as the balance changes.
The strategy is best understood as a framework for studying trend-filtered breakouts, not as a finished product to deploy without your own research and testing.
Risk Management Tips
Sound risk management matters more than any single entry rule. Consider these general principles as you study any automated strategy:
- Risk a small, fixed fraction per trade. A common educational guideline is to risk no more than 1–2% of account equity on any single position. Adjust the lot size and stop distance so a losing trade stays within that limit.
- Understand drawdown. Even a well-built strategy will experience losing streaks. Study the maximum historical drawdown of any configuration so you know what a normal rough patch looks like before it happens.
- Test on a demo account first. Run the EA on a demo or paper account across varied market conditions before ever considering real capital. This lets you observe behaviour without financial exposure.
- Mind the reward-to-risk ratio. With the default ATR multiples, the target is twice the stop. A favourable reward-to-risk ratio means a strategy does not need a high win rate to remain viable — but no ratio guarantees an outcome.
- Account for costs. Spreads, commissions, and slippage all affect real results, especially on shorter timeframes where trades are more frequent.
- Never over-leverage. Leverage amplifies both gains and losses. Keep position sizes conservative relative to your account.
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
- Expert Advisor: WilliamsFractalTrendBreakout.ex5 (1 downloads)
- Source Code: WilliamsFractalTrendBreakout.mq5 (0 downloads)
- Documentation: WilliamsFractalTrendBreakout.pdf (0 downloads)