OPEN-SOURCE SCRIPT

VWAP + OBV + MACD Custom Indicator

79
//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!")

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.