OPEN-SOURCE SCRIPT

Bollinger Bands Unbound [Probalist Essentials]

674
A Bollinger Bands that actually tells you when not to fade the band. Most BBand scripts show a band touch and leave you to guess whether it's a reversal or the first bar of a trend walk. This one answers that. The Band-Walk Guard flags every stretch where price keeps closing outside the band — trend mode, fade suppressed — and the Reversion Map measures, on your actual chart history, where confirmed fades went: what fraction tagged the basis, what the median reversion distance was, how wide the 1σ spread is, and whether the recent regime still matches the long-run.

Built for traders who want more than a line on a chart. The squeeze regime, the walk length, the basis-reach rate, the distribution panel — each answers a specific question about volatility state and mean-reversion quality that the default indicator leaves you to figure out yourself.

🟡 WHY THIS VERSION

Most Bollinger scripts treat every band touch as a trade. This one flags the band walk so you know when it's a trend, not a fade. The Reversion Map goes further: it counts how often your own chart's confirmed fades actually tagged the basis, shows the median reversion distance and a 1σ spread as a bell curve right of price, and splits bull from bear (they're different animals in a drifting market). You get a Wilson-backed verdict — not a fixed 60% bar, but a proper statistical lower bound — plus recent vs long-run form so you can see when the edge has changed regime. The edge clock shows when backed evidence last fired, not just whether it 'exists'. It keeps score honestly: small n prints 'gathering', wide bands stay wide, no numbers are hidden.

🟡 HOW IT WORKS

Bollinger Bands: basis = SMA(src, len) — or EMA via the Basis MA type input (the bands stay basis ± mult × stdev either way); upper/lower = basis ± mult × stdev(src, len). %B = (src − lower) / (upper − lower). Bandwidth = (upper − lower) / basis × 100, expressed as a percentage of price so it's scale-free across any instrument.

The Band-Walk Guard counts consecutive confirmed closes outside each band. A walk counter ticking upward is trend state — the outer band edge ignites in the heat ramp colour so you see it immediately. The Reversion Map fires only when price confirms back inside: a confirmed re-entry after a close beyond the lower band is a bullish fade; beyond the upper band is bearish. Each confirmed fade's outcome is recorded i_horizon bars later (the distance in %return, signed in the signal's direction), building two rolling arrays (bull/bear) of up to 200 outcomes. From those arrays: win-rate, median, 16th–84th percentile (≈1σ), Wilson lower bound, and recent-form over the last 60 outcomes. The bell curve drawn right of price is the kernel-smoothed empirical density of those returns — what actually happened, not a fitted model. Squeeze uses a rolling bandwidth percentile: self-calibrating, never an absolute number, works across all volatility regimes. With the optional RSI confluence filter on, a fade only counts when RSI was at an extreme on the excursion bar — and because the outcome arrays rebuild over the full history, toggling the filter shows like-for-like what the classic BB+RSI double-confirm does to the numbers on this chart.

🟡 KEY FEATURES
  • Band-Walk Guard: counts consecutive outside closes and flags trend state with an ignited band edge. During a walk no fade can fire by definition — a fade requires the confirmed close back inside, the very bar that ends the walk — so the guard shows you why the tool is silent
  • Reversion Map: empirical forward-return distribution per direction (bull/bear fades tracked separately), shown as a kernel-smoothed bell curve right of price
  • Basis-reach rate: % of past fades that tagged the basis within the horizon, displayed as a compact label on the basis line — the natural mean-reversion target with its own base rate
  • Squeeze detection: self-calibrating bandwidth percentile (default 10th over 120 bars), squeeze shading, release-breakout alert
  • Weighted signal dots: excursion depth (in rolling stdev units) drives dot size via self-calibrating 60th/90th percentile thresholds — tier 3 dots are the deep outlier fades
  • Wilson-backed verdict: lower bound of win-rate tested against 50% at user-chosen confidence (80/90/95%); recent form (last 60 outcomes) vs long-run both shown
  • Edge clock: stamps when backed (●) and leaning (◐) evidence last appeared on an actual signal — tells you if the edge is live or stale
  • Probalist heat ramp: %B mapped to ±100 drives the fill colour from strong blue (price at lower band) through mint neutral to orange/amber (price at upper band)
  • Optional RSI confluence filter — the classic BB+RSI double-confirm, built in. With the filter on, the Reversion Map measures the filtered signal, so you can A/B on your own chart whether the famous combo actually improves the outcomes.
  • Reversion-complete markers: a small ✓ on the basis line the moment a live fade tags its mean-reversion target — the exact event the basis-reach rate counts, so the entry dot and the exit ✓ tell the whole arc on the chart.


🟡 HOW TO USE
  • Band walk in readout? That's trend state. The outer band edge ignites — use it as a filter, not a fade setup. Wait for the walk to end and a confirmed re-entry before looking for a fade.
  • Fade signal (gold dot below price = bullish, blue dot above = bearish) fires on confirmed close back inside the band. Dot size = excursion depth; larger dots = deeper, statistically rarer excursions.
  • Check the Reversion Map rows in the readout: 'n' below 20 = gathering, don't weight the stats. Once n grows, median and the 1σ band tell you how far fades typically carried and how consistent they were.
  • Basis-reach rate on the basis line: if 70%+ of past lower-band fades tagged the basis within 20 bars, the basis is the realistic mean-reversion target on this chart — a number to weigh, not an instruction.
  • Squeeze shading (green tint) = bandwidth at the bottom decile. A squeeze release with a close outside the band often starts a new walk, not a fade — the readout flags it.
  • Evidence-gated alerts fire only when Wilson lower bound > 50% — that's a statistical bar, not a 50/50 flip. A backed signal with a small median (e.g. +0.15% on a 5-minute chart) may not survive round-trip costs; the edge read is about direction bias, not net P&L.
  • Combine with a trend filter above (e.g. price vs 200 SMA) to take only same-direction fades — bullish fades when above the 200, bearish when below. Reduces signal count, improves composition.
  • Non-repainting by construction: the confirmation bar closes, then the signal fires. Realtime mode (confirm=0) updates on the unconfirmed bar — note the repaint risk if you use it.
  • Curious whether the BB+RSI double-confirm helps on your chart? Turn on the RSI confluence filter and compare the readout stats with the filter off — the arrays rebuild over the full history, so the comparison is like-for-like.


🟡 PAIRS WELL WITH

A simple trend filter (price vs a longer moving average, or ADX slope direction) tells you which side of the mean-reversion to favour — the Reversion Map treats bull and bear fades separately, but a trend context makes even those reads sharper. Volume (relative volume or OBV) helps validate whether a fade has the force to carry: a low-volume re-entry into the band after a walk is weaker context than one with a volume spike. For timing confluence, a momentum oscillator (RSI or Stochastic) reaching oversold/overbought at the same time as a fade signal gives a second read on exhaustion. Key daily or weekly support/resistance levels provide a structural backdrop — a lower-band fade off a major S/R is meaningfully different from one in open air. None of these gate the signal here; they're the context a trader builds around it.

Bollinger Bands Unbound gives you the two answers the default version never does: whether a band excursion is a walk (stay out) or a confirmed fade (measure it), and where that fade actually went on your own chart. The statistics are descriptive — your history, counted honestly. Use the walk guard to stay out of trend mode, the Reversion Map to understand what confirmed fades have been worth, and the evidence-gated alerts when the record actually supports a bias.

Open source under MPL-2.0. The probability layer describes past signals on your chart — it is a measurement, not a prediction, and nothing here is financial advice.

כתב ויתור

המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.