RSI DIF
 // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © trade320x24x7

//@version=4
study(title="RSI DIF", shorttitle="RSI DIF", format=format.price, precision=2, resolution="")
len = input(14, minval=1, title="Length")
src = input(close, "Source", type = input.source)
up = rma(max(change(src), 0), len)
down = rma(-min(change(src), 0), len)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))

len2 = input(28, minval=1, title="Length")
up2 = rma(max(change(src), 0), len2)
down2 = rma(-min(change(src), 0), len2)
rsi2 = down2 == 0 ? 100 : up2 == 0 ? 0 : 100 - (100 / (1 + up2 / down2))

dif=rsi-rsi2

plot(dif, "DIF RSI 14&28", color=#8E1599)
band1 = hline(0, "Zero", color=#C0C0C0)
band2 = hline(-4, "Zero", color=#C0C0C0)
band3 = hline(7, "Zero", color=#C0C0C0)