//version=5
indicator("XAUUSD Custom Momentum Indicator", overlay=false)
// --- RSI ---
rsiLength = input.int(14, title="RSI Length")
rsiSource = close
rsiValue = ta.rsi(rsiSource, rsiLength)
// --- MACD ---
fastLength = input.int(12, title="MACD Fast Length")
slowLength = input.int(26, title="MACD Slow Length")
signalLength = input.int(9, title="MACD Signal Length")
[macdLine, signalLine, macdHist] = ta.macd(close, fastLength, slowLength, signalLength)
// --- Volume Filter ---
volLength = input.int(20, title="Volume SMA Length")
volAvg = ta.sma(volume, volLength)
volMultiplier = input.float(1.5, title="Volume Threshold Multiplier")
volSignal = volume > volAvg * volMultiplier
// --- Momentum Confirmation ---
rsiBull = rsiValue > 50
macdBull = macdHist > 0
momentumUp = rsiBull and macdBull and volSignal
rsiBear = rsiValue < 50
macdBear = macdHist < 0
momentumDown = rsiBear and macdBear and volSignal
// --- Plot RSI and MACD Histogram ---
plot(rsiValue, title="RSI", color=color.blue)
hline(70, "Overbought", color=color.red, linestyle=hline.style_dotted)
hline(30, "Oversold", color=color.green, linestyle=hline.style_dotted)
plot(macdHist, title="MACD Histogram", color=(macdHist >= 0 ? color.green : color.red), style=plot.style_histogram)
// --- Plot signals ---
plotshape(momentumUp, title="Bullish Momentum", location=location.bottom, shape=shape.triangleup, color=color.green, size=size.small, text="UP")
plotshape(momentumDown, title="Bearish Momentum", location=location.top, shape=shape.triangledown, color=color.red, size=size.small, text="DOWN")
// --- Alerts ---
alertcondition(momentumUp, title="Bullish Momentum Alert", message="XAUUSD Momentum Up (RSI+MACD+Volume)")
alertcondition(momentumDown, title="Bearish Momentum Alert", message="XAUUSD Momentum Down (RSI+MACD+Volume)")
indicator("XAUUSD Custom Momentum Indicator", overlay=false)
// --- RSI ---
rsiLength = input.int(14, title="RSI Length")
rsiSource = close
rsiValue = ta.rsi(rsiSource, rsiLength)
// --- MACD ---
fastLength = input.int(12, title="MACD Fast Length")
slowLength = input.int(26, title="MACD Slow Length")
signalLength = input.int(9, title="MACD Signal Length")
[macdLine, signalLine, macdHist] = ta.macd(close, fastLength, slowLength, signalLength)
// --- Volume Filter ---
volLength = input.int(20, title="Volume SMA Length")
volAvg = ta.sma(volume, volLength)
volMultiplier = input.float(1.5, title="Volume Threshold Multiplier")
volSignal = volume > volAvg * volMultiplier
// --- Momentum Confirmation ---
rsiBull = rsiValue > 50
macdBull = macdHist > 0
momentumUp = rsiBull and macdBull and volSignal
rsiBear = rsiValue < 50
macdBear = macdHist < 0
momentumDown = rsiBear and macdBear and volSignal
// --- Plot RSI and MACD Histogram ---
plot(rsiValue, title="RSI", color=color.blue)
hline(70, "Overbought", color=color.red, linestyle=hline.style_dotted)
hline(30, "Oversold", color=color.green, linestyle=hline.style_dotted)
plot(macdHist, title="MACD Histogram", color=(macdHist >= 0 ? color.green : color.red), style=plot.style_histogram)
// --- Plot signals ---
plotshape(momentumUp, title="Bullish Momentum", location=location.bottom, shape=shape.triangleup, color=color.green, size=size.small, text="UP")
plotshape(momentumDown, title="Bearish Momentum", location=location.top, shape=shape.triangledown, color=color.red, size=size.small, text="DOWN")
// --- Alerts ---
alertcondition(momentumUp, title="Bullish Momentum Alert", message="XAUUSD Momentum Up (RSI+MACD+Volume)")
alertcondition(momentumDown, title="Bearish Momentum Alert", message="XAUUSD Momentum Down (RSI+MACD+Volume)")
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
