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 Compression Ledge Continuation strategy is a trend-following continuation system built around a slow Simple Moving Average (SMA) baseline, an Average True Range (ATR) volatility filter, and a price-action pattern the strategy calls a compression ledge. A Simple Moving Average is the running average of recent closing prices, used here as the trend backbone. Average True Range measures how far price typically moves in one bar, giving every threshold in the system a volatility-scaled — rather than fixed — value. Together they let the strategy read the market in "ATR units" instead of raw pips, so the same logic behaves consistently across calm and volatile conditions.
The core idea is that trends rarely travel in a straight line. Instead, they tend to climb a staircase: a drive higher (or lower), then a short shelf where price pauses, coils and consolidates, then another drive. Each shelf is a brief compression pause resting on top of the trend baseline. The strategy is designed to identify one of these shelves and enter only when price closes decisively beyond it in the direction of the established trend. It is deliberately not a range-breakout system and not a mean-reversion fade — it only ever trades with the prevailing drift, treating the break of a compression shelf as the ignition of the next step up (or down).
As a learning tool, this strategy is well suited to traders who want to study trend continuation and structure-based risk placement. Because the stop-loss is anchored to the opposite edge of a tightly compressed shelf, the strategy demonstrates how a well-defined pause can produce a naturally tight, structurally-justified stop. It is best viewed as a study in combining a trend gate, a compression filter, and a "no-chase" entry rule — not as a shortcut to any particular outcome.
How It Works
The strategy evaluates its rules once per completed bar (it ignores the still-forming bar to avoid acting on incomplete data), while trade management runs on every tick. All comparisons are made in ATR units so the logic scales with volatility.
Trend gate (the direction filter):
- The slow SMA must be sloping. Slope is measured over
SlopeBarsbars and divided by ATR, so a rising baseline must climb at leastMinSlopeAtrATR units to qualify. - For longs, price must sit above the SMA; for shorts, below it. The strategy never fights the prevailing drift, so its losing trades are with-trend pullbacks rather than full reversals.
Ledge gate (the compression filter):
- The strategy measures the shelf as the highest high and lowest low of the
LedgeBarsclosed bars preceding the ignition bar. - That shelf's total range must be no wider than
LedgeMaxAtr × ATR. A narrow range signals a genuine compression pause rather than choppy churn. - The shelf must rest around the baseline — a pullback step. For longs, the shelf high sits above the SMA while the shelf low stays within
ShelfDipAtr × ATRbelow it; the short case is the mirror.
Ignition (the entry trigger):
- The just-closed bar must close beyond the shelf — above the shelf high for a long, below the shelf low for a short. Using the close (acceptance) rather than an intrabar wick filters out failed pokes.
- The bar must have a decisive body in the trade direction (bullish close for longs, bearish for shorts).
- The no-chase filter requires the close to be no more than
MaxChaseAtr × ATRbeyond the shelf. This prevents entering an already over-extended break, which the strategy treats as a major source of continuation-trade risk. - Only one position is held at a time, keeping risk bounded and the continuation logic clean.
Stop-loss, take-profit, and breakeven:
- The stop-loss is placed just past the opposite edge of the compressed shelf — below the shelf low for longs, above the shelf high for shorts — plus a small
BufferAtr × ATRcushion. Because the shelf is tight, the stop is structurally tight too. - The take-profit is a fixed reward-to-risk multiple: the distance from entry to stop, multiplied by
RiskReward. - Once price travels
BreakevenRmultiples of the initial risk in the trade's favour, the stop is pulled to the entry price (breakeven), reducing exposure on trades that move ahead before stalling.

Strategy Parameters
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
| Lots | 0.10 | 0.01 | 1.00 | Fixed trade size in lots for each position. |
| SlowSma | 50 | 20 | 150 | Period of the slow SMA that defines the trend baseline. |
| SlopeBars | 10 | 3 | 40 | Lookback (in bars) used to measure the baseline's slope. |
| MinSlopeAtr | 0.25 | 0.00 | 2.00 | Minimum baseline slope, in ATR units, required to confirm a trend. |
| LedgeBars | 5 | 3 | 15 | Number of bars that form the compression shelf (ledge). |
| LedgeMaxAtr | 1.20 | 0.40 | 3.00 | Maximum shelf range, in ATR units, for a valid compression pause. |
| ShelfDipAtr | 0.75 | 0.00 | 2.50 | How far the shelf may dip past the baseline and still count as a pullback step (ATR units). |
| AtrPeriod | 14 | 7 | 28 | Period of the ATR used for all volatility-scaled thresholds. |
| MaxChaseAtr | 0.50 | 0.10 | 2.00 | No-chase filter: maximum distance the close may be beyond the shelf (ATR units). |
| RiskReward | 1.6 | 0.8 | 4.0 | Take-profit distance as a multiple of the initial risk (R multiple). |
| BreakevenR | 1.0 | 0.0 | 3.0 | Move the stop to breakeven after price travels this many R in profit. |
| BufferAtr | 0.10 | 0.00 | 0.50 | Extra cushion beyond the shelf edge for the stop-loss (ATR units). |

Recommended Chart Settings
The strategy was designed for trending majors and metals — for example EUR/USD, USD/JPY, and XAU/USD (gold) — on intraday-to-swing timeframes from M15 through H4. Because it reads only the primary chart timeframe, it will run on whichever timeframe you attach it to, but its logic is tuned around the pace and volatility typical of that M15–H4 band.
Keep in mind that market character changes over time. A symbol that trends cleanly in one period may chop sideways in another, and results will vary across different market conditions, sessions, and brokers. Testing on your own data and spreads is essential before drawing any 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 the approach. The strategy's design places its stop where the market structure justifies it — just past a tightly compressed shelf — rather than at an arbitrary fixed distance. This tends to produce compact, well-defined risk on each trade. The trend gate keeps it aligned with the prevailing drift, and the no-chase filter is an explicit attempt to avoid the common continuation pitfall of entering breaks that have already run too far. The breakeven mechanism further reduces exposure on trades that advance and then stall.
Known limitations. Every filter that improves entry quality also reduces trade frequency. Requiring a sloping baseline, a genuinely compressed shelf resting on that baseline, a decisive closing break, and a not-yet-extended price all at once means qualifying setups can be relatively rare — the strategy may sit idle for long stretches. Moving-average trend gates are also lagging by nature: they confirm a trend only after it is underway, and they can whipsaw in ranging markets where the SMA slope hovers near the MinSlopeAtr threshold.
Where it may underperform. The system is built for trending conditions. In choppy, sideways, or sharply mean-reverting markets, apparent "shelves" may resolve against the trend, producing with-trend pullback losses. Sudden volatility spikes — around news releases, for instance — can blow through the tight structural stop before the breakeven logic engages. Because only one position runs at a time, the strategy also forgoes setups that appear while a trade is already open. None of these traits are flaws to be "fixed"; they are trade-offs to understand before deploying.
Risk Management Tips
Sound risk management matters more than any single entry rule. Consider these general principles:
- Size positions to your account, not to the default. The
Lotsparameter is a fixed size; a lot that is appropriate for one account balance may be far too large for another. Many educational sources suggest risking no more than 1–2% of account equity on any single trade. - Understand your per-trade risk. With a structural stop, the distance from entry to stop varies with each shelf's width. Know that distance in money terms before you trade, and adjust lot size so a stop-out stays within your risk budget.
- Always test on a demo account first. Run the EA on a demo or on historical data across multiple market regimes to understand its behaviour, trade frequency, and typical drawdown before considering any live capital.
- Study drawdown, not just wins. A strategy's worst peak-to-trough decline tells you more about whether you can live with it than its win rate does. Make sure any drawdown you observe in testing is one you could tolerate emotionally and financially.
- Account for costs. Spreads, commissions, and slippage — especially on tight stops and around news — can meaningfully affect outcomes that look clean in a frictionless backtest.
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: CompressionLedgeContinuation.ex5 (18 downloads)
- Source Code: CompressionLedgeContinuation.mq5 (22 downloads)
- Documentation: CompressionLedgeContinuation.pdf (20 downloads)