◆ New — Strategy Validator, Code Fixer & Prop Compliance Checker are live. Try one free →
Home / Indicators / Volume-Weighted Moving Average (VWMA)
Moving Averages indicator

Volume-Weighted Moving Average (VWMA)

A rolling moving average that weights each bar's price by its volume, so high-volume bars pull the line harder than quiet ones.

Illustrative diagram — not live market data.

What it is

The Volume-Weighted Moving Average (VWMA) is a moving average in which each bar's price is weighted by the volume traded on that bar. Where a Simple Moving Average treats every bar in the window equally, VWMA lets busy bars count for more and quiet bars count for less, so the line leans toward the prices where the most activity occurred. It is frequently confused with VWAP, but the two answer different questions: VWMA is a rolling average over a fixed number of recent bars (for example the last 20), sliding forward one bar at a time, while VWAP is a cumulative average anchored to a fixed starting point such as the session open, incorporating every bar since that anchor. VWMA has a constant lookback; VWAP's lookback grows through the session. Both are descriptive summaries of past price and volume — neither predicts where price will go next, and no indicator removes the risk of loss. This entry is educational content, not financial advice.

How it works

For a chosen length n, VWMA multiplies each bar's price by that bar's volume, sums those products over the last n bars, and divides by the total volume over the same n bars: VWMA = Σ(price × volume) / Σ(volume). If every bar had identical volume, the result would collapse to an ordinary SMA — the entire difference between VWMA and SMA comes from uneven volume. A bar with three times the average volume has three times the influence on the line, so VWMA gets tugged toward the prices where activity clustered. Comparing a VWMA to an SMA of the same length is therefore informative in itself: when the VWMA sits above the SMA, recent volume was concentrated on higher-priced bars; when it sits below, volume clustered on lower-priced bars. As with any moving average, the window slides forward each bar, the oldest bar drops out, and the line lags price by construction. One data caveat matters for forex specifically: spot forex is decentralized, so the 'volume' most platforms supply is tick volume (the count of price updates at your broker), not actual traded currency, and VWMA readings inherit whatever limitations that proxy has.

How traders read it

Common settings

A length of 20 on the closing price is the common default, mirroring the standard SMA comparison. Shorter lengths (10 or less) react quickly and jump around volume spikes; longer lengths (50 or more) smooth the volume weighting but lag further. On spot forex, remember the volume input is tick volume from your specific broker, so VWMA values can differ between brokers on the same pair and timeframe.

Strengths

Pitfalls to watch

Pine v6 example

//@version=6
indicator("VWMA vs SMA Example", overlay = true)

length = input.int(20, "Length", minval = 1)
src    = input.source(close, "Source")

// Built-in volume-weighted moving average
vwmaLine = ta.vwma(src, length)

// The same calculation written out, for verification:
// sum(price * volume) / sum(volume) over the window
manualVwma = math.sum(src * volume, length) / math.sum(volume, length)

smaLine = ta.sma(src, length)

plot(vwmaLine,   "VWMA",          color = color.teal, linewidth = 2)
plot(smaLine,    "SMA (same n)",  color = color.gray)
plot(manualVwma, "VWMA (manual)", color = color.new(color.orange, 70))

Pro tip: Plot VWMA and an SMA of the same length together and read the gap between them rather than either line alone: the gap isolates exactly what volume weighting is adding, and it collapses to zero whenever volume is roughly uniform. If the gap on your instrument is persistently negligible, VWMA is telling you it has nothing to add over a plain SMA there. This is educational context only — VWMA is descriptive, not predictive, and all trading carries risk of loss.

Built an indicator from this? Run it through the Validator to catch look-ahead bias and repainting, or convert a strategy to Pine Script.

Educational only — not financial advice, not a recommendation to trade. No indicator is predictive; trading involves substantial risk of loss.

Catch the bug that compiles.Run auditGet Pro