Learn
Mean reversion 2 min read

Mean Reversion

Fade the extremes — enter when price has gone too far, too fast.

Buys overstretched dips and sells overstretched rips — uses Bollinger position + RSI + Stochastic confluence.

The idea

Prices don't move in a straight line. After a sharp move, short-term participants take profit, forced sellers finish panicking, and the chart reverts toward the mean. A mean-reversion script's job is to wait for clear exhaustion and then take the other side.

The problem is distinguishing "exhaustion" from "just getting started". This script uses three independent oversold / overbought measures plus a candle trigger so that false setups score below the threshold.

Scoring

InputBuy pointsSell points
Bollinger position below 0.15 / above 0.85+2+2
Bollinger position below 0.25 / above 0.75+1+1
RSI below 30 / above 70+2+2
RSI below 40 / above 60+1+1
Stochastic %K below 20 / above 80+1+1
Reversal candle (after aligned move)+1+1

Threshold: 3 for normal, 5+ for ✓✓ strong. 8-bar cooldown between signals.

How to use it

  1. Enable Mean Reversion in the Scripts panel.
  2. Strong ✓✓ signals at clear swing extremes are the textbook setup. Enter on the signal candle close, stop just beyond the extreme, target a return to the middle band (the 20-SMA basis).
  3. Never run this script standalone in a trending market. If the chart is in a clear uptrend or downtrend, this tool will bleed capital by fading momentum. Disable it or use Trend Following instead.
  4. Best paired with the Event Timeline — a Reversal Buy right after a macro-driven panic dump has a very different quality than one in the middle of a calm range.

Why it works (and when to turn it off)

In sideways and mildly trending markets, prices oscillate around a slow-moving average. Both retail liquidations and short-term traders create reliable overshoots that revert.

In strong trends, the same logic says "sell this rip" the entire way up, and stops out repeatedly. Context — ADX, higher-timeframe trend, whether the market is in a breakout regime — should always gate when you listen to this script.

Frequently asked

What is "Bollinger position"?
Where the current close sits within the Bollinger channel, 0 at the lower band, 1 at the upper. Below 0.15 is very stretched down, above 0.85 is very stretched up.
Isn't this just buying dips?
Only if the dip is extreme on *three* simultaneous measures. Regular dips score below the threshold and are ignored.
Why add a candle confirmation?
Extremes can get more extreme. Requiring a first reversal candle (red→green or green→red) filters out "knife-catching" before the move has actually turned.