Code Library / VWAP
Pine Script Anchored VWAP
Anchored VWAP from a significant date.
Language: Pine Script · Category: VWAP · Tags: anchored VWAP, Pine Script, institutional, support resistance, TradingView
Source code
//@version=5
indicator("Anchored VWAP",overlay=true)
ad=input.time(timestamp("2024-01-01"),"Anchor")
var float cv=0, var float cpv=0, var bool go=false
if time>=ad and not go
go:=true; cv:=0; cpv:=0
if go
cv+=volume; cpv+=hlc3*volume
plot(go?cpv/cv:na,"AVWAP",color.purple,2)How to use this snippet
This is a building block, not a finished trading system. Paste it into your own Pine Script project, compile it, and test it on a demo account with your broker's real spreads before relying on it. You can convert it to MQL4 or MQL5 with the Pine Script converter.