Blog / Strategy
Strategy

Half Trend Rail Reversal

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 Half Trend Rail Reversal strategy is a trend-following, regime-flip system built around the HalfTrend indicator — a noise-reduced trailing trend line popularised by Alex Orekhov (also known as "everget"). Unlike a classic moving-average crossover, HalfTrend draws a "rail" that only changes direction when the balance of control genuinely hands over from buyers to sellers or vice versa. The strategy trades that handover: it goes long when the rail flips from a down-regime to an up-regime, and short when the rail flips the other way.

What makes the HalfTrend rail distinctive is how it decides to flip. It is deliberately not a Supertrend, Chandelier, Chande-Kroll, or Donchian-midline clone. Those tools trail an ATR band off a mid-price or off an N-bar high/low. HalfTrend instead flips bearish only when the simple moving average (SMA) of recent highs drops beneath a ratcheting max-low anchor, and flips bullish only when the SMA of recent lows climbs above a ratcheting min-high anchor. Each flip is further confirmed by the closing price piercing the previous bar's low or high. That double gate makes the rail "sticky" — it ignores shallow noise and turns only on a structural change of trend.

As a learning tool, this strategy suits traders who want to study how a regime-detection filter behaves in trending versus choppy markets. It is best understood as a study in trade selectivity: because it acts only on the single transition bar of each regime change, it enters once per trend rather than on every bar. That makes it a clean example for analysing how signal frequency, confirmation logic, and ATR-based risk sizing interact. Frame it as an analysis exercise, not a shortcut to returns.

How It Works

The Half Trend Rail Reversal engine processes only closed bars, acting once each time a new bar forms. On every new bar it rebuilds the HalfTrend rail across a rolling window of history and compares the regime of the most recently closed bar with the bar before it. A change between those two states is a genuine, non-repainting flip.

Here is how the logic unfolds:

An ATR channel (governed by ChannelDeviation) is drawn around the rail for context, but it is informational — it does not itself trigger trades.

HalfTrend rail reversal MT5 EA
Illustrative example of the strategy’s entry and exit logic — not real trading results.

Strategy Parameters

Parameter Default Min Max Description
Amplitude 2 1 8 Lookback length for the high/low anchors and the SMA(high)/SMA(low) trigger lines. Larger values make the rail slower and stickier.
ChannelDeviation 2.00 0.50 4.00 Width of the ATR channel drawn around the rail (a multiple of ATR). Informational context only; it does not trigger trades.
AtrPeriod 100 20 200 Number of bars in the ATR calculation used for the channel and for stop-loss sizing.
SlAtrMult 2.00 0.50 5.00 Stop-loss distance as a multiple of ATR beyond the entry price.
RewardRatio 2.00 0.50 6.00 Take-profit distance expressed as a multiple of the stop distance (the reward-to-risk ratio).
Lots 0.10 0.01 1.00 Fixed order volume in lots for each trade.
Magic 6413 0 9,999,999 Unique magic number that tags this EA's trades so it manages only its own positions.
HalfTrend rail reversal MT5 EA — MQL5 source code

Recommended Chart Settings

The Half Trend Rail Reversal was designed with a trending FX major or metal in mind — for example GBPUSD or XAUUSD (gold) — on the H1 or H4 timeframe, where trends tend to persist long enough for a regime-flip system to capture them. That said, the strategy is timeframe-agnostic: it runs on whatever single primary timeframe is selected at backtest time.

Because the logic depends on genuine trend handovers, it historically behaves best in directional conditions and less well in tight ranges. Results will vary considerably across different symbols, timeframes, and market regimes, so treat the recommended settings as a starting point for study rather than a fixed prescription.

How to Install on MetaTrader 5

What to Consider Before Using This EA

The main strength of this approach is selectivity. By requiring both a moving-average trigger and a close-through-prior-bar confirmation, the HalfTrend rail filters out much of the shallow noise that whipsaws simpler crossover systems. Trading only the transition bar means the strategy commits capital sparingly and lets the ATR-based target run for more than it risks when a trend does develop.

Those same design choices carry trade-offs worth studying:

Study these behaviours on historical data and a demo account before drawing any conclusions. No indicator anticipates the market; HalfTrend simply reacts to structure in a disciplined way.

Risk Management Tips

Sound risk management matters more than any single indicator. Consider these general principles as you study this or any strategy:

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

← Back to Blog