OPEN-SOURCE SCRIPT

Rolling Anchored VWAP

209
Rolling Anchored VWAP (RAVWAP) plots up to three independent, volume-weighted average price lines that roll forward bar by bar. Unlike session VWAP, which resets at the open, each line uses a moving anchor: at every bar, the window starts exactly N bars ago and runs through the current bar, so you get a continuously updating fair-value reference without session breaks.

Overview
VWAP is widely used by institutions to gauge whether price is trading above or below the volume-weighted average. This indicator extends that idea with rolling anchored windows of any length you choose — useful on any timeframe, including higher timeframes where session VWAP is less relevant.

Each VWAP is fully configurable: enable or disable it, set its own period, color, and line width, and optionally display volume-weighted standard deviation bands at ±1σ, ±2σ, and ±3σ.

How it works
For a given Period setting of N:

The anchor is placed N bars before the current bar
VWAP is calculated from that anchor through the current bar (inclusive)
On each new bar, the anchor advances by one bar
Example with Period = 100:

Bar 100 → VWAP over bars 0 through 100
Bar 101 → VWAP over bars 1 through 101
Bar 102 → VWAP over bars 2 through 102
The calculation uses efficient rolling sums, so it stays responsive even with periods in the hundreds or thousands.

Standard deviation bands use the same volume-weighted formula as TradingView’s built-in VWAP:

σ = √( Σ(V × P²) / Σ(V) − VWAP² )

Band toggles affect display only — they do not change the VWAP value.

Features
3 independent rolling VWAPs with separate periods (defaults: 100, 250, 500)
Individual enable/disable for each VWAP
Custom color and line width per VWAP
Optional ±1σ, ±2σ, ±3σ bands per VWAP
Optional filled band between ±1σ
Configurable source (default: HLC3)
Non-repainting — historical values are fixed after each bar closes
No session resets — continuous rolling windows on any timeframe
Overlay on price — plots directly on the chart scale

免責事項

これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。