Bands plotted a chosen number of volume-weighted standard deviations above and below VWAP, showing how far price has stretched from the average traded price since the anchor.
VWAP standard deviation bands extend the Volume-Weighted Average Price with a dispersion measure: bands drawn one, two, and sometimes three standard deviations above and below the VWAP line. VWAP itself is the cumulative sum of price times volume divided by cumulative volume, measured from an anchor point (most commonly the session open). The bands describe how widely price has traded around that average so far. There is a correctness detail that matters: the standard deviation must be volume-weighted and anchored to the same starting point as the VWAP itself. Many free scripts instead compute an ordinary rolling standard deviation of price around the VWAP line — mixing an anchored, volume-weighted average with an unanchored, unweighted dispersion measure — which produces bands that are simply wrong, sometimes by a wide margin. Like all indicators, these bands describe what has already traded; they do not predict where price will go. This is educational material only, not financial advice, and all trading carries risk of loss.
The correct implementation maintains three cumulative sums from the anchor bar: the sum of price times volume (ΣPV), the sum of volume (ΣV), and the sum of price squared times volume (ΣP²V). VWAP is ΣPV / ΣV. The volume-weighted variance uses the standard identity 'mean of squares minus square of the mean': variance = ΣP²V / ΣV − VWAP². The standard deviation is the square root of that (clamped at zero, because floating-point rounding can produce a tiny negative number early in a session), and each band is VWAP ± multiplier × SD. Every new bar adds to all three sums, so both the VWAP and the bands update incrementally; at the next anchor (for example the next session open) all three sums reset to zero. Because the calculation is cumulative, the variance reflects the entire session's history: early in the session the bands are unstable with few bars of data, and later in the session they respond slowly to new behaviour because the accumulated history dominates. A naive ta.stdev(close, n) around VWAP gives different numbers because it uses a fixed rolling window, equal weights, and no anchor — three separate disagreements with the definition.
Source is usually hlc3 (the bar's typical price), anchored to the session open for intraday work, with band multipliers of 1.0 and 2.0 (sometimes 3.0). Swing traders sometimes anchor weekly or monthly instead. The multiplier and the anchor are the only real choices — but verify the script computes a volume-weighted, anchored standard deviation rather than a rolling ta.stdev, because that implementation detail changes every band value.
//@version=6
indicator("VWAP + Volume-Weighted SD Bands", overlay = true)
src = input.source(hlc3, "Source")
mult1 = input.float(1.0, "Band 1 Multiplier", step = 0.25)
mult2 = input.float(2.0, "Band 2 Multiplier", step = 0.25)
// Reset all three cumulative sums at the session anchor
newSession = timeframe.change("D")
var float cumPV = 0.0
var float cumV = 0.0
var float cumP2V = 0.0
if newSession
cumPV := 0.0
cumV := 0.0
cumP2V := 0.0
cumPV += src * volume
cumV += volume
cumP2V += src * src * volume
myVwap = cumV > 0 ? cumPV / cumV : na
// Volume-weighted variance: E[P^2] - E[P]^2, clamped for float rounding
variance = cumV > 0 ? math.max(cumP2V / cumV - myVwap * myVwap, 0.0) : na
sd = math.sqrt(variance)
plot(myVwap, "VWAP", color = color.blue)
plot(myVwap + mult1 * sd, "+1 SD", color = color.gray)
plot(myVwap - mult1 * sd, "-1 SD", color = color.gray)
plot(myVwap + mult2 * sd, "+2 SD", color = color.new(color.gray, 40))
plot(myVwap - mult2 * sd, "-2 SD", color = color.new(color.gray, 40))Pro tip: Before trusting any VWAP band script, check the source code for a cumulative Σ(price²·volume) term. If you instead see ta.stdev applied to price or to the VWAP series, the bands are plain rolling standard deviations dressed up as VWAP bands, and their values will not match a correct implementation. Compare against your platform's built-in anchored VWAP-with-bands to verify. This is educational information only, not financial advice — no band placement predicts price, and all trading carries risk of loss.
Educational only — not financial advice, not a recommendation to trade. No indicator is predictive; trading involves substantial risk of loss.