OPEN-SOURCE SCRIPT

VWAP

76
//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")

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.