DMI - ADX - RSI - Level
DMI - ADX - RSI - Level
// © kkg80
//ADX + DMI
dirmov(len) =>
up = change(high)
down = -change(low)
truerange = rma(tr, len)
plus = fixnan(100 * rma(up > down and up > 0 ? up : 0, len) / truerange)
minus = fixnan(100 * rma(down > up and down > 0 ? down : 0, len) / truerange)
[plus, minus]
//RSI
len = input(14, minval=1, title="RSI")
up1 = rma(max(change(src), 0), len)
down1 = rma(-min(change(src), 0), len)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up1 / down1))
plot(rsi,title="RSI", color=color.black)
band1 = hline(60, title="Upper RSI level")
band0 = hline(40, title="Lower RSI level")
fill(band1, band0, color=color.green, transp=90)