OPEN-SOURCE SCRIPT
Diupdate

Multiday VWAP by Bybllo

276
Multiday VWAP by Bybllo

OVERVIEW
This indicator plots up to 5 independent rolling Volume Weighted Average Price (VWAP) lines, each anchored a different number of calendar days back from the present bar (default: 2, 3, 4, 5, and 6 days back). Unlike a standard session VWAP that resets every day, each line here accumulates price*volume continuously from its own anchor day up to the current bar, giving traders a set of rolling reference levels for recent multi-day price/volume balance.

I built this for my own trading because I couldn't find an existing community script that did exactly this — a set of independent, multi-day rolling VWAP lines in one indicator — so I'm sharing it in case it's useful to others too.

KEY FEATURES
- 5 independently configurable rolling VWAP lines — toggle visibility, set the lookback in calendar days, and pick a color for each line individually.
- Lookback days are entered as calendar days (weekends included), so "6 days back" always lands on the same relative session regardless of where in the week you are.
- Real-price calculation — prices are pulled via request.security() against the plain ticker, so the VWAP values are identical whether your chart is displaying candlesticks, Heikin Ashi, Renko, or any other non-standard chart type. Volume is unaffected by chart type and is used as-is.
- Robust new-day detection — instead of relying on the chart's own bar-by-bar progress to detect a new trading day (which can be unreliable right after the chart first loads), this script requests daily-resolution data directly. Daily data loads much faster than intraday data, so the VWAP anchors are detected reliably even immediately after opening the chart.

HOW TO USE
Open the indicator settings and, for each of the 5 lines, set how many calendar days back you want that VWAP to start accumulating from. Use the lines as dynamic support/resistance or fair-value reference levels, similar to how a session VWAP is used, but for multi-day accumulation periods.

NOTES
- This script requires volume data from your data provider. If no volume is available for the symbol, the VWAP values will not calculate correctly.
- "Rolling Days" counts calendar days, not trading/session days.

Feedback and suggestions are welcome.
Catatan Rilis
- Translated all input labels and code comments to English for publication.
- Added a detailed description header (overview, key features, how to use, notes).
- Cleaned up the chart image by removing unrelated indicators for a clearer preview.
No changes to the underlying VWAP calculation logic.
Catatan Rilis
Fixed a subtle timing bug in the new-day detection that could
cause the VWAP anchor to shift by one bar in some edge cases.
No changes to the core VWAP calculation.
Catatan Rilis
Updated the published chart image to a clean view showing only this indicator, with no other scripts overlaid. No changes to the code or calculation logic.
Catatan Rilis
Added a "Typical Use Case" section to the description, explaining
this indicator is built for scalping/day trading futures (Nasdaq
futures, Bitcoin futures, and index futures from various countries)
using multi-day rolling VWAP centerlines as dynamic support/
resistance. Also updated the chart snapshot. No changes to the
calculation logic.
Catatan Rilis
Changes:
- Anchor dates are now locked to the first real trading day at or after the calculated target, instead of requiring an exact calendar-date match. This fixes cases where an anchor would silently fail to render on weeks containing an unscheduled holiday.
- Once an anchor is set, it is locked with a "started" flag and will never re-trigger, eliminating occasional overlap between adjacent rolling-day lines.
- Added real-price calculation via request.security() against the chart's own ticker (syminfo.tickerid), so VWAP values are now identical whether the chart is displaying candlesticks, Heikin Ashi, Renko, or any other non-standard chart type.
- Lookback is now entered in real trading days (not raw calendar days), so "N days back" always lands on an actual session with data.
- Cleaned up input labels and removed the redundant source ticker label from the chart's status line.
Catatan Rilis
Update: Added Manual Anchor Mode

- The existing automatic rolling-day logic (real trading days, weekends
and holidays automatically excluded) is unchanged and remains the
default behavior.
- Added a "Manual Mode" toggle. Off by default — if you leave it off,
the indicator behaves exactly as before.
- When enabled, each of the 5 lines gets its own date/time picker so
you can anchor to a specific date and time instead of a rolling
trading-day count. With Manual Mode on, the automatic rolling-day
logic is fully disabled — only the manually set anchors are used.
- Fixed a calculation issue where values could accumulate incorrectly
before the anchor point, causing a brief spike right at the anchor.
The line now starts cleanly from the anchor timestamp.

Pernyataan Penyangkalan

Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.