OPEN-SOURCE SCRIPT
Zaktualizowano

Conformal Reversion Bands Self-Calibrating Coverage

323
Conformal Reversion Bands — Self-Calibrating Coverage

What it is

Ordinary bands lie about themselves. A Bollinger "2σ" band or an ATR band asserts a coverage it does not deliver — real price isn't Gaussian, so the band that's supposed to contain 95% of bars might actually contain 88% or 98%, and that fraction drifts as volatility changes. The label and the chart disagree.

Conformal Reversion Bands fix this. You choose the coverage you want (e.g. 90%), and the band's half-width is a nonconformity quantile that is tracked online so the realised coverage actually converges to your target — and self-corrects when it drifts. The indicator then displays target vs realised coverage live, so you can see the guarantee holding instead of taking it on faith. A breach of a calibrated 95% band means something precise: price did what it does under about 5% of the time — a genuine rare excursion, and a mean-reversion (fade) candidate back toward fair value.

How it works (and why this specific method)

Centre — a fair-value line the bands revert to: session VWAP by default (auto-fallback to a robust rolling median on symbols without reliable volume), or EMA / median by choice.
Score — the absolute deviation of price from the centre. Its running quantile is the band half-width.

Online calibration — this uses the quantile tracker ("conformal P control") of Angelopoulos, Candès & Tibshirani (2023), with an optional error integrator ("PI control"). This is deliberately chosen over the older Adaptive Conformal Inference (ACI): ACI adapts the significance level and can occasionally produce infinite or null intervals; tracking the quantile on the scale of the scores cannot degenerate that way, so the bands stay finite and well-behaved on live charts. ACI is in fact a special case of the tracker.

Volatility-normalized scores (locally adaptive) — scores are normalized by a local volatility estimate before calibration (the Papadopoulos–Gammerman–Vovk normalized-nonconformity idea), so the band width breathes with volatility bar-by-bar. This targets conditional coverage — not too wide in calm tape, not too narrow in fast tape — instead of only a global average.

Decaying step size — the learning step shrinks as calibration matures (Angelopoulos–Barber–Bates) for tighter long-run coverage, floored so the bands never stop adapting to new regimes.

Self-check — a trailing window measures realised coverage for both bands and reports how closely it tracks target. That readout is the whole point: it makes the band's core claim verifiable on your own chart. Note the honest theoretical ceiling: exact conditional coverage is impossible distribution-free; normalization gets most of the practical way there at negligible cost.

Everything advances only on confirmed bars: the band shown on a bar is calibrated on scores up to the previous bar, then that bar is tested against it — no hindsight fitting.

How to use it

Add to any liquid symbol/timeframe; set the coverage you want for the inner and outer bands. Defaults suit index futures; change the price/volume sources in Data source for any other market.

Read the dashboard headline first: it states CALIBRATED / ADAPTING / WARMING in plain language, with a colour anyone can read at a glance. When the inner and outer rows show target and realised % matching (✓), the bands are provably doing their job.
Treat an outer-band breach as a statistically rare excursion — a fade-toward-centre candidate (optional close-back-inside confirmation).

Watch COMPRESSION: a low band-width percentile means the bands are unusually tight (a volatility squeeze — expansion often follows); a high percentile means unusually wide.
Divergences (price vs the band's own normalized deviation, or RSI — your choice) are drawn as lines on price for context.

The dashboard and the identity label are separate toggles; the price/volume sources, coverage targets and every window are adjustable. Works as an honest, self-calibrating replacement for Bollinger/Keltner/ATR bands anywhere you use deviation bands.

What makes it original

Almost nothing on TradingView ships real conformal prediction, and — as far as the author is aware — nothing ships the modern quantile-tracker / PI-control variant with a live coverage readout that proves the band's claim on-chart. The contribution is bringing a 2023-frontier uncertainty-quantification method to price bands in a form a trader can verify at a glance, rather than a σ-multiplier that only pretends to a coverage level. The band-width compression read and the band-native divergence are natural, honest by-products of the same construction — context, not a signal service.

Concept credits

Conformal prediction — V. Vovk, A. Gammerman, G. Shafer. Normalized nonconformity — H. Papadopoulos, A. Gammerman, V. Vovk (2008). Adaptive Conformal Inference — I. Gibbs & E. Candès (2021). Quantile tracker / Conformal PID control — A. Angelopoulos, E. Candès & R. Tibshirani (2023). Decaying step — A. Angelopoulos, R. Barber, S. Bates (2024). VWAP — classical. Implementation and charting design are the author's own.

Important disclaimer

Research and education only. Not financial advice, not a signal service, not a guarantee of future results. Coverage is a statistical property of the band width — it is not a claim that fading breaches is profitable. The readout is descriptive of the past on the current chart, not a forward guarantee. Validate independently, apply realistic costs and slippage, and manage your own risk.
Informacje o Wersji
v1.1 — Finishing pass (no engine change)

- Added a Data Window (EXP_) export bus so the band lines, the realised inner/outer coverage rates
and the band-width percentile can feed other scripts via input.source().
- Added the MPL-2.0 licence header.
- No change to the conformal coverage tracker, the band construction, the coverage panel or the
divergence overlay — everyday behaviour is identical.

Descriptive coverage/interval tool, not investment advice.

Wyłączenie odpowiedzialności

Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.