OPEN-SOURCE SCRIPT
Rolling Anchored VWAP

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
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 ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน