//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)")
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como asesoramiento o recomendaciones financieras, de inversión, de trading o de otro tipo proporcionadas o respaldadas por TradingView. Más información en Condiciones de uso.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como asesoramiento o recomendaciones financieras, de inversión, de trading o de otro tipo proporcionadas o respaldadas por TradingView. Más información en Condiciones de uso.
