4.1.7Trading vs Investing & Styles

Learn mean-reversion trading

2,647 words12 min readdifficulty · medium1 backlinks

Why does this work? Markets overshoot due to herd behavior and emotion. A bad earnings report causes panic selling below fair value. A hot product launch causes euphoric buying above fair value. The mean (average price) acts as gravity, pulling price back over time.


What is Mean-Reversion Trading?

Key Components:

  • Mean (Average): Typically the moving average (MA) — e.g., 20-day MA, 50-day MA, or Bollinger Band midline.
  • Deviation Measurement: How far price is from the mean (standard deviations, RSI, Bollinger Bands).
  • Entry Signal: Price crosses below lower threshold → BUY. Price crosses above upper threshold → SELL/SHORT.
  • Exit Signal: Price returns to the mean or crosses it.

WHY the mean? Historically, most stocks oscillate around a trend. If a stock normally trades at ₹100 and drops to ₹80 on no fundamental change, probability favors a return toward₹100.


Deriving the Mean-Reversion Logic

Step 1: Define the Mean

The mean is the expected value of price over a lookback period. For simplicity, use the Simple Moving Average (SMA):

SMAn=1ni=0n1Pti\text{SMA}_n = \frac{1}{n} \sum_{i=0}^{n-1} P_{t-i}

where PtP_t is price at time tt, and nn is the lookback period (e.g., 20 days).

Why SMA? It smooths out noise and represents the "fair value" consensus over nn days.

Step 2: Measure Deviation

How far is current price PtP_t from the mean?

Deviation=PtSMAn\text{Deviation} = P_t - \text{SMA}_n

But absolute deviation depends on asset price (₹10 deviation matters more for₹50 stock than ₹500 stock). So normalize:

z=PtSMAnσnz = \frac{P_t - \text{SMA}_n}{\sigma_n}

where σn\sigma_n is the standard deviation of price over nn days:

σn=1ni=0n1(PtiSMAn)2\sigma_n = \sqrt{\frac{1}{n} \sum_{i=0}^{n-1} (P_{t-i} - \text{SMA}_n)^2}

This zz is called the -score. It tells us how many standard deviations price is from the mean.

Why z-score?

  • z=0z = 0: Price at the mean (no trade).
  • z=2z = -2: Price is 2 std devs BELOW mean → oversold → BUY signal.
  • z=+2z = +2: Price is 2 std devs ABOVE mean → overbought → SELL signal.

Step 3: Entry and Exit Rules

Entry: When z>threshold|z| > \text{threshold} (e.g., 2), enter opposite position:

  • z<2z < -2: BUY (expecting price to rise back to mean).
  • z>+2z > +2: SELL/SHORT (expecting price to fall back to mean).

Exit: When price returns to mean (z0z \approx 0) or crosses it.

Why these thresholds? In a normal distribution, ~95% of data lies within 2 standard deviations. When z>2|z| > 2, price is in the extreme 5%, statistically likely to revert.


Indicators for Mean-Reversion

1. Bollinger Bands

where k=2k = 2 typically (can adjust to 2.5 or 3 for wider bands).

HOW to use:

  • Price touches Lower Band → oversold → BUY.
  • Price touches Upper Band → overbought → SELL.
  • Price returns to Middle Band → EXIT.

WHY works? Bollinger Bands visualize the z-score concept. Bands expand during volatility (large σ\sigma) and contract during consolidation.

Figure — Learn mean-reversion trading

2. Relative Strength Index (RSI)

Typical n=14n = 14 days.

Interpretation:

  • RSI < 30 → oversold → BUY.
  • RSI > 70 → overbought → SELL.
  • RSI = 50 → neutral (no mean-reversion signal).

WHY? RSI compares upward vs downward momentum. Extreme RSI means one-sided pressure that exhausts itself, triggering reversal.

3. Z-Score (Direct Calculation)

As derived above. More flexible than RSI/Bollinger Bands because you control lookback period and threshold.


Worked Example 1: Bollinger Band Trade

Setup: Stock ABC trades at ₹100.20-day SMA = ₹100, 20-day σ\sigma = ₹5. Bollinger Bands with k=2k=2:

  • Upper Band = 100 + 2(5) = ₹110.
  • Lower Band = 100 - 2(5) = ₹90.

Day 1: Price drops to ₹88(below Lower Band).

  • Why this step? Price at ₹88 is 2.4 std devs below mean (z = (88-100)/5 = -2.4). This is extreme. Historical data shows price returns to mean 90%+ of the time from here.
  • Action: BUY 100 shares at ₹88. Risk: ₹2 per share (stop-loss at ₹86 if breakdown continues).

Day 5: Price rises to ₹98 (near Middle Band).

  • Why exit? Mean-reversion assumes return to mean, not continuation. At ₹98, the rubber band has snapped back. Probability of further rise without new catalyst is lower.
  • Action: SELL 100 shares at ₹98. Profit = (98-88) × 100 = ₹1,000.

Why not wait for₹110? Mean-reversion is not momentum. Target is the mean (₹100), not the opposite extreme. Overstaying invites reversal risk.


Worked Example 2: RSI Mean-Reversion

Setup: Stock XYZ at ₹200. RSI(14) = 25 (oversold).

Logic:

  • RSI = 25 means recent losses outweigh gains heavily. Sellers exhausted.
  • Why this step? When RSI < 30, historically 70% of the time price rebounds within 5-10 days (in ranging markets).
  • Action: BUY at ₹200. Set target at ₹210 (where RSI returns to 50, the neutral zone).

3Days Later: RSI climbs to 52, price at ₹208.

  • Why exit? RSI back to neutral = mean-reversion complete. No edge to hold longer.
  • Action: SELL at ₹208. Profit = ₹8 per share.

Risk Management: If RSI drops further (e.g., to 15), it signals a breakdown, not mean-reversion. Stop-loss at ₹195 (if price makes new low despite oversold RSI).


When Mean-Reversion FAILS

Why this feels right: In a ranging market, oversold = opportunity. So you trained yourself: "Oversold = buy."

The Fix: Mean-reversion works in range-bound markets (sideways price action). In trending markets (strong uptrend or downtrend), "oversold" can stay oversold for months. Example: A stock drops from ₹500 to ₹400(RSI = 25). You buy. It drops to ₹300 (RSI still 25). You buy more. It drops to ₹200. You're wiped out.

How to avoid:

  1. Check the trend first. Use 200-day MA: If price is below200-day MA and falling, trend is DOWN. Don't fight it with mean-reversion longs.
  2. Use ADX (Average Directional Index). ADX > 25 = trending market. Skip mean-reversion. ADX < 20 = ranging market, safe for mean-reversion.
  3. Set hard stop-losses. If price makes a new extreme LOW after you bought an oversold signal, exit. Don't double down.

When to Use Mean-Reversion Trading

Best Conditions:

  • Range-bound markets: Price oscillates between support and resistance with no strong trend.
  • High volatility: Large swings create frequent overbought/oversold extremes.
  • Liquid stocks/indices: Tight spreads, low slippage. Examples: Nifty 50 stocks, large-cap US stocks.

Avoid When:

  • Strong trends (up or down): Trend traders make money; mean-reversion traders lose.
  • Low volatility: Small swings → infrequent signals → opportunity cost.
  • News-driven moves: Fundamental change (merger, bankruptcy) → new mean; old mean irrelevant.

Mean-Reversion vs. Momentum Trading

Mean-Reversion Momentum
Buy low, sell high Buy high, sell higher
Bet on reversal Bet on continuation
Works in ranges Works in trends
Contrarian Follow-the-crowd
Shorter holding periods (days) Longer holding periods (weeks/months)

Key Insight: They are opposite strategies. Use the right one for the market regime. In a bull market (momentum regime), don't mean-revert; ride the trend. In a chopy market (range regime), don't chase momentum; trade the bounces.


Example Trade Setup Checklist

  1. Identify the mean: Plot20-day SMA or Bollinger Bands.
  2. Measure extremes: Calculate z-score or check RSI.
  3. Confirm range-bound market: Price between stable support/resistance, no strong trend, ADX < 20.
  4. Entry: Price at extreme (z< -2, RSI < 30, or at lower Bollinger Band).
  5. Position size: Risk 1-2% of capital (calculate from stop-loss distance).
  6. Stop-loss: Below recent low (for longs) or above recent high (for shorts). If price breaks to new extreme, exit.
  7. Target: The mean (SMA, middle Bollinger Band, or RSI = 50).
  8. Exit: At target or if market regime changes (trend emerges).

Recall Feynman Explanation (ELI12)

Imagine you're playing with a yo-yo. When you throw it down really hard, it goes super low, but then the string pulls it back up to your hand, right? That's mean-reversion!

Stock prices are like the yo-yo. Sometimes people panic and sell stock way too cheap (yo-yo goes too low). Sometimes people get excited and buy it way too expensive (yo-yo flies too high). But the "string" is the average price, and the stock usually comes back to that average.

Mean-reversion traders are like kids who catch the yo-yo at the bottom and sell it when it comes back to the middle. They don't wait for it to go to the top — that's risky! They just want the easy bounce back to normal.

The trick? Make sure the yo-yo is attached to a string! If the company is actually going bankrupt, there's no string — the yo-yo just falls and never comes back. So you check: Is this a normal bounce, or is something really broken?


"Don't Fight the Trend, Trade the Range"

  • If ADX > 25, trend is boss. No mean-reversion.
  • If ADX < 20, range is king. Mean-revert away!

Connections

Related Notes:

  • 4.1.01-Trading-vs-investing-core-difference — Mean-reversion is a trading strategy (short-term), not investing.
  • 4.1.05-Learn-momentum-trading — The opposite of mean-reversion; know when to switch strategies.
  • 4.1.08-Learn-technical-indicators — RSI, Bollinger Bands, ADX all used in mean-reversion.
  • 4.2.01-Risk-management-position-sizing — Crucial for mean-reversion: tight stops because you're betting against the current move.
  • 3.2.04-Support-and-resistance-levels — Mean-reversion works best when price bounces off support/resistance in a range.

Broader Context:

  • Mean-reversion is a statistical edge, not a certainty. Markets are mean-reverting 60-70% of the time in ranges, not 100%.
  • Combines well with options strategies (e.g., sell puts when stock oversold, collect premium as it reverts).

#flashcards/stock-market

What is the core assumption of mean-reversion trading? :: Asset prices fluctuate around a long-term average (mean), and extreme deviations are temporary. Prices tend to return to the mean over time.

Why does mean-reversion work in markets?
Markets overshoot due to herd behavior and emotion. Fear or greed pushes prices too far from fair value, but lack of fundamental change means price gravitates back to the average.
What is a z-score in mean-reversion?
z = (Current Price - SMA) / Standard Deviation. It measures how many standard deviations price is from the mean. |z| > 2 indicates an extreme (overbought/oversold).
Bollinger Bands formula for upper and lower bands?
Upper Band = SMA + k·σ, Lower Band = SMA - k·σ, where k is typically 2 and σ is standard deviation over the lookback period. Price at bands signals potential reversal.
When is RSI considered oversold and overbought?
RSI< 30 is oversold (buy signal). RSI > 70 is overbought (sell signal). RSI = 50 is neutral (no mean-reversion signal).
What is the RSI formula?
RSI = 100 - [100 / (1 + RS)], where RS = (Avg Gain over n periods) / (Avg Loss over n periods). Typical n = 14 days.
What is the biggest mistake in mean-reversion trading?
Trading mean-reversion in a trending market. In strong trends, "oversold" can stay oversold indefinitely. Always check for range-bound conditions (ADX < 20, no strong trend) before using mean-reversion.
How do you know if a market is range-bound vs trending for mean-reversion?
Use ADX (Average Directional Index). ADX < 20 = ranging, safe for mean-reversion. ADX > 25 = trending, avoid mean-reversion. Also check if price oscillates between stable support/resistance.
What is your exit target in mean-reversion trading?
The mean (e.g., SMA, middle Bollinger Band, or RSI = 50). Exit when price returns to the average, not when it reaches the opposite extreme.
Where should you set stop-loss in a mean-reversion long trade?
Below the recent low or the point where price makes a new extreme. If price breaks lower after an oversold signal, it indicates a breakdown, not mean-reversion, so exit immediately.
Mean-reversion vs momentum trading key difference?
Mean-reversion bets on reversal (buy low, sell at mean), works in ranges, contrarian. Momentum bets on continuation (buy high, sell higher), works in trends, follows the crowd.

What indicators are best for mean-reversion trading? :: Bollinger Bands, RSI, z-score (direct calculation), and ADX (to confirm ranging market). All measure deviation from mean and identify extremes.

Concept Map

causes

creates

acts as gravity

triggers

defines

deviation measured by

normalizes

z below -2 oversold

z above +2 overbought

exit when

exit when

profits from

profits from

Herd behavior and emotion

Price overshoots fair value

Extreme deviation from mean

Mean / SMA

Snap-back to average

Simple Moving Average

Z-score

Standard deviation

BUY signal

SELL / SHORT signal

Price returns to mean z approx 0

Hinglish (regional understanding)

Intuition Hinglish mein samjho

Mean-reversion trading ka matlab hai ki jab stock ka price bahut zyada upar ya neeche chala jata hai, toh wapas apne average (matlab normal level) par aa jaata hai. Sochiye ek rubber band — jitna zyada ap khenchoge, utna hi zyada woh wapas snap karega. Market mein bhi yahi hota hai. Jab log dar ke mare panic selling karte hain, toh stock sasta ho jaata hai (oversold). Jab log greed mein pagal hokar khareedne lagte hain, toh stock mahanga ho jaata hai (overbought). Paragar company fundamentally thek hai, toh price wapas normal par aa jaata hai.

Mean-reversion traders yeh kaam karte hain: jab stock bahut neeche gir jaaye (jaise Bollinger Band ke lower band ko touch kare ya RSI 30 se neeche ho), tab khareed lo. Phir jab price wapas average (SMA ya middle band) par pahunche, tab bech do. Simple profit! Par ek badi warning hai — agar market trending hai (matlab continuously up ya down ja raha hai), toh mean-reversion kaam nahi karega. Aise mein ap oversold stock khareedoge aur woh aur bhi gir jaayega. Isliye pehle confirm karo ki market range-bound hai (sideways chal raha hai, koi strong trend nahi hai).

Yeh strategy short-term traders ke liye hai jo daily ya weekly trades karte hain. Long-term investors ke liye nahi. Aur risk management bahut zaroori hai — tight stop-loss rakho, kyunki agar price new low bana de, matlab trend badal gaya hai. Tab turant exit karna padega, warna portfolio dub jayega!

Test yourself — Trading vs Investing & Styles

Connections