Code Library / VWAP

Pine Script VWAP Crossover

Intraday VWAP crossover strategy with volume confirmation.

Language: Pine Script · Category: VWAP · Tags: VWAP, crossover, intraday, Pine Script, strategy

Source code

//@version=5
strategy("VWAP Cross",overlay=true)
v=ta.vwap(hlc3); hv=volume>ta.sma(volume,20)*1.5
if ta.crossover(close,v) and hv
    strategy.entry("Long",strategy.long)
if ta.crossunder(close,v) and hv
    strategy.entry("Short",strategy.short)
plot(v,"VWAP",color.blue,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.

Related snippets