Bollinger Bands place an upper and lower volatility envelope around a moving average. They describe a price relative to a recent window; a touch does not say what price will do next. The same band can frame a continuation hypothesis or a return-toward-the-middle hypothesis, so write the rule before testing either one.
Calculate the bands you intend to use
For a simple moving-average version, write the basis as the mean of the chosen price series over a fixed length. The upper band is the basis plus a chosen multiple of the standard deviation; the lower band subtracts that same distance. Name the price input, average type, lookback, deviation convention, multiplier, and whether the active bar is included. “Twenty and two” are conventional defaults, not a universal optimum.
Here is a fictional five-close calculation using closes 98, 99, 100, 101 and 102 and the population standard deviation for this example. The simple average is 100. Deviations from the mean are −2, −1, 0, 1 and 2, so the mean squared deviation is (4 + 1 + 0 + 1 + 4) ÷ 5 = 2. The standard deviation is √2, about 1.414. With a multiplier of 2, the illustrative bands are 100 ± 2.828: lower 97.17 and upper 102.83. The latest close at 102 is near the upper band, but remains inside it. That observation alone defines no order.
Platforms can differ in basis type, source, offset and warm-up behavior. TradingView documents its adjustable Bollinger inputs and the common SMA-plus-or-minus-two-standard-deviations setup. Recalculate a few rows by hand and compare values before assuming a separate implementation matches it. If the window is incomplete, retain a missing value instead of filling it with zero.
Read band position and width as measurements
Two common derived values answer different descriptive questions. %B = (close − lower band) ÷ (upper band − lower band) places the close relative to the current envelope; it can be below 0 or above 1 when price is outside. BandWidth is (upper − lower) ÷ basis × 100%, a normalized measure of current envelope width. In the fictional example, the close at 102 gives %B ≈ 0.854 and BandWidth ≈ 5.66%. Neither number is a probability, forecast, or direction by itself. The indicator’s creator describes %B as relative position and BandWidth as normalized width; the usual two-standard-deviation settings do not turn price into a normally distributed 95% event.
The calculation convention matters even on a tiny example. The five closes have squared deviations summing to 10. Dividing by 5 gives the population variance 2 and the bands shown above. Dividing by 4 gives sample variance 2.5, standard deviation about 1.581, and bands about 96.84 and 103.16; the same close then has %B about 0.816 and BandWidth about 6.32%. Document the platform’s actual deviation convention and verify its output instead of assuming implementations agree. TradingView exposes band inputs such as source and basis type, while Pine’s reference documents standard-deviation functions and their estimate option.
For a squeeze hypothesis, define “narrow” from a historical training window—for example, below a chosen BandWidth percentile—and freeze that threshold before evaluating later data. A narrow band describes compression under the chosen rule; it does not identify breakout direction. Test the post-compression continuation rule separately from any fade rule, include quiet and failed expansions, and account for selection when many lengths or percentiles were tried.
Separate the signal bar from the modeled fill
For a close-based rule, the final value of a bar is not available while that bar is still forming. A reproducible test says whether its band uses only earlier closes or includes the newly completed close, then records the signal at the first time all inputs are known. That choice can change both the threshold and the timestamp of the decision.
TradingView’s Pine Script strategy documentation describes a platform-specific default: a strategy that calculates after a historical bar closes and creates a market order then generally models the earliest fill on the next available tick, usually the next bar’s open. A setting can change that behavior. This is a simulator convention, not a statement about every backtest engine or an exchange’s actual execution. A live limit order can miss, a market order can sweep depth, and fees and slippage remain separate from the indicator value.
For example, write the rule as: “At the confirmed close of bar t, compare that close with the upper band computed from the previous 20 completed closes. If it is above, record a breakout observation; model a market entry no earlier than the next available event.” A different rule may include bar t in the band calculation or use a re-entry condition. Both are testable, but choosing whichever version looks best after seeing results is another strategy search. Freeze one version, state the execution assumption and rerun the arithmetic before comparing outcomes.
Test the two readings as separate rules
A reversion test might require a completed close below the lower band, then wait for a separately defined re-entry condition before recording a hypothetical long. Specify the exit, invalidation, maximum hold and whether the strategy may add to a position. The failure case is a sustained move farther below the band or a return that arrives only after modeled costs overwhelm the result.
A continuation test might treat a completed close above the upper band as an initial breakout observation and evaluate a later entry under a declared risk cap. Define a failure condition such as a subsequent close back inside the bands. Keep this test separate from the reversion test: they use different hypotheses, entry timing and failure cases. If you try multiple settings or interpretations, preserve the full search rather than publishing only the best combination.
The indicator’s creator cautions that a band tag is not a signal by itself, that price can walk a band during a trend, and that an outside close initially belongs to the continuation interpretation. The same guidance warns readers not to treat two standard deviations as a normally distributed 95% boundary; typical observed containment with common settings may be nearer 90%. Those are methodological cautions, not proof that either crypto rule is profitable.
Make a fair comparison
Use chronological windows and one declared price source. Record band parameters, completed-bar timing, trade count, holding time, drawdown and costs. Include spread, fees, slippage and funding when the modeled instrument is a perpetual. Compare each rule with a simple same-market baseline, and report losing periods and nearby parameter results. Do not select a window after scanning many alternatives and then present it as an untouched evaluation.
SuperQuant’s public strategy examples do not include an arbitrary Bollinger-rule builder. The article does not promise that the app can run either custom setup, and its bundled hourly histories are synthetic. Read mean reversion, breakout research and backtest overfitting. This is research education, not a signal or financial advice.