Noon Barbari
Sign up
← All posts
walkthroughPublished Β·8 min read

How to backtest a Bollinger Bands strategy on crypto

Turn a Bollinger Bands idea β€” mean-reversion fade or volatility breakout β€” into testable rules, run it on real crypto history, and tell whether the edge holds up.

On this page

Bollinger Bands get used two opposite ways, and confusing them is why so many band strategies fail. The bands are a moving average plus and minus a multiple of standard deviation, so they measure volatility β€” they don't predict direction. You can fade a touch of the band (mean reversion) *or* trade a breakout out of a squeeze (volatility expansion), but those are different strategies for different regimes. Backtesting is how you find out which one actually works on your market, and when.

Step 1: decide which Bollinger strategy you're testing

First, pick a side. Mean reversion assumes price snaps back to the middle band: enter when price closes outside a band, exit at the midline. It works in ranges and gets destroyed in trends, where price "walks the band" for weeks. Squeeze breakout assumes a period of low volatility (narrow bands) precedes a big move: enter when the bands expand and price breaks the band, ride the expansion.

Whichever you choose, you still need all four decisions: entry trigger, exit, stop-loss, and a regime filter so you're only trading the conditions your variant is built for. A mean-reversion fade needs a "ranging" filter; a squeeze breakout needs confirmation that the move is real, not a fakeout.

Step 2: get clean historical data

Your backtest is only as honest as its data. Use real OHLCV candles for the exact symbol, timeframe, and exchange you'll trade, over a window covering more than one regime. This matters doubly for Bollinger: a mean-reversion fade will look brilliant on a ranging year and catastrophic on a trending one, so a single-regime test tells you nothing about live behaviour.

Step 3: run it and read the right metrics

Total return hides the risk you took. Read maximum drawdown, the Sharpe ratio, profit factor, and win rate with average win/loss. Mean-reversion band fades typically show high win rates with the occasional brutal loss when price walks the band β€” exactly the profile that blows up an account if the stop is loose.

Here is a complete squeeze-breakout version β€” it waits for low volatility, then trades the expansion with a trend confirmation:

rules.yaml β€” Bollinger squeeze breakout with trend confirmation
strategy:
  name: bollinger_squeeze
  indicators:
    - { id: bb, kind: Bollinger, period: 20, mult: 2.0 }
    - { id: adx, kind: ADX, period: 14 }
  rules:
    entry:
      all:
        - { type: above, left: adx, right: 20 }        # a real move, not chop
        - { type: crosses_above, left: close, right: bb.upper }
    exit:
      any:
        - { type: crosses_below, left: close, right: bb.middle }
  risk:
    size_pct: 0.5
    stop_loss_atr: 2.0

Step 4: the test that actually matters β€” walk-forward

Bollinger Bands have two tempting knobs β€” the period and the standard-deviation multiplier β€” and tuning both against your whole history is the fastest way to curve-fit a beautiful, useless equity curve. Walk-forward optimization tunes on one window and tests on the *next* window the optimizer never saw, then rolls forward. If your 20-period, 2.0-sigma settings only worked because you hand-picked them on the full dataset, walk-forward will show the edge collapsing on unseen data.

This is where the overfitting score earns its place. A Bollinger strategy that survives walk-forward across a rally, a crash, and a chop phase is worth paper-trading; one that only shines in-sample is a memory of the past.

Do it in Noon Barbari

You can build both Bollinger variants without code. Add Bollinger Bands and ADX from the indicator library, wire the entry/exit/stop in the visual designer, and run the backtest over years of crypto data in seconds. Then run walk-forward to see whether your period and multiplier are real parameters or noise. The free tier covers one full strategy end to end β€” enough to test this exact rule and read the robustness score yourself.

Try it on your own data

Every concept above is implemented in the platform. Backtest, walk-forward, paper-trade, then promote to live β€” same rule set, all stages.

Related reading

Related guides

Key terms