Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=5
- // created by SeaSide420
- indicator('TSI CCI Hull', shorttitle='TSICCI')
- long = input(title='Long Length', defval=35)
- short = input(title='Short Length', defval=35)
- signal = input(title='Signal Length', defval=13)
- price = input(title='Source', defval=open)
- Period = input.int(14, minval=1)
- lineupper = input(title='Upper Line', defval=100)
- linelower = input(title='Lower Line', defval=-100)
- p = price
- length = Period * 2
- 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)
- keh = tsi_value * 5 > linelower ? color.red : color.lime
- teh = ta.ema(tsi_value * 5, signal * 5) > lineupper ? color.red : color.lime
- meh = ta.ema(tsi_value * 5, signal * 5) > tsi_value * 5 ? color.red : color.lime
- i1 = plot(tsi_value * 5, title='TSI Value', color=color.new(color.black, 100), linewidth=1)
- i2 = plot(ta.ema(tsi_value * 5, signal * 5), title='TSI Signal', color=color.new(color.black, 100), linewidth=1)
- fill(i1, i2, color=meh, transp=85)
- plot(ta.cross(tsi_value * 5, ta.ema(tsi_value * 5, signal * 5)) ? tsi_value * 5 : na, style=plot.style_circles, color=color.new(color.black, 0), linewidth=10)
- plot(ta.cross(tsi_value * 5, ta.ema(tsi_value * 5, signal * 5)) ? tsi_value * 5 : na, style=plot.style_circles, color=color.new(color.white, 0), linewidth=8)
- plot(ta.cross(tsi_value * 5, ta.ema(tsi_value * 5, signal * 5)) ? tsi_value * 5 : na, style=plot.style_circles, color=meh, linewidth=5)
- n2ma = 2 * ta.wma(p, math.round(length / 2))
- nma = ta.wma(p, length)
- diff = n2ma - nma
- sqn = math.round(math.sqrt(length))
- n1 = ta.wma(diff, sqn)
- cci = (p - n1) / (0.015 * ta.dev(p, length))
- c = cci > 0 ? color.lime : color.red
- c1 = cci > 20 ? color.lime : color.silver
- c2 = cci < -20 ? color.red : color.silver
- cc = plot(cci, color=c, title='CCI Line', linewidth=2)
- cc2 = plot(cci[1], color=color.new(color.gray, 100), linewidth=1)
- fill(cc, cc2, color=c, transp=85)
- plot(ta.cross(20, cci) ? 20 : na, style=plot.style_cross, title='CCI cross UP', color=c1, linewidth=2, offset=-2, transp=100)
- plot(ta.cross(-20, cci) ? -20 : na, style=plot.style_cross, title='CCI cross down', color=c2, linewidth=2, offset=-2, transp=100)
Add Comment
Please, Sign In to add comment