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 Equal Highs Shelf Breakout is a pure price-action breakout strategy that uses no traditional indicators — no moving averages, no RSI, no ATR. Instead, it reads raw candle data (the open, high, low, and close of each bar) to locate a horizontal "shelf": a price level that the market has tested several times, leaving behind a cluster of near-equal highs (a resistance shelf) or near-equal lows (a support shelf). When a strong momentum candle closes decisively through that shelf, the strategy interprets it as committed order flow rather than a random one-bar spike.
This approach is designed for trending or breakout-prone market conditions, where price coils against a clear level before releasing in one direction. It is less suited to choppy, sideways ranges where false breaks are common. Because every decision is derived from visible structure on the chart, it makes an excellent learning tool for traders who want to understand why a level matters and how a breakout can be defined objectively, without relying on lagging indicators.
If you are studying support and resistance, structure-based stop placement, or fixed risk-to-reward targeting, this strategy gives you a clean, transparent example to dissect. Think of it as a price-action case study you can read line by line — not a shortcut to results.
How It Works
The strategy evaluates conditions only when a bar closes (it acts on completed candles, never on the still-forming bar). On each new bar, it looks back over a window of recent candles to build the shelf, then checks whether the most recently closed bar broke through it.
Building the shelf (the resistance or support level):
- The strategy scans the lookback window (excluding the breakout bar) for the highest high (for a long setup) or the lowest low (for a short setup).
- It then counts how many bars have a high within a small tolerance of that maximum high — these are the "touches." A level tested multiple times is considered a genuine shelf, not a single random peak.
- The tolerance is not a fixed number of pips; it is a fraction of the recent average bar range, so the definition of "equal" automatically adapts to how volatile the market currently is.
Entry conditions — the strategy signals a long when:
- The most recently closed bar is a strong-bodied bullish candle — its body (close minus open) is at least a set fraction of its total range, indicating conviction rather than a long-wicked spike.
- The bar closes above the resistance shelf by more than a confirmation buffer (also scaled to average range), filtering out marginal pokes through the level.
- The shelf was touched at least the minimum required number of times.
The strategy signals a short under the mirror-image conditions: a strong bearish candle closing below a support shelf that was tested the minimum number of times, by more than the buffer.
Stop-loss logic:
- For a long, the stop is placed below the reclaimed shelf — specifically at the lower of the breakout bar's low or (shelf level minus tolerance), then pushed a further buffer below. This puts the stop on the far structural side of the level, so a clean breakout should not revisit it.
- For a short, the stop mirrors this above the shelf.
Take-profit logic:
- Risk is measured as the distance from entry to stop.
- The target is placed at a fixed multiple of that risk (the Risk-Reward parameter). With the default of 2.0, the target sits twice as far from entry as the stop.
Trade management:
- Only one position is allowed at a time per symbol, identified by a magic number. The strategy will not stack trades or add to a winner.

Strategy Parameters
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
| LookbackBars | 30 | 12 | 60 | Number of bars used to build the shelf and search for near-equal highs/lows. |
| MinTouches | 3 | 2 | 6 | Minimum number of near-equal touches required before a level qualifies as a valid shelf. |
| TolerancePct | 0.25 | 0.05 | 0.60 | How close highs/lows must be to count as "equal," expressed as a fraction of the average bar range. |
| BreakBufferPct | 0.10 | 0.00 | 0.50 | Extra cushion beyond the shelf that the candle must close past to confirm a breakout, as a fraction of average range. |
| BodyFraction | 0.50 | 0.20 | 0.80 | Minimum body size as a fraction of the breakout bar's total range, filtering weak or wicky candles. |
| RiskReward | 2.0 | 1.0 | 4.0 | Take-profit distance as a multiple of the measured risk (stop distance). |
| Lots | 0.10 | 0.01 | 1.0 | Fixed trade volume in lots. |

Recommended Chart Settings
This strategy uses a single primary timeframe and is symbol-agnostic, but it tends to be studied most cleanly on liquid instruments where horizontal levels are well respected — major forex pairs such as EUR/USD or GBP/USD, or major indices. A mid-range timeframe such as the H1 (1-hour) chart is a sensible starting point for observation: it produces enough bars to form meaningful shelves while keeping noise lower than very fast timeframes.
Because the tolerance and buffer scale to the average bar range, the logic adapts somewhat to different instruments automatically. Even so, results will vary considerably across symbols, timeframes, and market conditions. Always test any configuration on historical data and a demo account 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
Strengths of this approach. The logic is transparent and structure-driven — every entry corresponds to a visible, multi-touch level and a decisive close, which makes signals easy to audit on the chart. The strong-body and buffer filters are deliberate attempts to reduce false breakouts, and the structure-based stop keeps risk tied to the actual level rather than an arbitrary distance. The fixed risk-to-reward target also enforces discipline around exits.
Known limitations. Breakout strategies are vulnerable to "fakeouts," where price closes through a level only to reverse — no filter eliminates these entirely. In ranging or low-momentum markets, the strategy may take repeated losses as levels fail to hold. Because it trades only completed bars and allows one position at a time, it can also miss fast moves or sit idle during quiet periods. The fixed lot size does not adjust to account equity or volatility, so position risk in currency terms can vary from trade to trade.
Where it may underperform. Tight, news-driven whipsaws, illiquid instruments with erratic spreads, and prolonged sideways chop are all conditions where breakout logic historically struggles. Spread and slippage around the moment of a breakout can also widen the real risk versus the modeled risk. Treat this EA as a framework for studying breakout behavior, and validate it thoroughly before relying on any single parameter set.
Risk Management Tips
- Risk a small, fixed percentage per trade. A common educational guideline is to risk no more than 1–2% of account equity on any single position. Because this EA uses a fixed lot size, you may need to adjust the
Lotsvalue to match your account size and the instrument's pip value. - Use a demo account first. Run the strategy on a demo or simulated environment until you understand its behavior across different market conditions.
- Understand drawdown. Even a sound strategy will experience losing streaks. Know the maximum historical drawdown of any configuration you test, and ask yourself whether you could tolerate it in real time.
- Mind the costs. Spread, commission, and slippage all erode breakout edges. Factor them into any evaluation.
- Never risk money you cannot afford to lose, and avoid over-leveraging in pursuit of larger positions.
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: EqualHighsShelfBreakout.ex5 (0 downloads)
- Source Code: EqualHighsShelfBreakout.mq5 (0 downloads)
- Documentation: EqualHighsShelfBreakout.pdf (0 downloads)