OPEN-SOURCE SCRIPT

VWAP + OBV + MACD Custom Indicator

76
//version=5
indicator("VWAP + OBV + MACD Custom Indicator", overlay=true)

// 1️⃣ VWAP Calculation
vwap_value = ta.vwap

// 2️⃣ OBV Calculation
obv_value = ta.obv

// 3️⃣ MACD Calculation
[macd_line, signal_line, _] = ta.macd(close, 12, 26, 9)

// 🎯 **Buy Signal Conditions**
buy_signal = close > vwap_value and ta.change(obv_value) > 0 and macd_line > signal_line

// 🎯 **Sell Signal Conditions**
sell_signal = close < vwap_value and ta.change(obv_value) < 0 and macd_line < signal_line

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

// ✅ Plot Buy Signal
plotshape(buy_signal, location=location.belowbar, color=color.green, style=shape.labelup, title="BUY")

// ❌ Plot Sell Signal
plotshape(sell_signal, location=location.abovebar, color=color.red, style=shape.labeldown, title="SELL")

// 🔔 **Alerts for Buy/Sell Signals**
alertcondition(buy_signal, title="Buy Alert", message="Buy Signal Triggered!")
alertcondition(sell_signal, title="Sell Alert", message="Sell Signal Triggered!")

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。