//@version=4 study(title="TRSI WITH HISTOGRAM", shorttitle="TRSI") len = input(9, minval=1, title="LENGTH TRSI") out = 10000 * change(ema(ema(ema(log(close), len), len), len)) len_2 = input(9, minval=1, title="LENGTH RSI") up = rma(max(change(out), 0), len_2) down = rma(-min(change(out), 0), len_2) trsi = down == 0 ? 100 : up == 0 ? 0 : 100 - 100 / (1 + up / down) lenema = input(9, minval=1, title="LENGTH EMA") outema = ema(trsi, lenema) histtrsi = trsi - outema // Plot colors col_grow_above = #009688 col_grow_below = #ffb74d col_fall_above = #a5d6a7 col_fall_below = #f44336 plot(histtrsi, title="HISTOGRAM", style=plot.style_columns, color=histtrsi >= 0 ? histtrsi[1] < histtrsi ? col_grow_above : col_fall_above : histtrsi[1] < histtrsi ? col_grow_below : col_fall_below, linewidth=1, transp=0) hline(0, title="Zero") plot(trsi, color=color.blue, transp=0) plot(outema, title="EMA", color = color.orange, transp=0) band1 = hline(70) band0 = hline(30) fill(band1, band0, color=color.purple, transp=95)