vwma

Volume Weighted Moving Average

vwma(source, periods)

The VWMA weights price data by volume, giving more importance to periods with higher trading activity. This helps identify price levels where significant volume occurred.

Parameters

  • source (source): Data series to calculate VWMA on - price field (close, open, high, low) or indicator output
  • periods (int): Number of periods for the moving average
  • Common values: 20, 50, 200

Formula


VWMA = SMA(field * volume, periods) / SMA(volume, periods)

This is equivalent to:
VWMA = Σ(field[i] * volume[i]) / Σ(volume[i])

Where the sum is over the specified number of periods

Examples


vwma(close, 20);  # 20-period volume-weighted MA
x = vwma(close, 50); close > x;  # Price above VWMA
vwma(hlc3, 20);  # VWMA of typical price

Returns

Volume-weighted moving average value

Notes

  • More responsive to volume spikes than regular MAs
  • Useful for identifying support/resistance at volume clusters
  • Division by zero protection returns NULL