OPEN-SOURCE SCRIPT

VWAP + OBV + MACD Custom Indicator

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

Aviso legal

As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.