BACKTEST RESULTS

Bollinger Bands strategy backtest results

SPY daily data, 2016 to 2026: the 20, 2.0 rule, long and short, lost 28.2% after costs over 138 trades, winning 54.4% of them, against +277.8% for holding SPY. Long only it made 2.0%. The best of 7 runs was 20, 2.5 on SPY, long and short: +7.5%, held-out survived. Every run, every trade and the script are on this page.

SPY · daily data · 20, 2.0 · long and short
Net after costs
-28.2%
Holding SPY
+277.8%
Trades
138
Win rate
54.4%
Profit factor
0.81
Max drawdown
38.5%
Held out, last third: did not survive
Long only: +2.0% on 66 trades, held-out survived
4 January 2016 to 23 October 2026
  • Checked 25 October 2026
  • Alpaca daily data since 2016, and 5-minute data from the last 600 sessions
  • 0.05% commission + 0.025% slippage per fill
  • last third of the history held out
  • 7 runs, 2813 trades
  • Updated 1 November 2026

The short answer

Answers here: Does the Bollinger Bands strategy work? · What is its win rate? · 2 or 2.5 standard deviations? · Long only, or both ways?

SPY daily data, 4 January 2016 to 23 October 2026, long and short: 138 trades, lost 28.2% after costs, 54.4% of trades won, profit factor 0.81, worst drawdown 38.5%, 37% of the time in the market. Holding SPY returned +277.8% over the same period.

Held out on its own, the last third (16 March 2023 to 23 October 2026) lost 5.4% on 48 trades: it did not survive its held-out period.

Long only, the same rule made 2.0% on 66 trades (59.1% won, profit factor 1.07, held-out survived): the short side cost 30.2 points of return in a period when SPY rose 277.8%.

On 5-minute data the same rule traded 2219 times in 2.4 years on SPY and lost 96.0%: at 0.15% a round trip, costs alone came to roughly 333% of the account over the period, which is where a daily rule moved to minute charts usually dies.

Across all 7 runs on this page, 3 made money after costs, 4 survived the held-out third, and 0 beat holding the symbol.

The best run was 20, 2.5 on SPY, long and short: +7.5% net on 43 trades, profit factor 1.21, worst drawdown 14.0%, held-out survived. The tester's verdict on it reads "made money, but could be luck".

One symbol's past after modelled costs is not a forecast. Prices are split-adjusted and not dividend-adjusted, so every return here is a price return; the period includes a long rise with two sharp falls, and a rule that is often long did well for that reason as much as any other. These are research results, not investment advice.

What the script does

Bollinger Mean-Reversion Strategy, from the strategy library.

Mean reversion at the bands: goes long when the close crosses back above the lower Bollinger Band (20 periods, 2 standard deviations) and goes short when it crosses back below the upper band; the trade closes when the close crosses the middle band, the 20-day average. A stop sits 2 ATR away. A wider 2.5 band and a 10-day band were run on SPY, and long-only versions on SPY and QQQ.

The indicator itself, with its Pine code drawn on real market data: Bollinger Bands.

The numbers, run by run

Net and holding the symbol are after costs over the same period. Held-out is the verdict on the last third of the history judged alone: survived, decayed, did not survive, or too few trades to judge.

SymbolTimeframeSettingsDirectionTradesWin rateNetHoldingProfit factorMax drawdownHeld-out
SPYdaily20, 2.0long and short13854.4%-28.2%+277.8%0.8138.5%did not survive
SPYdaily20, 2.5long and short4358.1%+7.5%+277.8%1.2114.0%survived
SPYdaily10, 2.0long and short15054.7%-24.2%+277.8%0.8140.7%survived
QQQdaily20, 2.0long and short13450.0%-40.7%+542.3%0.7952.9%did not survive
SPYdaily20, 2.0long only6659.1%+2.0%+277.8%1.0724.3%survived
QQQdaily20, 2.0long only6357.1%+3.4%+542.3%1.0822.5%survived
SPY5-minute20, 2.0long and short221922.0%-96.0%+44.4%0.2396.0%did not survive

Year by year

20, 2.0 on SPY, long and short, the same rule long only, and SPY itself, each calendar year after costs. A partial first or last year counts the sessions it has.

Year20, 2.0, long and short20, 2.0, long onlyHolding SPY
2016+10.6%+7.3%+11.2%
2017-7.8%-0.2%+18.5%
2018-8.5%-7.4%-6.9%
2019-0.6%+2.4%+28.6%
2020-12.8%-12.8%+15.1%
2021-3.4%+0.1%+28.8%
2022-2.8%+2.6%-19.9%
2023+1.6%+12.1%+24.8%
2024-0.3%+4.6%+24.0%
2025-1.5%-0.7%+16.6%
2026-4.6%-3.7%+11.2%

Every trade

The 138 trades of 20, 2.0 on SPY, long and short, oldest first: side, entry and exit days, fill prices after slippage, and the return after both commissions. The other runs' trades open below.

SideInOutEntryExitReturn
short2016-04-182016-05-02207.07206.98-0.1%
short2016-06-012016-06-14209.06208.06+0.4%
long2016-06-292016-07-01204.88209.30+2.1%
short2016-08-152016-08-26218.84217.98+0.3%
long2016-09-132016-09-13214.90212.57-1.2%
long2016-09-162016-09-23213.54216.65+1.4%
long2016-11-082016-12-13212.76226.94+6.6%
short2016-12-132016-12-29226.94224.55+1.0%
short2017-01-302017-02-13228.10232.15-1.9%
short2017-02-212017-03-01235.45239.13-1.7%
long2017-03-242017-04-21234.45235.18+0.2%
short2017-04-282017-05-18238.83235.77+1.2%
short2017-05-302017-06-22241.26243.04-0.8%
long2017-06-292017-06-29243.73240.32-1.5%
long2017-07-032017-07-13242.98243.95+0.3%
short2017-07-182017-08-11244.99244.09+0.3%
long2017-08-152017-08-17247.05246.17-0.5%
long2017-08-222017-08-31243.65246.66+1.1%
short2017-09-142017-10-04249.72253.26-1.5%
short2017-10-102017-10-20254.55256.77-1.0%
short2017-10-312017-11-07257.11259.30-1.0%
short2017-11-082017-11-16258.39257.59+0.2%
short2017-12-052017-12-18264.35268.16-1.5%
short2018-01-112018-01-12274.67277.13-1.0%
short2018-01-172018-01-23277.96282.83-1.9%
long2018-02-072018-02-08268.58261.70-2.7%
long2018-02-122018-02-26263.95275.85+4.4%
long2018-03-272018-04-02266.25256.39-3.8%
short2018-05-152018-05-30271.48270.61+0.2%
short2018-06-122018-06-22278.95275.74+1.1%
long2018-06-292018-07-09272.20276.47+1.5%
short2018-08-092018-08-14285.45283.00+0.8%
short2018-08-312018-09-27289.76290.52-0.4%
long2018-10-172018-10-23280.52270.86-3.5%
long2018-10-262018-10-29266.00261.42-1.8%
long2018-12-192018-12-21255.24244.52-4.3%
long2018-12-272019-01-08242.64256.75+5.7%
short2019-03-252019-03-28278.80280.43-0.7%
short2019-04-032019-04-29287.24293.82-2.4%
long2019-05-152019-05-31281.67276.12-2.1%
long2019-06-052019-06-06282.41283.21+0.2%
short2019-07-082019-08-01296.93297.68-0.4%
long2019-08-082019-08-22289.70293.15+1.1%
short2019-09-092019-09-25299.07296.04+0.9%
long2019-10-072019-10-14293.55295.84+0.7%
short2019-12-022019-12-04314.50310.79+1.1%
short2019-12-192019-12-27319.70323.86-1.4%
short2020-01-152020-01-17327.25331.84-1.5%
short2020-01-222020-01-28332.15325.15+2.0%
long2020-03-032020-03-06309.59293.10-5.4%
long2020-03-112020-03-12280.78255.93-9.0%
long2020-03-162020-03-16241.25241.11-0.2%
long2020-03-182020-03-23236.32225.72-4.6%
short2020-05-292020-06-05302.37317.36-5.1%
short2020-06-102020-06-12321.33308.33+3.9%
short2020-08-102020-08-24334.97343.02-2.5%
short2020-09-012020-09-02350.11356.06-1.8%
short2020-09-042020-09-09346.03337.64+2.3%
short2020-10-142020-10-27350.64339.84+3.0%
long2020-10-302020-11-05328.37349.14+6.2%
short2021-01-052021-01-07368.00378.11-2.8%
short2021-01-122021-01-28378.79376.45+0.5%
short2021-02-102021-02-26392.01384.47+1.8%
long2021-03-082021-03-11384.77392.11+1.8%
short2021-04-082021-04-29407.82420.45-3.2%
short2021-05-112021-05-12412.99411.34+0.3%
long2021-05-142021-05-17413.31415.28+0.4%
long2021-06-222021-06-23420.97423.07+0.4%
short2021-07-072021-07-20433.54425.80+1.7%
short2021-09-012021-09-13452.46448.77+0.7%
long2021-09-232021-10-01439.96428.53-2.7%
short2021-10-222021-11-03453.01463.27-2.4%
long2021-11-302021-12-01462.13454.95-1.7%
long2021-12-032021-12-08459.29468.57+1.9%
long2022-01-272022-02-03438.38450.83+2.7%
long2022-02-252022-03-17429.73433.47+0.8%
long2022-04-262022-05-02425.94410.72-3.7%
long2022-05-032022-05-10415.12396.01-4.7%
long2022-05-112022-05-27398.16407.82+2.3%
long2022-06-162022-07-08370.61387.16+4.4%
short2022-07-252022-07-29395.64411.09-4.0%
short2022-08-022022-08-12409.01426.00-4.3%
long2022-09-022022-09-13400.40401.71+0.2%
long2022-09-282022-10-19364.48368.88+1.1%
short2022-10-272022-11-04382.97377.10+1.4%
short2022-11-152022-12-07401.04393.01+1.9%
long2022-12-212023-01-09383.36390.26+1.7%
short2023-01-182023-02-01398.92410.39-3.0%
short2023-02-062023-02-21409.68403.17+1.5%
long2023-03-142023-03-22390.61398.62+2.0%
short2023-04-052023-04-26407.78406.83+0.1%
short2023-05-222023-05-25418.53414.84+0.8%
short2023-06-072023-06-13428.32437.15-2.2%
short2023-06-152023-07-13436.20448.60-2.9%
short2023-07-172023-08-03449.01448.16+0.1%
long2023-08-212023-08-30437.67449.41+2.6%
long2023-09-262023-09-27429.21423.28-1.5%
long2023-09-282023-10-11425.60435.53+2.2%
long2023-10-312023-11-03416.29432.99+3.9%
short2023-11-162023-12-08449.11460.30-2.6%
short2023-12-182023-12-26470.86476.57-1.3%
short2024-01-252024-02-02487.43495.40-1.7%
short2024-02-262024-03-21508.16523.52-3.1%
short2024-03-252024-04-05519.65514.57+0.9%
long2024-04-232024-04-30501.93508.42+1.2%
short2024-05-172024-05-31528.68523.72+0.8%
short2024-06-172024-07-16541.93565.21-4.4%
short2024-07-182024-07-22558.36553.15+0.8%
long2024-07-292024-08-02546.17531.79-2.7%
long2024-08-082024-08-14524.04542.72+3.5%
short2024-10-162024-11-01579.63571.47+1.3%
long2024-11-042024-11-07571.33592.92+3.7%
short2024-11-132024-12-19597.16591.52+0.8%
long2024-12-232025-01-13591.05575.62-2.7%
short2025-01-272025-02-24594.67602.18-1.4%
long2025-02-272025-03-04597.01579.17-3.1%
long2025-03-062025-03-07575.63565.51-1.9%
long2025-03-102025-03-10567.74557.31-1.9%
long2025-03-132025-03-25558.64575.15+2.9%
long2025-04-102025-04-25532.38546.50+2.6%
short2025-07-022025-07-23617.08633.35-2.7%
short2025-07-292025-08-04638.19625.84+1.8%
short2025-08-152025-08-22645.82637.93+1.1%
short2025-09-172025-10-02659.84670.65-1.7%
long2025-10-142025-10-21657.35671.28+2.0%
short2025-10-302025-11-07683.72668.09+2.2%
long2025-11-202025-11-26673.09677.42+0.5%
long2026-01-222026-01-23690.03687.97-0.4%
long2026-02-092026-02-23689.60687.64-0.4%
long2026-03-102026-03-20677.89649.68-4.3%
long2026-03-242026-03-27651.49635.38-2.6%
long2026-04-012026-04-07654.05656.47+0.3%
short2026-04-172026-05-01705.96721.44-2.3%
long2026-06-122026-06-16740.97754.38+1.7%
long2026-07-312026-08-03744.88749.24+0.5%
short2026-08-072026-08-25770.82766.37+0.5%
long2026-09-182026-09-22761.51773.83+1.5%
short2026-10-082026-10-15774.67766.44+1.0%

The script

Pine v6, exactly as it ran for 20, 2.0 on SPY, long and short. The variants change only the inputs listed in the table.

//@version=6
strategy("Bollinger Mean-Reversion Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100, initial_capital=100000, commission_type=strategy.commission.percent, commission_value=0.05, slippage=1, margin_long=0, margin_short=0)

src      = input.source(close, "Source", group="Setup")
len      = input.int(20, "Length", minval=2, group="Setup")
mult     = input.float(2, "StdDev multiplier", minval=0.5, step=0.1, group="Setup")
exitAt   = input.string("Basis", "Exit at", options=["Basis", "Opposite band"], group="Setup")
useLong  = input.bool(true, "Trade longs", group="Direction")
useShort = input.bool(true, "Trade shorts", group="Direction")
atrLen   = input.int(14, "ATR length", minval=1, group="Risk")
stopMult = input.float(2, "Stop (ATR multiples)", minval=0, step=0.5, group="Risk")

[basis, upper, lower] = ta.bb(src, len, mult)
atr = ta.atr(atrLen)

longSig   = ta.crossover(close, lower) and barstate.isconfirmed
shortSig  = ta.crossunder(close, upper) and barstate.isconfirmed
// both exits computed every bar, the setting picks one (ta.* never sits inside a branch)
xBasisUp  = ta.crossover(close, basis)
xBasisDn  = ta.crossunder(close, basis)
xUpperDn  = ta.crossunder(close, upper)
xLowerUp  = ta.crossover(close, lower)
exitLong  = (exitAt == "Basis" ? xBasisUp : xUpperDn) and barstate.isconfirmed
exitShort = (exitAt == "Basis" ? xBasisDn : xLowerUp) and barstate.isconfirmed

pU = plot(upper, "Upper band", color=color.new(#E5484D, 20), linewidth=1)
pL = plot(lower, "Lower band", color=color.new(#16A56A, 20), linewidth=1)
plot(basis, "Basis", color=color.new(#A3A39E, 0), linewidth=1)
fill(pU, pL, color=color.new(#A3A39E, 94), title="Band fill")

if longSig and useLong
    strategy.entry("Long", strategy.long)
    strategy.exit("Long stop", "Long", stop=stopMult > 0 ? close - stopMult * atr : na)
if shortSig and useShort
    strategy.entry("Short", strategy.short)
    strategy.exit("Short stop", "Short", stop=stopMult > 0 ? close + stopMult * atr : na)
if exitLong
    strategy.close("Long")
if exitShort
    strategy.close("Short")

How it was tested

Alpaca daily data since 2016, and 5-minute data from the last 600 sessions, 0.05% commission and 0.025% slippage on every fill, the last third of the history held out, textbook settings and nothing tuned. The engine, fills and what it does not model are written out once, in data and methodology.

Run the Bollinger Bands strategy on your own symbol, free

Describe the rule in your own words or paste the script. The Free plan writes the Pine v6 script with the AI, runs it on any US stock or ETF with the same costs and the same held-out check, and shows every trade on the chart. No card.

Every strategy tested

Seventeen popular rules through the same engine, the same costs and the same held-out check, with every trade listed. Next: Mean reversion strategy, Keltner Channel strategy, RSI strategy.

Questions

Does the Bollinger Bands strategy work?

SPY, daily data, 2016 to 2026, long and short: 20, 2.0 lost 28.2% after costs over 138 trades (54.4% won, profit factor 0.81) against +277.8% for holding SPY, and the held-out third did not survive. Long only it made 2.0%. Across all 7 runs on the page, 3 made money after costs, 4 survived their held-out third and 0 beat holding the stock.

What is the win rate of the Bollinger Bands strategy?

From 22.0% to 59.1% across the 7 runs. The classic setting, 20, 2.0 on SPY long and short, won 54.4% of 138 trades. The win rate alone does not decide the result: that run's profit factor was 0.81, so its losers outweighed its winners, and the net return was -28.2%.

What are the best Bollinger Bands settings?

Of the 3 settings tested, 20, 2.5 on SPY (long and short) did best: +7.5% net, profit factor 1.21, held-out survived. That is the best of 7 tries on 10.8 years of daily data of one symbol, which is already a fitted number. A setting that works on one symbol or one period only is a coincidence, not a setting; run it on your own symbol and timeframe before trusting it.

Does the Bollinger Bands strategy beat holding the stock?

0 of the 7 runs did. SPY itself returned +277.8% between 4 January 2016 and 23 October 2026, so a rule that is out of the market part of the time has a lot to make up; what a timing rule usually gets you is a smaller drawdown, not a bigger return. The classic run's worst drawdown was 38.5% with 37% of the time in the market.

Did the Bollinger Bands strategy hold up out of sample?

The last third of every run's history (16 March 2023 to 23 October 2026 for the lead run) was judged on its own, with no fitting on it: 4 of 7 runs survived, 0 decayed, 3 did not survive and 0 had too few trades there to judge. Survived means a positive Sharpe ratio on the held-out part at least half the fitted period's; it is a check on one later stretch, not a forecast.

How was this tested?

With the free Alpha Charts tester's own engine: the Pine v6 scripts on this page, run on Alpaca daily data since 2016, and 5-minute data from the last 600 sessions, split-adjusted and not dividend-adjusted, one position at a time with the whole account, fills at the next candle's open, a commission of 0.05% and slippage of 0.025% on every fill, the last third of the history held out. The settings are the textbook ones and every variant is stated; nothing was tuned to make the page look better.

Every number on this page is the output of the Alpha Charts backtest engine on 25 October 2026, on Alpaca market data; the scripts are the strategy library's templates, shown as they ran. Symbols are US-listed ETFs and stocks; results are price returns after the costs stated. Past results are not a forecast and nothing here is investment advice. TradingView and Pine Script belong to TradingView, Inc.; Alpha Charts is not affiliated with it.