Blog / Strategy
Strategy

Mann Kendall Trend Confirmation

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 Mann Kendall Trend Confirmation strategy is a trend-following system for MetaTrader 5 that uses the Mann-Kendall test — a nonparametric, rank-based statistic borrowed from environmental science and hydrology — as its core trend filter. Instead of relying on a moving-average slope or an ordinary least-squares regression line, this approach asks a very specific statistical question: is the recent sequence of closing prices rising or falling more consistently than random chance would allow? Because the test looks only at the order of prices rather than their magnitude, a few outlier candles cannot manufacture a fake trend or mask a genuine one.

The strategy is designed for trending market conditions on liquid instruments such as major forex pairs or metals. It pairs the statistical trend filter with a classic pullback-and-reclaim entry pattern and an ATR-based risk framework, so it only looks for entries when a monotonic trend has been statistically confirmed and price offers a shallow retracement to enter on. This combination of a rigorous trend gate plus a defined entry trigger is intended to reduce the tendency to chase already-extended moves.

As a learning tool, this strategy is well suited to intermediate traders who want to understand how statistical significance testing can be applied to price data. You will learn how rank-based statistics differ from conventional indicators, how a z-score threshold controls signal selectivity, and how to combine a trend filter with volatility-adjusted stops. It is framed here as a study in strategy design and market analysis, not as a profit opportunity.

How It Works

The strategy processes only completed bars on a single timeframe (the chart's current period). On each new bar it recomputes the Mann-Kendall statistic and evaluates its entry and exit rules.

Building the trend signal:

Long entry — the strategy signals a buy when all of the following hold:

Short entry — the strategy signals a sell when the mirror conditions hold:

Stop-loss logic:

Take-profit logic:

Early exit on trend reversal:

Mann Kendall trend confirmation EA
Illustrative example of the strategy’s entry and exit logic — not real trading results.

Strategy Parameters

Parameter Default Min Max Description
MkPeriod 20 8 40 Number of completed closes fed into the Mann-Kendall test. Larger values smooth the trend read and react more slowly; smaller values are more responsive but noisier.
ZThreshold 1.64 0.80 3.00 Significance threshold on the absolute z-score. Roughly 1.28 ≈ 90%, 1.64 ≈ 95%, 2.33 ≈ 99% one-sided confidence. Higher values demand stronger, rarer trends.
AtrPeriod 14 5 30 Number of bars used to calculate the ATR that sizes the stop-loss.
AtrStopMult 1.5 0.5 4.0 Stop distance as a multiple of ATR. Higher values give wider stops and more breathing room.
RewardRiskRatio 1.8 1.0 4.0 Take-profit distance as a multiple of the stop distance. A value of 1.8 targets 1.8 units of reward for every 1 unit of risk.
Lots 0.10 0.01 1.0 Fixed order volume in lots. Should be adjusted to your account size and risk tolerance.
Mann Kendall trend confirmation EA — MQL5 source code

Recommended Chart Settings

The strategy was designed with trending forex pairs and metals in mind — for example EURUSD or XAUUSD (gold) — on intermediate timeframes such as M30 to H4. These timeframes tend to produce sustained directional moves that the Mann-Kendall test can identify while filtering out much of the intrabar noise found on very low timeframes.

Because the timeframe is never hardcoded, the EA runs on whatever period the chart is set to. That flexibility means you should test carefully: results will vary considerably across different symbols, timeframes, and market regimes. A setting that historically suited one instrument may behave very differently on another.

How to Install on MetaTrader 5

What to Consider Before Using This EA

Strengths of this approach. The Mann-Kendall test is genuinely robust to outliers because it evaluates only the ordering of prices, not their size. A single spike candle — common around news events — cannot fabricate a trend signal the way it can distort a moving-average slope. The z-score threshold also gives you a clear, statistically meaningful dial for how selective you want to be. The pullback-and-reclaim entry adds structure, so the strategy waits for a retracement rather than buying at the top of an extended run, and the ATR-based stop adapts to changing volatility automatically.

Known limitations. Like all trend-following systems, this strategy is designed for trending conditions and may underperform in ranging or choppy markets, where the z-score rarely reaches significance or where confirmed trends reverse quickly. Because it acts only on completed bars and requires a specific two-bar pullback-reclaim pattern, valid trends may pass without ever producing a qualifying entry. The one-sided z-score reasoning assumes a reasonably continuous price series; unusual gaps, thin liquidity, or highly mean-reverting instruments can weaken the signal. Finally, a fixed reward-to-risk target means take-profits may be hit before a large trend fully matures, or missed entirely if price reverses before reaching the target.

Market conditions where it may struggle. Extended sideways consolidation, low-volatility regimes, and violently whipsawing markets are the classic weak spots for statistical trend filters. The early-exit-on-reversal rule helps limit exposure when a trend genuinely flips, but it can also close positions prematurely during a deep but temporary retracement.

Risk Management Tips

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