xmd79

TSI CCI Hull

Nov 28th, 2021 (edited)
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.40 KB | None | 0 0
  1. //@version=5
  2. // created by SeaSide420
  3. indicator('TSI CCI Hull', shorttitle='TSICCI')
  4. long = input(title='Long Length', defval=35)
  5. short = input(title='Short Length', defval=35)
  6. signal = input(title='Signal Length', defval=13)
  7. price = input(title='Source', defval=open)
  8. Period = input.int(14, minval=1)
  9. lineupper = input(title='Upper Line', defval=100)
  10. linelower = input(title='Lower Line', defval=-100)
  11. p = price
  12. length = Period * 2
  13. double_smooth(src, long, short) =>
  14. fist_smooth = ta.ema(src, long)
  15. ta.ema(fist_smooth, short)
  16. pc = ta.change(price)
  17. double_smoothed_pc = double_smooth(pc, long, short)
  18. double_smoothed_abs_pc = double_smooth(math.abs(pc), long, short)
  19. tsi_value = 100 * (double_smoothed_pc / double_smoothed_abs_pc)
  20. keh = tsi_value * 5 > linelower ? color.red : color.lime
  21. teh = ta.ema(tsi_value * 5, signal * 5) > lineupper ? color.red : color.lime
  22. meh = ta.ema(tsi_value * 5, signal * 5) > tsi_value * 5 ? color.red : color.lime
  23. i1 = plot(tsi_value * 5, title='TSI Value', color=color.new(color.black, 100), linewidth=1)
  24. i2 = plot(ta.ema(tsi_value * 5, signal * 5), title='TSI Signal', color=color.new(color.black, 100), linewidth=1)
  25. fill(i1, i2, color=meh, transp=85)
  26. 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)
  27. 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)
  28. 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)
  29. n2ma = 2 * ta.wma(p, math.round(length / 2))
  30. nma = ta.wma(p, length)
  31. diff = n2ma - nma
  32. sqn = math.round(math.sqrt(length))
  33. n1 = ta.wma(diff, sqn)
  34. cci = (p - n1) / (0.015 * ta.dev(p, length))
  35. c = cci > 0 ? color.lime : color.red
  36. c1 = cci > 20 ? color.lime : color.silver
  37. c2 = cci < -20 ? color.red : color.silver
  38. cc = plot(cci, color=c, title='CCI Line', linewidth=2)
  39. cc2 = plot(cci[1], color=color.new(color.gray, 100), linewidth=1)
  40. fill(cc, cc2, color=c, transp=85)
  41. plot(ta.cross(20, cci) ? 20 : na, style=plot.style_cross, title='CCI cross UP', color=c1, linewidth=2, offset=-2, transp=100)
  42. plot(ta.cross(-20, cci) ? -20 : na, style=plot.style_cross, title='CCI cross down', color=c2, linewidth=2, offset=-2, transp=100)
  43.  
  44.  
Add Comment
Please, Sign In to add comment