Moving AveragesPine Script v6

ta.vwma()

Volume Weighted Moving Average

Computes the volume-weighted moving average (VWMA): over the last length bars, each source value is weighted by volume. Heavier volume bars pull the average more, tying the trend line to where participation was largest.

Syntax

Syntax
ta.vwma(source, length) → series float

Arguments

ParameterTypeDescription
sourceseries int/floatSeries of values to process (often close).
lengthseries intNumber of bars (length).

Returns

Volume weighted moving average of source for length bars back.

Remarks

na values in the source series are ignored.

Code Examples

Pine Script v6 Example
//@version=6
indicator("ta.vwma")
plot(ta.vwma(close, 15))

// same on pine, but much less efficient
pine_vwma(x, y) =>
    ta.sma(x * volume, y) / ta.sma(volume, y)
plot(pine_vwma(close, 15))

Trading Applications

Incorporate volume into trend analysis

Identify institutional buying/selling pressure

Compare VWMA with SMA to detect volume-driven moves

Use as a dynamic support/resistance with volume confirmation

Frequently Asked Questions

Generate ta.vwma() Code with AI

Skip the manual coding. Use Pineify's AI Coding Agent to generate Pine Script code using ta.vwma() and other built-in functions instantly.