OPEN-SOURCE SCRIPT

Modern VWAP [GBB]

6 487
What does VWAP actually mean on an asset that never closes?

That question is why I decided to give the good old VWAP a bit of an update for 2026 markets. VWAP is the average price actually paid since some starting point — the anchor. On stocks the anchor is obvious: the opening bell. Bitcoin has no bell. What your chart calls
"the session" is midnight UTC — a timezone convention, not a market
event.

Modern VWAP [GBB] is an anchored VWAP with sigma bands that anchors itself, runs up to three instances at once, and only fires each signal family in the regime that family was designed for.


THE FOUR LAYERS

L0 — Baseline. VWAP of hlc3 accumulated from the anchor, with bands at one, two and three sigma, where sigma is the volume-weighted deviation of price around the VWAP itself — not a standard deviation of closes. On the same anchor this matches TradingView's built-in VWAP.

L1 — Auto-anchoring. This replaces the click-to-anchor workflow. Anchors are either periodic — Session, Week, Month — or Swing, which re-anchors at a confirmed pivot high or low (pivot length 10 by default, 5 to 50). When a pivot confirms, the accumulators are rebuilt from the pivot bar itself, so the swing VWAP includes the heavy volume around the turn instead of starting after it. Composite mode runs up to three anchored VWAPs together.

L2 — Adaptive bands. The sigma multiplier is scaled by the Kaufman Efficiency Ratio: choppy tape widens the bands, trending tape tightens them. Off by default.

L3 — Regime-gated signals. A KER and ATR quadrant decides whether the tape is trending or ranging, and each family only fires in its own regime. Mean reversion fires in ranging only: price closes outside the two-sigma band, then closes back inside — inside both bands, so a
candle that crosses the entire channel fires nothing. Trend continuation fires in trending only: a pullback to VWAP that holds within three bars. Direction comes from side occupancy, 8 of the last 10 closes above or below VWAP, deliberately not from VWAP slope.


HOW TO READ THE CHART

Instance A is the one that matters. Its line, its bands, and its colour: the band colour is the regime readout. Purple is trending, yellow is ranging, grey is undefined and still warming up.

Instances B and C are context. They draw their VWAP line and the two-sigma pair only, in their own colours, so a weekly or swing anchor can sit behind your primary one without burying the chart.

Signals are labelled: MR pills for mean reversion, TC triangles for trend continuation, green for long and red for short, on confirmed bars only. There are four alert conditions, one per family.

One thing to know: the signals and the regime colour always read Instance A, whatever B and C happen to be anchored to.


SETTINGS

Composite — turn instances A, B and C on or off, each with its own anchor: Session, Week, Month or Swing. Defaults are A on Session, B on Swing, C off on Week.

Swing pivot length — 10 by default, range 5 to 50. Longer means fewer and larger swings, and a longer confirmation lag.

KER-adaptive bands, and KER weight — the L2 toggle, off by default, weight 0.5 on a 0 to 1 range.

Signal markers — turn the markers off and keep the alerts.

Colours — seven inputs. The defaults are tuned for a dark chart; adjust the accents if you trade on white.

Parity mode — leave this off. It replaces the display with the raw numeric fields I used to verify the Pine build against my reference

If you are starting out: leave everything at defaults.

Exención de responsabilidad

La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.