indicator · own pane · open source
RSI of MACD
Running…
Loading chart…
About
RSI of MACD runs RSI over the MACD histogram so momentum extremes on the MACD become 0-100 RSI levels. Picks up MACD divergences cleanly.
- Above 70 = MACD histogram overbought.
- Below 30 = MACD histogram oversold.
- Raise
RSI Lengthfor smoother output.
Source code
//@version=5
indicator("RSI of MACD", overlay=false)
fast = input.int(12, "MACD Fast", minval=2, maxval=100)
slow = input.int(26, "MACD Slow", minval=2, maxval=200)
sig = input.int(9, "MACD Signal", minval=2, maxval=50)
len = input.int(14, "RSI Length", minval=2, maxval=200)
src = input.source("close", "Source")
[m, s, h] = ta.macd(src, fast, slow, sig)
rsiMacd = ta.rsi(h, len)
hline(70, "Overbought", color=color.gray, linestyle=hline.style_dashed)
hline(30, "Oversold", color=color.gray, linestyle=hline.style_dashed)
hline(50, "Midline", color=color.gray, linestyle=hline.style_dotted)
p_RSI_of_MACD = plot(rsiMacd, "RSI of MACD", color=color.maroon, linewidth=2)
alertcondition(ta.crossunder(rsiMacd, 30), "RSI of MACD oversold", "RSI of MACD crossed below 30")
alertcondition(ta.crossover(rsiMacd, 70), "RSI of MACD overbought", "RSI of MACD crossed above 70")
No comments yet.
Sign in to comment.