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

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.