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 Stair Step Trend Continuation strategy is a pure price-action, trend-following system for MetaTrader 5 that uses no technical indicators at all — it reads market structure directly from raw open-high-low-close (OHLC) bar data. Instead of relying on moving averages, oscillators, or momentum tools, it identifies trends through swing structure: the sequence of swing highs and swing lows that price prints as it moves. A swing high is a local peak, and a swing low is a local trough; together they form the "stair-step" pattern that gives the strategy its name.
The core idea is rooted in a classic observation about healthy trends. When a market is genuinely trending higher, it tends to "stair-step" upward — printing a series of higher swing highs and higher swing lows. A downtrend mirrors this, carving out lower swing highs and lower swing lows. The strategy waits for this structure to confirm, then looks for a shallow counter-trend pullback before re-entering in the direction of the established trend. It is designed for trending market conditions and is most at home on instruments and timeframes that produce clean, directional moves rather than choppy, range-bound noise.
As a learning tool, this strategy is well suited to traders who want to understand how trend continuation and market-structure analysis work without the clutter of lagging indicators. Because every decision is derived from price alone, it offers a transparent, readable example of how swing detection, pullback counting, and risk-defined entries fit together. This is a strategy analysis intended to build your understanding of price-action mechanics — not a shortcut or a promise of any particular outcome.
How It Works
The strategy evaluates the market once per newly closed bar and acts only on confirmed, completed price data. Here is how its logic flows in plain English:
- Swing detection: The strategy confirms a swing high when a closed bar's high strictly exceeds the highs of
PivotLengthbars on each side of it (a symmetric pivot). A swing low is confirmed by the mirror rule. This produces a running record of the most recent and previous swing highs and lows. - Trend identification: An uptrend is recognized when the latest swing high is above the previous swing high and the latest swing low is above the previous swing low. A downtrend is recognized when the latest swing high is below the previous one and the latest swing low is below the previous one. If neither condition holds, no trade is considered.
- Pullback detection (entry setup): Within a confirmed uptrend, the strategy counts a run of consecutive lower closes — a shallow counter-trend pullback. In a downtrend, it counts consecutive higher closes. The pullback must contain at least
PullbackBarsbars to qualify. - Resumption trigger (entry): In an uptrend, the strategy signals a long (buy) entry the moment the current bar closes back above the prior bar's high, indicating the trend may be resuming. In a downtrend, it signals a short (sell) entry when the current bar closes back below the prior bar's low.
- Stop-loss logic: For a long, the protective stop is placed just below the lowest low of the pullback (the natural invalidation point), minus a small buffer. For a short, the stop sits just above the highest high of the pullback, plus the buffer. The buffer size is a fraction (
StopBufferPct) of the current bar's range. - Take-profit logic: The target is set at a fixed multiple of the measured risk. The distance from entry to stop defines one unit of risk (1R), and the take-profit is placed
RewardRatiotimes that distance away from entry. With the default reward ratio of 2.0, the target sits twice as far from entry as the stop. - One position at a time: The strategy holds only a single open position per magic number, so it will not stack multiple trades on the same setup.
In short, the strategy signals a trade only when an established stair-step trend pauses for a brief pullback and then shows a sign of resuming. Every entry carries a predefined stop and target, so the risk on each trade is known before it is placed.

Strategy Parameters
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
| PivotLength | 3 | 2 | 8 | Symmetric pivot half-width. The number of bars required on each side of a candidate bar to confirm it as a swing high or swing low. Larger values detect bigger, slower swings. |
| PullbackBars | 2 | 1 | 5 | Minimum number of consecutive counter-trend closes that must form before a pullback is considered valid for re-entry. Higher values demand deeper pullbacks. |
| RewardRatio | 2.0 | 1.0 | 4.0 | Take-profit distance expressed as a multiple of the trade's risk (the entry-to-stop distance). A value of 2.0 sets the target at twice the risk. |
| StopBufferPct | 0.25 | 0.0 | 1.0 | Extra stop-loss buffer beyond the pullback extreme, measured as a fraction of the current bar's range. Adds breathing room past the invalidation point. |
| Lots | 0.10 | 0.01 | 1.0 | The fixed order volume (position size) used for each trade. |

Recommended Chart Settings
The Stair Step Trend Continuation strategy operates on a single symbol and a single timeframe — the chart it is attached to. Because it relies on clean swing structure, it tends to be most readable on instruments that produce sustained directional moves, such as major forex pairs, and on intermediate timeframes like the H1 (1-hour) or H4 (4-hour) charts, where swing pivots are meaningful and signals are less affected by short-term noise.
These are starting points for study, not prescriptions. The behavior of any structure-based strategy changes with volatility, session, and instrument. Results will vary across different market conditions, and the same parameters that suit one symbol may behave very differently on another. Always test on the specific symbol and timeframe you intend to study before drawing any conclusions.
How to Install on MetaTrader 5
- Download the
StairStepTrendContinuation.ex5file 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
This strategy has clear strengths as an educational model. Because it uses no indicators, there is no lag from smoothing or averaging — every signal traces directly back to price structure you can see on the chart. Its risk is defined on every trade by the pullback extreme, which gives each setup a logical, structural invalidation point rather than an arbitrary fixed stop. The stair-step concept also encourages you to think in terms of swing analysis and trend context, which is valuable knowledge regardless of the specific tool.
There are equally important limitations to understand. Like all trend-following approaches, it depends on the market actually trending. In range-bound or choppy conditions, swing highs and lows can flip-flop, producing false trend reads and entries that quickly reverse. The symmetric pivot used to detect swings is confirmed only after PivotLength bars have closed on each side, so swing recognition is inherently delayed — by design, the strategy reacts to confirmed structure rather than anticipating it. Sudden gaps, news spikes, or low-liquidity sessions can also place price beyond the intended stop or target levels.
No single set of parameters performs consistently across all instruments and market regimes. The right PivotLength or PullbackBars for a volatile pair may be wrong for a calmer one. Treat this EA as a framework for studying trend continuation, and expect periods where it underperforms when the market is not cooperating with its core assumption.
Risk Management Tips
Sound risk management matters far more than any single entry rule. Consider these general principles as you study this or any strategy:
- Risk a small, fixed fraction per trade. Many educational sources suggest risking no more than 1–2% of account equity on any single position, so that a string of losses does not threaten the account.
- Size positions to your stop, not to a fixed lot. The default
Lotsvalue is a constant; in practice, position size should reflect the distance to your stop-loss and the percentage of capital you are willing to put at risk. - Use a demo account first. Test the strategy thoroughly in a risk-free demo environment to understand how it behaves before considering any live use.
- Understand drawdown. Even a well-constructed trend strategy will experience losing streaks and equity drawdowns. Know the depth of drawdown you can tolerate, both financially and emotionally.
- Account for costs. Spreads, commissions, and slippage all affect real outcomes and are not always reflected in idealized testing.
- Never rely on a single strategy or a single trade. Diversification of approach and disciplined consistency matter more than any individual signal.
Education and preparation are the foundation of responsible trading. The goal of studying a strategy like this one is to deepen your understanding of market structure and risk-defined entries — not to chase a particular result.
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: StairStepTrendContinuation.ex5 (8 downloads)
- Source Code: StairStepTrendContinuation.mq5 (3 downloads)
- Documentation: StairStepTrendContinuation.pdf (3 downloads)