Blog / Strategy
Strategy

Regression Slope Momentum

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?

Regression Slope Momentum is a trend-momentum trading strategy that reads market direction from the slope of a linear regression line — a least-squares "line of best fit" drawn through the most recent closing prices. Instead of reacting to a single candle or a simple moving-average crossover, it measures how steeply price has been trending over a fixed window of bars, then converts that steepness into a momentum reading you can compare against a fixed rule.

The key idea is volatility adjustment. The raw regression slope tells you the average price change per bar, but a slope of "5 pips per bar" means something very different on a quiet range day than on a fast-moving news day. To handle this, the strategy divides the slope by the Average True Range (ATR) — a standard measure of recent volatility — producing a normalized reading expressed in "ATR per bar." A signal only fires when this normalized slope freshly crosses a threshold, which filters out weak, choppy conditions and only acts when momentum genuinely accelerates in one direction.

As a learning tool, this approach suits traders who want to study trend-following and momentum concepts in a systematic, rules-based way. It is designed for trending markets and deliberately stays out of low-slope, sideways conditions. Because the logic is transparent and every parameter is exposed, it is a useful example for understanding how regression, volatility normalization, and discrete signal generation fit together. It is not designed for scalping or for ranging markets where price lacks a clear directional slope.

How It Works

The strategy evaluates its rules once per completed bar — it does not react to every tick — which keeps signals stable and repeatable. Here is the logic in plain English:

Stop-loss logic: When a trade opens, the stop-loss is placed at SlAtrMult × ATR away from the entry price — below entry for longs, above entry for shorts. Because it is tied to ATR, the stop automatically widens in volatile conditions and tightens in calm ones.

Take-profit logic: The take-profit is placed at TpAtrMult × ATR from entry in the direction of the trade. With the default settings (stop at 2× ATR, target at 3× ATR), the strategy aims for a reward-to-risk profile of roughly 1.5:1.

Position sizing: Trade size is volatility-targeted and equity-scaled. A volatility factor shrinks the position when current ATR rises above the baseline captured at startup, helping keep per-trade risk steadier when markets get fast. An equity factor lets size grow as the account balance compounds. The final volume is clamped to a sensible band around the base size and rounded to the broker's allowed lot step.

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

Strategy Parameters

Parameter Default Min Max Description
RegPeriod 20 8 60 Number of closing prices in the regression window. Larger values smooth the slope and react more slowly; smaller values are more responsive but noisier.
SlopeThreshold 0.05 0.01 0.30 The normalized-slope trigger level (in ATR per bar). Higher values demand stronger momentum before a signal fires, producing fewer but more selective trades.
AtrPeriod 14 7 30 Lookback period for the Average True Range used to normalize the slope and to size stops, targets, and position volume.
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 and, together with the stop multiple, the reward-to-risk ratio.
BaseLots 0.10 0.01 1.0 Base position size before volatility and equity scaling are applied.
regression slope momentum MT5 EA — MQL5 source code

Recommended Chart Settings

Regression Slope Momentum is a trend-momentum strategy and generally works best on instruments and timeframes that produce sustained directional moves rather than tight ranges. A common starting point for study is a major forex pair such as EUR/USD on the H1 (1-hour) timeframe, which offers enough bars for the regression window while filtering out much of the noise found on very short timeframes.

That said, the default parameters are a neutral baseline, not an optimized configuration. The regression window, slope threshold, and ATR multipliers all interact with the character of the market you apply them to. Results will vary considerably across different symbols, timeframes, and market conditions, so treat any single setup as a subject for testing rather than a finished recipe.

How to Install on MetaTrader 5

What to Consider Before Using This EA

Every strategy involves trade-offs, and an honest view of both sides helps you learn faster.

Strengths of this approach:

Known limitations:

The sensible path is to study how the strategy behaves in different regimes — trending, ranging, high-volatility, low-volatility — rather than assuming any one setting works everywhere.

Risk Management Tips

Sound risk management matters more than any single entry rule. Keep these general principles in mind 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