OPEN-SOURCE SCRIPT

VWAP

80
//version=5
indicator(title="VWAP", shorttitle="VWAP", overlay=true)

// Calculate VWAP
price = (high + low + close) / 3
pv = price * volume
cumulativePV = ta.cum(pv)
cumulativeVolume = ta.cum(volume)
vwap = cumulativePV / cumulativeVolume

// Plot VWAP
plot(vwap, color=color.blue, linewidth=2, title="VWAP")

// Example: Display bullish/bearish signals (basic)
isBullish = close > vwap
isBearish = close < vwap

plotshape(isBullish, style=shape.triangleup, color=color.green, size=size.tiny, location=location.bottom, title="Bullish Signal")
plotshape(isBearish, style=shape.triangledown, color=color.red, size=size.tiny, location=location.top, title="Bearish Signal")

//Alerts
alertcondition(ta.crossover(close,vwap),"Price crossing above VWAP","Price crossing above VWAP")
alertcondition(ta.crossunder(close,vwap),"Price crossing below VWAP","Price crossing below VWAP")

Pernyataan Penyangkalan

Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Persyaratan Penggunaan.