Indicators
Bollinger Bands
A volatility envelope. A moving average with bands two standard deviations above and below, expanding and contracting with the market.
Bollinger Bands wrap price in a statistical envelope:
middle = SMA(20)
upper = middle + 2 × σ(20)
lower = middle − 2 × σ(20)
where σ is the standard deviation of price over the same window. Because the bands are built from volatility itself, they widen in wild markets and squeeze tight in quiet ones, unlike fixed-percentage envelopes.
The two opposite ways to trade them
Mean-reversion logic treats a tag of the lower band as statistically stretched and buys the reversion toward the middle. It works in ranges and gets run over in trends, because "riding the bands" is exactly what strong trends do.
Squeeze logic goes the other way. An unusually narrow band width means compressed volatility, so you trade the direction of the eventual expansion. Here the band touch is entry with the move.
Same indicator, opposite logic. "Uses Bollinger Bands" tells you nothing about a strategy until you know which regime it assumes, and a band-touch rule backtested only on ranging data then deployed into a trend is a textbook regime mismatch. That failure mode is one of the things forward-walk analysis exists to expose.
On AlphaProve
Both the mean-reversion and squeeze setups above build in no-code as
indicator-vs-indicator conditions: compare price against the
bollinger_bands lower band for the reversion entry, or compare band width
against keltner, also in the library, to catch the squeeze before it
expands. Because the regime choice is what makes or breaks the rule, the
tearsheet's exit-reason breakdown, how many trades closed at the
take-profit versus the stop, is the quickest read on
whether you matched the logic to the data.