The average price of an asset over a defined period, weighted by how much volume traded at each price.
VWAP (Volume Weighted Average Price) is a benchmark line that shows the average price an asset has traded at across a defined period, with each price weighted by the volume that changed hands there. Unlike a simple moving average, VWAP gives more influence to prices where more trading occurred, so it reflects where the bulk of activity actually took place. It is most commonly calculated on an intraday basis and resets at the start of each session, which is why the standard version is called "session VWAP." A related variant, "Anchored VWAP," begins its accumulation from a user-chosen point (such as a swing high, gap, or news event) rather than the session open. VWAP is widely used as a reference point rather than a forecasting tool. No indicator is predictive, and all trading carries risk of loss.
For each bar, VWAP uses a "typical price" (commonly the average of high, low, and close) and multiplies it by that bar's volume. It keeps a running total of these price-times-volume values and a separate running total of volume, both accumulated from the start of the chosen period. VWAP at any point is the first total divided by the second: cumulative (typical price x volume) / cumulative volume. Because the sums grow over the period and reset when the period ends (for example, at each new trading day), the line tends to settle and move more slowly as the session progresses and more data accumulates. The "anchor" is simply the starting point of that accumulation.
Most charting tools offer a session-anchored VWAP (resets daily) by default, using the typical price hlc3 as the source. Common variations include changing the anchor period (weekly, monthly, or a manually placed "Anchored VWAP" from a specific bar such as a swing high/low or an earnings date) and adding standard-deviation bands (often 1, 2, and 3 multiples) to frame a range around the line. Pine Script also provides the built-in ta.vwap for the standard session calculation.
//@version=6
indicator("Session VWAP", overlay = true)
// Reset accumulation at the start of each new day
newSession = ta.change(time("D")) != 0
var float cumPV = na
var float cumVol = na
src = hlc3 // typical price: (high + low + close) / 3
if newSession or na(cumPV)
cumPV := src * volume
cumVol := volume
else
cumPV += src * volume
cumVol += volume
vwapValue = cumVol != 0 ? cumPV / cumVol : na
plot(vwapValue, "VWAP", color = color.blue, linewidth = 2)Pro tip: Check your data source before relying on VWAP, especially in forex. Because spot FX has no centralized volume, many feeds substitute tick volume, and VWAP values can differ noticeably between brokers and platforms. Confirm what 'volume' your chart is actually using so you know what the line represents.
Educational only — not financial advice, not a recommendation to trade. No indicator is predictive; trading involves substantial risk of loss.