Mean reversion strategy that buys at the lower band with RSI confirmation and exits at the middle band.
Bollinger Bands® attract traders because touching the lower band feels like an obvious buy — price is cheap, surely it bounces. The problem is that in a trending market, price can walk the lower band for weeks. This strategy adds RSI confirmation and exits at the middle band, not at a new high. The middle band exit is the key decision: it captures the mean-reversion move without overstaying.
Bollinger Bands® were created by John Bollinger in the early 1980s and formally introduced in his 2001 book Bollinger on Bollinger Bands®. The indicator consists of three lines: a middle band (typically a 20-period SMA), and upper and lower bands placed a specified number of standard deviations away from the middle.
The key insight behind Bollinger Bands® is that volatility is dynamic — it expands and contracts in cycles. The bands automatically widen during volatile periods and narrow during calm ones, creating a visual envelope that contains roughly 95% of price action (at the default 2 standard deviations).
The Bollinger Band® Bounce strategy is a classic mean-reversion approach. It exploits the tendency of price to "bounce" off the outer bands and revert toward the middle band. When price touches or penetrates the lower band, it suggests the asset may be temporarily oversold. Adding RSI confirmation (RSI below 35) filters out situations where price is trending strongly downward rather than bouncing.
This strategy works best in ranging or sideways markets. In strong trends, price can "walk the band" — hugging the upper or lower band for extended periods — which would generate losing trades for a mean-reversion system.
//@version=6
strategy("Bollinger Band® Bounce", overlay=true)
// Inputs
length = input.int(20, "BB Length")
mult = input.float(2.0, "Multiplier")
rsiLen = input.int(14, "RSI Confirmation Length")
// Bollinger Bands®
basis = ta.sma(close, length)
dev = mult * ta.stdev(close, length)
upper = basis + dev
lower = basis - dev
// RSI for confirmation
rsi = ta.rsi(close, rsiLen)
The exit strategy targets the middle band (basis), which acts as a natural mean-reversion target. This conservative exit captures the "bounce" without waiting for price to reach the opposite band — a move that occurs less frequently and increases the risk of a reversal.
// Entry conditions: price touches lower band + RSI oversold
longSignal = close <= lower and rsi < 35
shortSignal = close >= upper and rsi > 65
// Exit at middle band
if (longSignal)
strategy.entry("BB Long", strategy.long)
if (shortSignal)
strategy.entry("BB Short", strategy.short)
if (strategy.position_size > 0 and close >= basis)
strategy.close("BB Long")
if (strategy.position_size < 0 and close <= basis)
strategy.close("BB Short")
// Plot
plot(basis, "Basis", color=color.orange)
p1 = plot(upper, "Upper", color=color.blue)
p2 = plot(lower, "Lower", color=color.blue)
fill(p1, p2, color=color.new(color.blue, 95))