Blog / Strategy
Strategy

Winsorized Momentum Trend

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 Winsorized Momentum Trend strategy is a trend-following, robust-statistics momentum system for MetaTrader 5 that measures directional pressure using a winsorized drift rather than a raw momentum reading. In plain terms, "winsorizing" is a technique from robust statistics that clips extreme values back toward the bulk of the data instead of letting them dominate the calculation. Applied to price returns, this means a single violent spike bar — a news wick or a stop-run candle — is prevented from falsifying the trend signal, so the reading reflects the persistent lean of the market rather than one freak move that usually reverts.

Most simple momentum tools calculate something like Close[now] − Close[k bars ago] or the slope of a moving average. Both are easily distorted by one outsized bar. Winsorized Momentum Trend instead takes the last N bar-to-bar returns, finds their median and median absolute deviation (MAD), and pulls every return that lies beyond a robust-sigma band back to the edge of that band before summing them. The result is divided by the Average True Range (ATR) — a standard volatility measure — to produce a "clean drift in ATRs" that is comparable across symbols and timeframes.

This strategy is designed as a learning tool for traders who want to understand how robust statistics can filter noise out of a trend gauge, and how a pullback-entry (buying a dip within an uptrend rather than chasing a breakout) can be combined with a regime filter. It is best suited to liquid, trending instruments and is not intended as a turnkey system or a profit opportunity — it is a worked example of a design idea.

How It Works

The strategy recalculates its "clean drift" on every newly closed bar, then checks for entries, exits, and risk conditions. Here is the logic in plain English.

Building the clean drift (the trend gauge):

The strategy signals a LONG entry when:

The strategy signals a SHORT entry when:

Exit logic:

Stop-loss and take-profit logic:

winsorized momentum trend MT5 EA
Illustrative example of the strategy’s entry and exit logic — not real trading results.

Strategy Parameters

Parameter Default Min Max Description
MomentumPeriod 20 8 60 Number of bar-to-bar returns that define the drift window.
WinsorK 2.0 1.0 4.0 Half-width of the winsorization band in robust sigmas (MAD × 1.4826). Lower values mean harsher clipping.
TrendThreshold 0.75 0.20 2.50 Minimum absolute clean drift (in ATRs) for the window to count as a real trend.
FastEmaPeriod 10 3 30 Fast EMA that the pullback must reclaim to trigger an entry.
AtrPeriod 14 5 40 ATR period used to scale the drift and size the stop and target.
AtrMultSl 2.0 0.5 6.0 Protective stop distance as a multiple of ATR.
AtrMultTp 3.5 0.5 10.0 Target distance as a multiple of ATR (lets a clean leg run).
MaxSpreadPoints 30 0 200 Skip entries when the spread (in points) exceeds this value (0 = no filter).
Lots 0.10 0.01 1.00 Trade volume in lots.
Magic 5163 0 9,999,999 Magic number identifying this EA's positions.
winsorized momentum trend MT5 EA — MQL5 source code

Recommended Chart Settings

Winsorized Momentum Trend was built with liquid, trending instruments in mind — major FX pairs such as EURUSD and GBPUSD, and metals such as XAUUSD (gold). The design notes point to the M15 to H1 timeframes as the intended range, where there are enough clean bars to build a stable drift estimate without excessive noise.

That said, the strategy never hardcodes a timeframe — it runs on whatever timeframe the chart or backtest selects, using the primary symbol and period throughout. Because every market behaves differently, results will vary considerably across symbols, timeframes, brokers, and market conditions. Treat the recommended settings as a starting point for study and testing, not as an optimal configuration. Always validate any settings on your own data before drawing conclusions.

How to Install on MetaTrader 5

What to Consider Before Using This EA

Strengths of the approach. The core idea — using winsorization to make a momentum gauge blind to outlier bars — is a thoughtful answer to a real problem. Genuine trends are built from many ordinary bars leaning the same way, while noise and traps tend to be a few outsized bars that snap back. By clipping the tails, the drift tends to flip direction only on a true regime change rather than on a single dramatic candle. The pullback-reclaim entry also avoids chasing extended moves, and the ATR-based stops and targets adapt to current volatility instead of using fixed pip distances.

Known limitations. Like all trend-following logic, this strategy can struggle in choppy, range-bound markets where price repeatedly crosses the fast EMA without a sustained trend — this may produce a series of small losing trades as the drift hovers near the threshold. The regime-flip exit is symmetric and reactive: it protects capital when the trend genuinely turns, but it can also close a position during a temporary counter-move that later resumes. The MAD and median calculations require a reasonably sized window to be meaningful, so very small MomentumPeriod values may make the drift noisy.

Where it may underperform. Expect weaker behavior during low-volatility consolidation, around major news releases (where spreads widen and gaps occur), and on illiquid instruments where the spread gate frequently blocks entries. As always, historical behavior in a backtest may not carry into live conditions.

Risk Management Tips

Risk management matters more than any single entry rule. Consider these general principles as part of your education:

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