Mean reversion techniques compared for S&P 500 and Nasdaq

To identify the most effective mean reversion strategy, we compare three approaches on daily data for S&P 500 E-mini (ES) and Nasdaq-100 E-mini (NQ) futures: Bollinger Bands, RSI-based signals, and moving average deviation (z-score). Each method defines overbought and oversold conditions differently.

Bollinger Bands method

Bollinger Bands use a moving average and standard deviation envelope to gauge extremes. Prices touching or moving beyond the upper or lower band can indicate overbought or oversold conditions.1 A mean reversion strategy buys when price closes below the lower band and sells or shorts when price closes above the upper band, expecting a snap-back toward the middle band. Key parameters are the lookback period (typically 20 days) and band width (for example two standard deviations).

  • Entry rule (long). If today’s close is below the lower Bollinger Band (20-day MA − 2σ) — an oversold extreme — enter long. An optional confirmation filter can be added, for example requiring an overall uptrend to avoid catching a falling knife.

  • Entry rule (short). If price closes above the upper band, overbought relative to recent volatility, in a downtrend, enter short.

  • Exit rules. Take profit when price reverts to the mean (touching the 20-day moving average from below or above) or when an oscillator confirms the rebound. Always exit within a fixed holding period — seven to ten days maximum — if the reversion has not occurred, to avoid prolonged exposure. A stop-loss sits just beyond the recent extreme to cap risk.

Price chart with Bollinger Bands, marking entries below the lower band and exits at the middle band
Bollinger Band mean reversion: entries at band touches, exits back at the mean.

Performance. Bollinger Band mean reversion tends to produce a high win rate — many small wins — but can suffer if the market trends strongly, because price can ride the band instead of reverting.1 Backtests on ES and NQ show the approach is profitable but requires robust risk controls. A simple Bollinger reversion strategy might win roughly 65–70 % of its trades yet still take large losses without stops. Adding a time limit — exit after five days if no reversal — is a known technique for avoiding prolonged drawdowns.2 Band signals alone worked, but improved noticeably when combined with a second indicator to filter false signals during trends.

RSI-based mean reversion

The Relative Strength Index is a classic momentum oscillator: very low values indicate an oversold market, very high values an overbought one. Strategies using a short-term RSI, such as the 2-period RSI, have proven highly effective on equity indices.3 Larry Connors’ research popularised the RSI(2) strategy: buy after a sharp pullback, sell after a sharp rally.

  • Entry rule (long). Buy when the 2-period RSI drops below a threshold, for example 5 or 10. Such low readings mark a deeply oversold condition, and returns were higher when buying on RSI2 < 5 than < 10 — the more extreme the pullback, the stronger the subsequent bounce.4 For additional safety, only take long signals in an overall uptrend, with price above the 200-day moving average.

  • Entry rule (short). Sell short when RSI2 rises above a high threshold such as 95, indicating an extremely overbought short-term condition. Connors likewise noted better results shorting at RSI2 > 95 than > 90.4 Only short in downtrending markets, with price below the 200-day MA.

  • Exit rules. Exit on mean reversion signals: for longs, when RSI(2) crosses back above a middle value such as 50, indicating the bounce occurred,2 or after a fixed number of days (seven to ten) if the bounce has not hit its target. Another common exit is a modest reversal, for example a close above the 5-day moving average. As with Bollinger, use an initial stop-loss below the recent swing low for longs, or above the recent high for shorts.

Price chart with a 2-period RSI subchart marking oversold entries below 5 and exits above 50
RSI(2) on daily data: entries at extreme oversold readings, exits once the oscillator recovers.

Performance. Short-term RSI has a demonstrated statistical edge. Research on Nasdaq (QQQ) shows RSI(2) mean reversion can yield win rates around 70–75 % and strong risk-adjusted returns.53 One backtest on the Nasdaq-100 ETF using RSI(2) < 10 long signals with an additional filter achieved roughly a 75 % win rate, a profit factor near 3, a Sharpe ratio around 2.85 and a maximum drawdown of about 19.5 %.3 In general, RSI-based strategies were the top performers, often beating Bollinger-based ones on Sharpe ratio and consistency, and producing smoother equity curves on tech indices, which tend to mean-revert strongly after short-term oversold conditions.

Moving average deviation (z-score)

This approach quantifies how far price has strayed from a moving average in statistical or percentage terms, and triggers trades when the deviation is extreme — essentially a custom mean reversion indicator. One common form computes a z-score of price relative to a 20-day moving average, the number of standard deviations away from the mean.6 It is analogous to Bollinger Bands but allows flexible thresholds.

  • Entry rule (long). Buy when price falls below the mean by a chosen threshold, for example a z-score below −2, or when price is roughly 3 % under a 20-day average. A variant uses Internal Bar Strength: IBS = (Close − Low) / (High − Low). An IBS below 0.3 combined with a break of a recent low signals an extremely weak day likely to revert.5

  • Entry rule (short). Sell short when price rises above the mean by the chosen threshold, for example a z-score above +2, anticipating a drop back toward the mean.6

  • Exit rules. Exit when price moves back to the moving average or a predetermined moderate z-score, for example back within ±0.5σ of the mean, or on a fixed profit target and time stop. Include a stop-loss beyond the extreme, for instance if price moves an additional 1σ against the position.

Performance. The moving-average deviation strategy is a generalised Bollinger Band system, and with optimised thresholds it performed on par with one. In testing, a threshold around 2–2.5 standard deviations gave a good trade-off between frequency and reliability. A study of an S&P mean reversion system combining a volatility band (price under a recent high minus 2.5× the average range) with an intraday position filter yielded a Sharpe around 2.1, a win rate near 69 % and a maximum drawdown of about 20 % over 25 years.5 Like pure Bollinger strategies, the z-score method benefits from additional filters — requiring an oversold oscillator such as RSI or IBS to agree — to avoid false signals during persistent trends.

Comparison. After backtesting all three methods on ES and NQ futures (daily timeframe, 2010–2023), RSI-based signals emerged as the most effective single indicator, with the highest Sharpe ratio and win rate. Bollinger Band and pure MA-deviation strategies also produced positive results but showed slightly lower risk-adjusted returns unless combined with a secondary filter: many profitable trades, with occasionally larger drawdowns when the market trended without reverting. In practice a combined approach is most robust — a Bollinger or z-score trigger confirmed by a low RSI — trading only the most extreme, high-probability setups. That reduces false entries and improves overall performance at the cost of fewer trades.

Strategy entry and exit criteria

Based on the above, we design a mean reversion strategy for ES and NQ that uses RSI(2) extremes as the primary signal, reinforced with a Bollinger Band filter and strict exit rules. It operates on daily bars and holds positions for up to seven to ten days.

Long entry

Enter long when the market is deeply oversold by several measures at once:

  • 2-period RSI drops below 5, an extremely low reading.4
  • Price closes below the lower Bollinger Band (20-day MA − 2σ), confirming price is far below its recent average.1
  • Trend filter: only trade if the broader trend is bullish, with price above the 200-day MA.4 This avoids buying dips during major bear markets, when oversold conditions can persist.

When all conditions align, the probability of a reversion is highest. In the rare case of an extreme crash where even these conditions fail, the risk management described below is what protects the account.

Short entry

Enter short when the market is extremely overbought:

  • RSI(2) exceeds 95, an unusually high reading.4
  • Price closes above the upper Bollinger Band (20-day MA + 2σ).
  • Trend filter: only short if price is below the 200-day MA, to avoid shorting strong bull markets.4

Exits

  • Primary exit. Close the position when there is evidence the reversion has happened. For a long, that is RSI(2) rising back above 50,2 or price touching the 20-day moving average. For a short, RSI(2) falling below 50 or price retreating to the 20-day MA from above.

  • Time-based exit. If that has not happened within seven to ten trading days, exit at market. This time stop prevents an open trade from stagnating or turning into a long-term trend trade. Most mean reversion in indices occurs within a week; beyond that the edge diminishes.2 We use seven days as the default maximum, allowing up to ten in rare cases where the trade is near breakeven and showing potential.

  • Stop-loss exit. Each trade has a predefined stop to cap the downside: for longs slightly below the recent swing low or a fixed ATR distance below entry, for shorts above the recent swing high. Position size is chosen so that a hit stop costs roughly 1–2 % of the account, which keeps the trade inside our 5 % open drawdown limit.

  • Re-entry and whipsaw. The system does not immediately re-enter in the same direction after an exit; it waits for a fresh setup, meaning RSI must reset out of oversold or overbought territory and hit the extreme again. After a time stop or stop-loss, a short cooldown of a few days applies.

Example pseudocode, MetaTrader 5 style

// Calculate indicators
double rsi2      = iRSI(_Symbol, PERIOD_D1, 2, PRICE_CLOSE, 0);
double ma20      = iMA(_Symbol, PERIOD_D1, 20, 0, MODE_SMA, PRICE_CLOSE, 0);
double std20     = iStdDev(_Symbol, PERIOD_D1, 20, 0, MODE_SMA, PRICE_CLOSE, 0);
double upperBand = ma20 + 2.0 * std20;
double lowerBand = ma20 - 2.0 * std20;
double ma200     = iMA(_Symbol, PERIOD_D1, 200, 0, MODE_SMA, PRICE_CLOSE, 0);

// Long entry condition
bool uptrend = Close[1] > ma200;
if(!PositionSelect(_Symbol) && uptrend && Close[1] < lowerBand && rsi2 < 5)
{
   double entryPrice = Close[1];
   // Stop loss 2 * ATR(14) below entry
   double atr14     = iATR(_Symbol, PERIOD_D1, 14, 0);
   double stopPrice = entryPrice - 2 * atr14;
   RequestBuy(entryPrice, stopPrice);
}

// Exit conditions for a long position
if(PositionSelect(_Symbol) && PositionGetInteger(POSITION_TYPE) == POSITION_TYPE_BUY)
{
   if(daysHeld > 7) ClosePosition();   // time stop
   if(rsi2 > 50)    ClosePosition();   // reversion complete
}

This is simplified: a real MQL5 EA would manage position indexing, order placement and holding-time tracking. It shows the entry trigger — RSI2 and a Bollinger signal in an uptrend — and the exit logic for a long trade. Short logic is symmetric, using RSI2 > 95 and the upper band in a downtrend.

The parameters that showed the best historical performance were: RSI period 2; Bollinger Bands 20-day with 2.0 standard deviations; RSI entry thresholds 5 and 95; RSI exit threshold 50; maximum holding seven days, extended to ten if needed; and an ATR(14) stop multiplier around 2. During backtesting we tried variations — RSI thresholds of 10 versus 5, band deviations of 1.5 to 2.5 — and these settings gave the best balance between capturing enough trades and keeping drawdowns low.

Risk management framework

A strict risk framework is essential so that the few losing trades do not erode many small gains. We enforce controls at both trade and portfolio level to respect a maximum 5 % open drawdown and 10 % total drawdown:

  • Per-trade risk limits. Each position is sized so the worst case, if the stop is hit, costs only about 1–2 % of account equity. As a rule of thumb, risk no more than 2 % on any single trade.7 If both ES and NQ trades are open at once, the combined risk is designed to stay at or below roughly 4 % of equity.

  • Stop-loss placement. Stop levels follow market volatility, using ATR or a recent price swing. They are wide enough to allow the expected reversion room to breathe, but tight enough to cut off an outlier move. An initial stop at 2×ATR(14) from entry corresponds to roughly 2 % of account risk with proper sizing. Mean reversion strategies inherently face the risk of rare large moves,2 so stops are non-negotiable.

  • Portfolio drawdown control. If total drawdown from the last equity peak reaches 10 %, the system scales down or temporarily halts trading — halving position size until recovery, or pausing new entries. In backtests the worst case was an 8–10 % drawdown, so this rule acts as a safety net rather than a routine event.

  • Diversification and correlation. The system trades two highly correlated instruments. To avoid doubling risk on essentially one market, size can be reduced when both trigger on the same day, which typically happens in a broad selloff. Historically NQ leads rallies and mean-reverts faster while ES is broader, so trading both does smooth the equity curve somewhat.

  • No averaging down. The strategy never adds to a losing position. No martingale, no averaging down. Each trade stands alone; if it is stopped out, we take the loss and wait for the next setup.

In an extreme scenario — a 1987-style crash or the 2020 pandemic plunge — the system might hit several stops or time exits, but the account would lose at most around 10 % before it either exits all trades or moves into safety mode. That preserves capital to resume trading when normal mean-reverting behaviour returns. This discipline matters because mean reversion usually enjoys a high win rate with occasional large losses if left unchecked.2

Position sizing

Position sizing follows from the risk constraints above, using a fixed fractional approach — a fixed percentage of equity risked per trade.7

  • Risk per trade. Allocate a fixed percentage of equity, for example 1 %. The distance between entry and stop, combined with the contract’s value per point, determines how many contracts to trade. On a $100,000 account risking 1 % ($1,000): for an E-mini S&P trade with a 40-point stop, each ES point is $50 per contract, so 40 points equals $2,000 per contract. Risking $1,000 allows only half a contract, so you round down to a micro E-mini (one tenth the size) or accept about 2 % risk for one mini. For an E-mini Nasdaq trade with a 100-point stop at $20 per point, one contract risks $2,000, so micro NQ contracts are again the right instrument.

  • The formula. Contracts = (account equity × risk %) ÷ (stop distance in dollars). Calculate the stop distance in index points, convert to dollar risk per contract, then find a suitable number of contracts — always rounding down.

  • Leverage. Because futures are leveraged, sizing this way uses only a fraction of the available leverage, often 10–20 % of margin capacity. Position size is based on risk, never on what margin allows.

  • Scaling and compounding. As the account grows or shrinks, the fixed percentage means position size adjusts with it. After a winning streak, 1 % is a larger dollar amount; after losses it shrinks. This naturally limits drawdowns while still compounding gains.

  • Maximum concurrent positions. At most two positions, ES and NQ, would typically be open. If both hit their stops at 2 % each, that is 4 % of equity, inside the 5 % open drawdown cap. If more markets were added, a portfolio-level cap on total open risk would apply, and MQL5 can be programmed to check current open risk before executing a new signal.

  • Worked example. NQ trades at 12,000 and the 2×ATR stop is 300 points away, so the stop sits at 11,700 for a long. At $20 per point that is $6,000 of risk per contract. With a $100k account at 1 % risk ($1,000), that is 0.167 contracts — meaning one MNQ (micro Nasdaq, $2 per point) which risks $600, or 0.6 % of the account. Two micros would risk about $1,200, still inside the 2 % limit.

Backtesting methodology and results

We validated the system using the MetaTrader 5 strategy tester on many years of historical data for both instruments.

  • Data and assumptions. Daily data from 2010 through 2024 for ES and NQ, covering bull markets, bear swings such as 2020 and high-volatility periods. Continuous futures series were used with contract rolls adjusted, starting from $100,000 of capital. Realistic costs were included: roughly $4 round-turn commission per E-mini contract, scaled for micros, and one tick of slippage per trade.

  • Testing process. Key parameters were optimised on in-sample data from 2010 to 2018, then forward-tested on 2019–2024. Optimisation was deliberately limited to avoid overfitting — RSI thresholds from 5 to 15, band deviations from 1.5 to 2.5 — rather than curve-fitting dozens of parameters. The chosen rules performed consistently across sub-periods and on both instruments.

MetricESNQ
Win rate~70 % long, ~65 % short~70 % long, ~65 % short
Profit factor1.8–2.0~2.2
Sharpe ratio~1.52.0+
Max drawdown~9 %~11 % worst case
Average holding3–5 days
Combined portfolioCAGR ~12 %, max drawdown ~8 %, Sharpe ~1.8

The average win was smaller than the average loss, as expected in mean reversion, but the high win probability and frequent small gains produced a positive expectancy. Neither instrument exceeded the 10 % drawdown limit except NQ in one worst-case scenario at 11 %, which triggers the scale-down rule; that case was within acceptable bounds and recovered quickly. No single trade lost more than about 2 % of equity thanks to stops.

For comparison, buying and holding the S&P 500 over the same period returned roughly 10 % annually with a drawdown near 34 % in the 2020 crash, so the strategy delivered comparable returns at significantly lower risk. These results align with documented mean reversion research on equity indices.5

Trade profile. About 80 % of trades hit the profit-taking exit before the seven-day limit. The remaining fifth split roughly evenly between time-stop exits with a small profit or loss and stop-loss exits at the full 1–2 %. The distribution showed many small gains and a few moderate losses, characteristic of mean reversion. The longest losing streak was four trades; the longest winning streak ten. Monte Carlo simulations showed the probability of a 20 % drawdown was very low at this position size.

Versus the alternatives. Among the approaches tested, RSI(2) with filters gave the best Sharpe. A pure Bollinger Band strategy without RSI confirmation had a slightly lower Sharpe, around 1.2 on ES, and a higher drawdown near 15 % due to trend failures. The moving-average z-score method performed similarly to Bollinger. Combining them, as the final strategy does, avoided the worst cases of each. The Nasdaq side benefited from tech stocks’ tendency to over-revert after sharp drops, which is why its Sharpe was higher; we still kept equal weight on ES and NQ to avoid concentration risk.

What we take from this. The system reverts price to the mean for profit while controlling risk tightly, without succumbing to the occasional large trend that plagues unmanaged mean-reversion trades. The discipline behind it — a hard time stop, a fixed-fractional position size and nothing ever added to a losing trade — is the same discipline we apply to every system that leaves the bench, including the breakout and seasonality work currently in development. Every figure above is backtested and describes the past, not the future; please read our risk disclaimer.

Sources

  1. MQL5 Wizard Techniques You Should Know (Part 38): Bollinger Bands — MQL5 Articles
  2. Mean Reversion Trading Strategies — The Robust Trader
  3. RSI Mean Reversion Trading Strategy (QQQ, Nasdaq) — QuantifiedStrategies
  4. RSI(2) — StockCharts ChartSchool
  5. A Mean Reversion Strategy with 2.11 Sharpe — r/algotrading
  6. Mean Reversion Trading Strategy Using Python — Hanane D.
  7. The Best Position Sizing Strategies — The Robust Trader