Strategy #4: A Mean-Reversion Strategy Using Linear Regression
Simple yet effective strategy to potentially profit from pullbacks.
Is the market overextended?
Are you looking for a way to capitalize on short-term dips?
What if you could use a simple but unique indicator to spot these opportunities?
In this post, we'll dive into a mean-reversion strategy that uses the linear regression slope to identify potential "hooks" for profitable entries. I will explain how the linear regression slope works, while sharing a very simple strategy, with profitable results.
The Problem…
Many traders struggle to identify high-probability mean-reversion setups. Overcomplicated indicators and lagging signals often lead to missed opportunities or, worse, false signals that result in losses.
Finding a simple, reliable, and easy to understand strategy is the key.
Strategy Overview
This strategy focuses on capturing short-term pullbacks using a "hook" formation identified by the linear regression slope.
I am also going to show you two completely different exits that work for both Sp500 and Nasdaq100.
Here's the core strategy
Entry:
Look for a specific pattern in the 3-period linear regression slope.
Ensure the current day's close is lower than the open, indicating a potential down day.
If both conditions are met, enter a long position.
Exit variants:
Exit the trade when the price closes above 5-period moving average.
Exit the trade when the close is above the typical price.
The strategy is built on identifying a "hook" in the 3-period linear regression slope.
So how do we define a hook?
Here's a step-by-step breakdown:
1. Calculate the 3-period linear regression slope of the typical price.
2. The "hook" is defined as follows:
The current day's linear regression slope is higher than yesterday's.
Yesterday's linear regression slope is lower than the day before yesterday 's.
3. Add this entry filter on top: the current day's candle is red.
4. If all the above conditions are met, enter a long position at market.
You can use this extra parameter but in my opinion, it’s not necessary:
Avoid trading on Fridays to potentially reduce exposure to weekend market gaps.
Why It Works
This strategy aims to capitalize on mean reversion through momentum exhaustion. The linear regression slope helps identify short-term trends, and the "hook" formation detects when the move has lost momentum and may likely pullback. The ATR-based bands provide a dynamic framework for profit exit and stopping out when the market moves against the position.
Are you ready for the backtest?
Here is the setup:
Market: USA500 (Futures)
Contract: 50 $ per point
Broker: IG
Testing Environment: ProRealtime 12
Timeframe: Daily
Time Zone: CET
Backtest Period: 2000-2025
Fees/Commissions: 1 Point Spread
And this is the performance stats:
Total Gain: 26 025 $
Average Gain: 74 $
Total Trades: 348
Winners: 241
Losers: 107
Max Drawdown: -4 366 $
Risk/Reward Ratio: 0.72
Total Time in the Market: 14.34%
Average Time in the Market: 2 days, 16 hours
CAGR (20 000 $ starting capital): 3.26%
Earlier this month I published a list of some example exits for mean-reversion strategies so why not try one to see how the strategy looks like with another exit.
Here is the equity curve with the new exit:
Also, I want to try this strategy on some NQ futures to see how it performs.
Here it is on NQ Futures:
As you can see this strategy works with multiple different exits and on multiple indices, feel free to try some more combinations and let me know if you find anything interesting.
ProRealTime Code
Here's the ProRealTime code with added ATR based dynamic sizing:
//------------------------------------------------------------------
// Concept: Mean-reversion with a linear regression slope hook
// Market: NASDAQ, SP500
// Direction: Long only
// Timeframe: Daily
// Timezone: CET
// Versions: v.1 | By: Algomatictrading.com | 2024-02-01 | OOS since: 2021-01-01
// Versions: v.2 | Changed exit condition, + Close > Moving Average[5] | 2025-05-26
//------------------------------------------------------------------
defparam preloadbars = 5000
defparam cumulateorders = false
// POSITION MANAGEMENT
//------------------------------------------------------------------
timeframe (daily)
atr = Averagetruerange[5] // ATR based on True Range
//Dynamic Position Sizing
// User Inputs
riskPercent = 2 // Risk percentage for position sizing
portfolioSize = 20000 // Default portfolio size
// ATR calculation period
contractsToTrade = 1 // Number of contracts to trade
// Position Sizing Calculation
portfolioEquity = Max(PortfolioEquity, portfolioSize) // Use real equity or default portfolio size
contractsToTrade = (riskPercent / 100) * portfolioEquity / (atr * PointValue)
timeframe (default)
// INDICATORS
//------------------------------------------------------------------
lrs = linearregressionslope[3](typicalprice)
ma = average[5]
// TRADING CONDITIONS
//------------------------------------------------------------------
// Long - Enter
// ------------------
cl = close < open
cl = cl and lrs > lrs[1]
cl = cl and lrs[1] < lrs[2]
// Long - Exit
// ------------------
cl1 = close > ma //Exit Variant 1
cl2 = close > typicalprice //Exit Variant 2
// TRADING ACTION
//-------------------------------------------------------------------
// Enter
// ------------------
if cl then
buy contractsToTrade contract at market
endif
// Exit
// ------------------
if longonmarket and cl1 then //Change cl1 to cl2 or cl3 for another exit
sell at market
endif
Disclaimer: I am not a financial advisor. This article is for informational and educational purposes only. Trading involves risk, and you can lose money. Always do your own research.
Nice setup! I really like the idea of using the 3-period linear regression slope "hook" — simple but powerful. The red candle filter makes a lot of sense too, catching that momentum exhaustion.
Your exit variations are solid, and the performance stats are pretty impressive for a mean-reversion daily strategy — especially with only 14% market exposure and 3.26% CAGR.
Might try testing this with a RSI-based exit or ATR bands on my side. Thanks for sharing!
Same question, how would one calx the linear regression slope