Blog / Strategy
Strategy

Walsh Baseline Trend Reclaim

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 Walsh Baseline Trend Reclaim strategy is a with-trend pullback system built around a statistically robust baseline known as the Hodges-Lehmann location estimator. Where most trend-following expert advisors draw their reference line from a simple or exponential moving average, this strategy replaces that line with the median of the Walsh averages — the same location estimate that sits behind the classic Wilcoxon signed-rank test. In plain terms, it computes every pairwise average of the last N closing prices and takes the median of those values. That single design choice is what makes the strategy distinctive.

Why bother? A conventional moving average is easily dragged around by a single news spike or an outlier wick — precisely the kind of noise that produces false pullback signals. The Hodges-Lehmann estimator is roughly 95% as efficient as the arithmetic mean on clean data, yet it has a breakdown point of about 29%, meaning nearly a third of the sample would have to be corrupted before the estimate is meaningfully distorted. The practical effect is a baseline that barely flinches when a spike bar prints, so pullback entries stay clean and the whipsaw trades that drain most pullback systems are heavily suppressed.

This is a strategy analysis intended as a learning tool for traders who want to understand robust statistics applied to price. It suits students of trend-following and mean-reversion mechanics, developers studying how to build spike-immune baselines, and anyone curious about why the choice of a central-value estimator matters. It is designed for liquid FX majors and metals on the M15 to H1 timeframes, and it trades fully symmetrically on both the long and short side.

How It Works

The strategy evaluates signals once per newly closed bar and manages any open position on every tick. It only ever holds one position at a time per magic number.

Building the robust baseline

Trend filter (the gate)

Pullback and reclaim entry (do not chase)

Stop-loss logic

Take-profit and trade management

Walsh Baseline Trend Reclaim EA
Illustrative example of the strategy’s entry and exit logic — not real trading results.

Strategy Parameters

Parameter Default Min Max Description
WindowLen 24 8 60 Number of closing prices used to build the robust Hodges-Lehmann (Walsh-average) baseline.
SlopeLen 6 2 20 How many bars back the second baseline is measured to compute the robust slope.
SlopeMinAtr 0.15 0.02 0.80 Minimum baseline slope (in ATR units over SlopeLen) required to confirm a trend.
AtrPeriod 14 5 30 ATR lookback used for volatility-scaled thresholds, stops and the trail.
StopBufAtr 0.5 0.0 2.0 Stop buffer placed beyond the reclaim bar's extreme, in ATR units.
EntryMaxAtr 0.6 0.1 2.0 Rejects entries whose close is already more than this (ATR) past the baseline.
MaxRiskAtr 2.5 0.5 6.0 Skips the setup if the structural risk exceeds this multiple of ATR.
RewardRisk 1.6 0.8 4.0 Take-profit as a reward-to-risk multiple of the structural stop distance.
BreakevenAtr 1.0 0.2 3.0 Moves the stop to break-even once this much ATR of profit is reached.
TrailAtr 2.0 0.5 5.0 ATR distance the trailing stop rides behind price once past break-even.
MaxSpreadPoints 80 5 300 Skips new entries when the current spread (in points) is wider than this.
Lots 0.10 0.01 1.0 Order volume in lots.
Magic 5150 0 9,999,999 Magic number used to identify and manage this EA's positions.
Walsh Baseline Trend Reclaim EA — MQL5 source code

Recommended Chart Settings

The Walsh Baseline Trend Reclaim strategy was designed with liquid FX majors and metals in mind — pairs such as EUR/USD, GBP/USD, USD/JPY, and instruments like XAU/USD — traded on the M15 to H1 timeframes. Nothing in the code is hardcoded to a particular timeframe; every price and indicator call uses the chart's own period, so the EA runs on whatever timeframe you attach it to.

Because the baseline, thresholds, stops, and trailing distance are all scaled by ATR, the strategy adapts to the local volatility of each symbol. Even so, results will vary considerably across different instruments, spreads, and market conditions. Always test on the specific symbol and timeframe you intend to run before drawing any conclusions.

How to Install on MetaTrader 5

What to Consider Before Using This EA

Strengths of the approach. The defining advantage here is the robust baseline. By using the Hodges-Lehmann location estimator instead of a moving average, the reference line resists distortion from spikes and news wicks — the very events that trigger false signals in conventional pullback systems. The trend gate, the "don't chase" extension filter, the capped structural risk, and the break-even-plus-trail management all reinforce a design philosophy centred on suppressing whipsaw and keeping risk tightly controlled. Trading symmetrically on both sides also means it can engage trends in either direction.

Known limitations. No baseline, however robust, changes the fundamental nature of trend-following: it needs trends to exist. In extended range-bound or violently choppy markets, the slope filter will keep the strategy sidelined much of the time, and the entries it does take may still be stopped out when a false breakout fails. The Walsh-average calculation is also more computationally involved than a moving average — it forms W × (W + 1) / 2 pairwise averages each check — though at the default window this remains lightweight.

Where it may underperform. Sharp regime shifts, low-liquidity sessions, and periods of erratic gapping can all reduce the reliability of the reclaim signal. A fixed reward-to-risk take-profit may leave gains on the table during strong runs, while the ATR trail is more forgiving there. As with any single strategy, expect stretches of drawdown and flat performance; the robust baseline reduces certain kinds of noise, but it does not eliminate losing trades.

Risk Management Tips

Risk management is what separates durable trading from luck. Consider these general principles as you study any expert advisor:

Used thoughtfully, the Walsh Baseline Trend Reclaim strategy is a useful case study in how a robust statistical estimator can be applied to a familiar pullback framework — a way to learn, not a shortcut around the hard realities of risk.

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