TOTAL:(RSI+TSI)
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © gokhanpirnal

//@version=5
indicator('TOTAL:(RSI+TSI)', shorttitle='TOTAL:(RSI+TSI)', format=format.price, precision=4, timeframe='')
long = input(title='TSI Long Length', defval=1)
short = input(title='TSI Short Length', defval=1)
signal = input(title='TSI Signal Length', defval=2)
price = close
double_smooth(src, long, short) =>
    fist_smooth = ta.ema(src, long)
    ta.ema(fist_smooth, short)
pc = ta.change(price)
double_smoothed_pc = double_smooth(pc, long, short)
double_smoothed_abs_pc = double_smooth(math.abs(pc), long, short)
tsi_value = 100 * (double_smoothed_pc / double_smoothed_abs_pc)

len = input.int(2, minval=1, title='RSI Length')
src = input(close, 'Source')
up = ta.rma(math.max(ta.change(src), 0), len)
down = ta.rma(-math.min(ta.change(src), 0), len)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - 100 / (1 + up / down)

toplam = tsi_value + ta.ema(tsi_value, signal) + rsi
plot(toplam, 'Toplam', color=color.new(#00FF00, 0), linewidth=2)
hline(300, title='Üst Sınır', color=#00FFFF)
hline(-200, title='Alt Sınır', color=#00FFFF)