Skip to content

Technical indicators

Volume Weighted Moving Average (VWMA)

A moving average that listens most to the busiest bars.

The VWMA weights each close in the window by that bar’s volume. When volume is even it matches the SMA; when heavy volume comes with moves one way, the VWMA leans that way. Unlike VWAP, it covers a rolling window of bars rather than the day so far.

Traders compare it with an SMA of the same length: a VWMA above the SMA says the heavier trading came at higher prices, which supports a rise, and below it the reverse.

VWMA = Σ(CLOSE × VOLUME) / Σ VOLUME, over the last `periods` bars

When the window has no volume at all it has no value.

Call: vwma(periods)

Setting Chart default
periods: Periods 20

What you get: a number.

Warm-up: with vwma(20), it asks for 0 bars of history and a run-up of 20, and its first value came on bar 20 of the example data.

Volume Weighted Moving Average drawn by its own code on example prices

The prices are made up, hourly, and the same on every page, so the chart shows how the indicator behaves, not how a market behaved.

function onIntervalClose() {
const weighted = vwma(20);
const plain = sma(20);
if (weighted !== null && plain !== null && weighted > plain && OPEN_POSITIONS_COUNT === 0) {
openPosition("BUY", { quantity: 10000, stopLossPips: 30 });
}
}