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 Separating Lines Continuation strategy is a trend-following system built around the classic Japanese candlestick pattern known as "Separating Lines," combined with an Exponential Moving Average (EMA) trend filter and Average True Range (ATR)-based risk sizing. An EMA is a moving average that weights recent prices more heavily than older ones, making it responsive to the current trend, while ATR is a volatility gauge that measures the typical size of a bar's price range. Together these two indicators give the strategy both a sense of direction and a sense of how far price normally travels.
The "Separating Lines" pattern is a recognised continuation signal — meaning it is designed to appear during an existing trend rather than at a reversal. The pattern consists of two consecutive candles that are opposite colours but share (roughly) the same opening price. When a single counter-trend candle interrupts a trend and the very next candle re-opens at that candle's open and closes strongly back in the trend direction, it suggests that the attempt to fade the trend was rejected within one bar. The strategy treats this "snap-back" to the prior open as a high-conviction footprint that the dominant trend is resuming.
This strategy is best suited to traders who want to study how candlestick pattern recognition can be codified into objective, rule-based logic, and how a discretionary chart pattern can be paired with a systematic trend filter and volatility-scaled risk. It is a learning tool for understanding continuation patterns, not a shortcut to results. As with any single-pattern system, it will behave very differently across trending and ranging markets.
How It Works
The strategy evaluates only completed bars on a single timeframe. On each newly-formed bar it examines the bar that just closed (the "separating" candle) and the one before it (the prior counter-trend "pause" candle). It holds at most one position at a time.
The strategy signals a long (bullish separating line) when all of the following are true:
- The EMA is rising — its current value is above its value a few bars earlier (the slope is measured over a 3-bar lookback).
- The just-closed candle closes above the EMA, confirming price is on the bullish side of the trend filter.
- The prior candle was bearish (a shallow pullback against the uptrend).
- The current candle is bullish, and its open is within
OpenToleranceAtr × ATRof the prior candle's open — this is the "separating" snap-back that defines the pattern. - The current candle's body is at least
MinBodyAtr × ATR, a conviction filter that screens out weak, indecisive candles.
The strategy signals a short (bearish separating line) using the exact mirror image: the EMA must be falling, the close must be below the EMA, the prior candle must be bullish, and the current candle must be a bearish body of sufficient size re-opening near the prior open.
Entry: When a long signal fires, the strategy buys at the current ask price; a short signal sells at the current bid price.
Stop-loss: The stop is placed AtrStopMult × ATR away from entry — below entry for longs, above entry for shorts. Because the distance scales with ATR, the stop automatically widens in volatile conditions and tightens in calm ones.
Take-profit: The target is placed AtrTargetMult × ATR from entry in the trade's favour. With the default settings (stop 1.5× ATR, target 2.5× ATR), the intended reward-to-risk ratio is roughly 1.67 to 1.
Requiring the open to snap back to the prior open — not merely the prior close — is the selective element that distinguishes this setup from a plain engulfing or inside-bar pattern.

Strategy Parameters
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
| TrendEmaPeriod | 50 | 20 | 200 | Length of the EMA trend filter. Higher values track a slower, longer-term trend. |
| AtrPeriod | 14 | 5 | 30 | Length of the ATR used for open tolerance, the body filter, and risk sizing. |
| OpenToleranceAtr | 0.10 | 0.02 | 0.60 | How closely the two candle opens must match, as a fraction of ATR. Larger values loosen the "same open" requirement. |
| MinBodyAtr | 0.50 | 0.10 | 2.00 | Minimum body size of the separating candle, as a fraction of ATR. A conviction filter against weak candles. |
| AtrStopMult | 1.5 | 0.5 | 4.0 | Stop-loss distance from entry, in ATR multiples. |
| AtrTargetMult | 2.5 | 0.5 | 6.0 | Take-profit distance from entry, in ATR multiples. |
| Lots | 0.10 | 0.01 | 1.0 | Fixed trade size in lots. |

Recommended Chart Settings
The strategy is designed to run on a single timeframe and reads all of its data from the chart it is attached to. Candlestick continuation patterns like Separating Lines are generally studied on intraday and swing timeframes such as the H1 (1-hour) or H4 (4-hour) charts, where individual candles carry enough structure for the pattern to be meaningful, while longer timeframes reduce the noise that can produce false signals on very fast charts.
For the symbol, major forex pairs such as EUR/USD are a common starting point for study because they tend to trend cleanly and have tight spreads, which matters for a strategy that trades on ATR-scaled distances. That said, the pattern is not symbol-specific. You are encouraged to test it across several instruments and timeframes in the Strategy Tester, because results will vary considerably across different market conditions, volatility regimes, and spread environments.
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. The main appeal of this approach is its selectivity. By demanding a specific two-candle structure, an EMA-confirmed trend, a close on the correct side of the EMA, and a minimum body size, the strategy filters out a large amount of ambient market noise. Because every threshold is scaled by ATR rather than fixed in pips, the logic adapts to changing volatility instead of breaking down when the market speeds up or slows down. The one-position-at-a-time rule keeps exposure contained and easy to reason about.
Limitations. Continuation patterns only add value when a genuine trend exists. In sideways or choppy markets, the EMA slope can flip back and forth, and the strategy may take signals that lead nowhere. Candlestick patterns are also sensitive to how a broker builds its candles — open prices, session boundaries, and gaps differ between brokers, and the "same open" condition can behave differently as a result. Because the strategy requires a fairly precise open match, valid-looking trends may pass by without ever triggering a qualifying signal, so trade frequency can be low. The fixed reward-to-risk target means the strategy does not trail winners or adapt its exit to momentum; a strong continuation may reverse before reaching the ATR target.
Where it may underperform. Expect weaker behaviour during ranging conditions, around major news releases where volatility spikes distort ATR, and during low-liquidity sessions where spreads widen relative to the ATR-scaled stop. As always, treat this as one analytical tool among many rather than a complete trading plan.
Risk Management Tips
Sound risk management matters more than any single entry signal. Consider the following general principles:
- Risk a small, fixed fraction per trade. Many educational sources suggest risking no more than 1–2% of account equity on any single position. Size your lots so that the ATR-based stop distance corresponds to that fraction, rather than trading a fixed lot blindly.
- Test on a demo account first. Run the EA on a demo or in the Strategy Tester across multiple market conditions before considering any live use, so you understand how often it trades and how it behaves in drawdown.
- Understand drawdown. Every strategy endures losing streaks. Know the largest peak-to-trough equity decline you are willing to tolerate, and stop to reassess if it is exceeded.
- Account for costs. Spreads, commissions, and slippage all erode edge, especially on a strategy that trades on ATR-scaled distances. Include realistic costs in any testing.
- Never risk money you cannot afford to lose, and treat the fixed
Lotsinput as a starting point to be adjusted for your own account size and risk tolerance.
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: SeparatingLinesContinuation.ex5 (53 downloads)
- Source Code: SeparatingLinesContinuation.mq5 (58 downloads)
- Documentation: SeparatingLinesContinuation.pdf (53 downloads)