Blog / Strategy
Strategy

Pearson Correlation Trend Shift

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?

Pearson Correlation Trend Shift is a trend-emergence trading strategy built on the Pearson correlation coefficient measured between price and time — the same idea behind John Ehlers' well-known Correlation Trend Indicator (CTI). Instead of asking "how fast is price moving?", this indicator asks a subtly different question: "how consistently is price moving in a straight line?" The strategy uses this reading to detect the moment a clean, orderly trend begins to emerge from choppy, directionless price action, and it trades that shift in both directions — long and short.

The core mechanic is straightforward. Over a lookback window of N bars, the strategy calculates the correlation r between the closing prices and a rising time ramp (0, 1, 2, … N-1). Because correlation is covariance divided by the product of the two standard deviations, r is always bounded between −1 and +1 and is completely scale-free. A reading near +1 means price is climbing along a near-perfect straight line (a clean uptrend), a reading near −1 means it is falling along a straight line (a clean downtrend), and a reading near 0 means price is wandering with no linear direction (range, chop, or cycle). Crucially, this behaves the same across every symbol and timeframe without any per-market tuning, because it measures linearity rather than magnitude.

As a learning tool, this strategy is well suited to traders who want to understand the difference between momentum and trend quality. A regression slope tells you how quickly price is moving and grows with volatility; correlation tells you how orderly the move is regardless of how big it is. A slow, tidy drift and a fast, tidy run both read near ±1, while a violent but erratic market reads near 0. Studying how the strategy responds to those situations is a useful way to build intuition about when a trend is genuinely "real" versus merely fast and noisy.

How It Works

The strategy acts only once per completed bar. On each new bar it recomputes the price-vs-time correlation r, compares it to the previous reading to detect a fresh threshold cross, and then applies its entry, exit, and reversal logic. Using a fresh cross (rather than simply "r is above a level") fires discrete, one-time entries instead of re-triggering every tick, which filters out low-correlation chop and produces fewer, cleaner signals.

Entry conditions:

Exit and reversal conditions:

Stop-loss and take-profit logic:

While a position is open and neither a reversal nor a decay exit is triggered, the trade is simply left to be managed by its ATR stop and target.

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

Strategy Parameters

Parameter Default Min Max Description
CorrPeriod 20 8 60 Number of bars in the Pearson correlation window. Shorter values react faster to emerging trends but are noisier; longer values are smoother and slower.
EntryThreshold 0.55 0.30 0.90 The correlation level a fresh cross must reach to signal a trade. Higher values demand a cleaner, more linear trend before entering.
ExitThreshold 0.20 0.00 0.60 The consistency-decay level. When correlation falls back toward this band, the strategy exits because the linear structure has weakened.
AtrPeriod 14 7 30 Lookback period for the ATR volatility measure used to size the stop-loss and take-profit.
SlAtrMult 2.0 1.0 4.0 Stop-loss distance as a multiple of ATR. Larger values give trades more room but risk more per trade.
TpAtrMult 3.0 1.0 6.0 Take-profit distance as a multiple of ATR. Sets the profit target relative to volatility.
Lots 0.10 0.01 1.0 Fixed trade volume in lots. Should be adjusted to match your account size and risk tolerance.
Pearson correlation trend MT5 EA — MQL5 source code

Recommended Chart Settings

Because the correlation coefficient is inherently scale-free, this strategy is designed to behave consistently across a wide range of symbols and timeframes without re-tuning. A sensible starting point for study is a major forex pair such as EUR/USD on the H1 (1-hour) timeframe, which offers a balance between signal frequency and noise. Traders exploring the strategy may also examine it on H4 or daily charts for slower, more deliberate signals, or on lower timeframes for more frequent activity.

Keep in mind that results will vary meaningfully across different market conditions. A window and threshold combination that produces clean signals during a trending period may generate frequent whipsaws during a prolonged range. Always test any settings on historical data and a demo account before considering live use.

How to Install on MetaTrader 5

What to Consider Before Using This EA

Strengths of this approach. The Pearson correlation is an elegant, robust way to distinguish orderly trends from noise, and its scale-free nature means it does not need to be re-calibrated for each instrument's price level or volatility. The fresh-cross entry logic keeps the strategy from over-trading in flat markets, and the dual exit system — reversal plus consistency decay — gives it a principled reason to leave a trade before the stop is hit when a trend loses its linear character. The always-on ATR stop and target impose disciplined, volatility-adaptive risk control on every position.

Known limitations. Correlation measures linearity, not profitability. A market can climb along a beautifully straight line and then reverse the moment the strategy enters, and correlation reacts to price rather than predicting it. Like all trend-following logic, this approach is prone to whipsaws in choppy, range-bound conditions, where r can flicker across the threshold and generate a cluster of losing entries. The exit-and-reverse behaviour can compound losses during a sideways market that repeatedly fakes trend emergence in alternating directions. The fixed lot size does not scale risk to account equity, and the strategy holds only one position at a time, so it will sit out further moves while managing an existing trade.

Where it may underperform. Tight, low-volatility ranges and news-driven spike environments are the hardest conditions for this indicator. Because it acts once per completed bar, it can also be slow to react to sudden reversals that unfold within a single bar. Treat it as a framework for studying trend-quality measurement, not as a finished, all-weather system.

Risk Management Tips

Sound risk management matters far more than any single indicator. Consider the following general principles as you study this 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