Anchored VWAP Guide
Master this indicator with Pine Script code and automated strategies.
What is Anchored VWAP?
Anchored VWAP (AVWAP) is the volume-weighted average price calculated from a specific bar of your choosing - an earnings report, a 52-week low, a gap day, an IPO. Because large funds accumulate positions over days or weeks, the AVWAP from a major event approximates the average cost basis of everyone who bought since that event. Price holding above an anchored VWAP means the average buyer is in profit (supportive); price losing it means the average buyer is underwater (overhead supply). Popularized by Brian Shannon, AVWAP has become one of the most-requested tools on TradingView.
How to Use This Strategy
Pro Tip: Anchor to the bar of a major event: the last earnings report, a 52-week high or low, or the start of a big-volume breakout. In an uptrend, pullbacks to a rising AVWAP are high-probability buy zones because the average holder since the event is defending their cost basis. A decisive close below an earnings-anchored VWAP tells you post-earnings buyers are trapped - expect rallies to stall there. Pro tip: run two anchors at once (e.g., earnings + 52-week low); where they converge is a major decision level.
Pine Script Code
Copy and paste this code into your TradingView Pine Editor.
//@version=5
indicator("Anchored VWAP", overlay=true)
// Inputs - click a bar on the chart to set the anchor
anchorTime = input.time(timestamp("01 Jan 2026 09:30 -0500"), "Anchor Point", confirm=true)
src = input.source(hlc3, "Source")
// Cumulative price*volume and volume from the anchor bar
var float cumPV = na
var float cumVol = na
anchored = time >= anchorTime
newAnchor = anchored and not anchored[1]
if newAnchor
cumPV := src * volume
cumVol := volume
else if anchored
cumPV := cumPV + src * volume
cumVol := cumVol + volume
avwap = anchored and cumVol > 0 ? cumPV / cumVol : na
// Plot
plot(avwap, "AVWAP", color=color.orange, linewidth=2)
plotshape(newAnchor, "Anchor", shape.labelup, location.belowbar, color.orange, text="A", textcolor=color.white, size=size.tiny)