Volume-weighted moving average
Average of recent closes weighted by volume, drawn over price; busy bars pull it harder.
VWMA multiplies each of the last N closes by that bar's volume, then divides by the total volume over the same N bars. Heavily traded bars count more than quiet ones, so the line leans toward the prices where most shares changed hands. The indicator has no session reset: its window is a count of bars, so it carries across the open and across days.
How to read it
- The line sits on the price scale over the candles, so it reads like a moving average.
- Price above the line means recent trade is above its volume-weighted average; below means it is under.
- At the default 20 bars it almost overlaps the candles; the gap only shows with a longer window or a volume spike.
- The first 19 bars of a run have no value, so the line starts after a short gap.
What it outputs
- VWMA
- Average of the last N closes, each weighted by its bar's volume, on the same scale as price.
Settings
- Window
- How many recent bars the average covers. Shorter hugs the candles and turns quickly; longer lags behind, smooths out volume bursts and drifts further from price during trends.
Pitfalls
- Named VWAP in the code, but it is a rolling N-bar average, not the intraday VWAP that restarts at the open.
- At the default 20 bars the median value equals the close to within 0.001%, so it adds little until the window is widened.
- A window whose volumes sum to zero has no value, which leaves a gap in the line.