OPEN-SOURCE SCRIPT

ROC / VWAP / ATR / RSI / MACD Combo

50
//version=5
indicator("ROC / VWAP / ATR / RSI / MACD Combo", overlay=true)

// === INPUTS ===
showROC = input.bool(true, "Show ROC")
rocLength = input.int(14, "ROC Length")

showVWAP = input.bool(true, "Show VWAP")

showATR = input.bool(true, "Show ATR")
atrLength = input.int(14, "ATR Length")

showRSI = input.bool(true, "Show RSI")
rsiLength = input.int(14, "RSI Length")

showMACD = input.bool(true, "Show MACD")
fastLen = input.int(12, "MACD Fast Length")
slowLen = input.int(26, "MACD Slow Length")
sigLen = input.int(9, "MACD Signal Length")

// === CALCULATIONS ===

// ROC
roc = ta.roc(close, rocLength)

// VWAP
vwap = ta.vwap

// ATR
atr = ta.atr(atrLength)

// RSI
rsi = ta.rsi(close, rsiLength)

// MACD
macdLine = ta.ema(close, fastLen) - ta.ema(close, slowLen)
signal = ta.ema(macdLine, sigLen)
hist = macdLine - signal

// === PLOTTING ===

// ROC (separate scale)
plot(showROC ? roc : na, title="ROC", color=color.aqua, display=display.none)

// VWAP (on chart)
plot(showVWAP ? vwap : na, title="VWAP", color=color.orange, linewidth=2)

// ATR (separate scale)
plot(showATR ? atr : na, title="ATR", color=color.red, display=display.none)

// RSI (separate scale, 0-100)
plot(showRSI ? rsi : na, title="RSI", color=color.blue, display=display.none)
hline(70, "RSI Overbought", color=color.gray, linestyle=hline.style_dotted)
hline(30, "RSI Oversold", color=color.gray, linestyle=hline.style_dotted)

// MACD (separate scale)
plot(showMACD ? macdLine : na, title="MACD Line", color=color.green, display=display.none)
plot(showMACD ? signal : na, title="Signal Line", color=color.red, display=display.none)
plot(showMACD ? hist : na, title="MACD Histogram", style=plot.style_columns, color=hist>=0 ? color.new(color.green,50) : color.new(color.red,50), display=display.none)

Thông báo miễn trừ trách nhiệm

Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.