Advertisement
xmd79

HLC True Strength Indicator (with Vix)

Jan 3rd, 2023 (edited)
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. //@version=5
  2. //by SpreadEagle71
  3. indicator("HLC True Strength Indicator (with Vix)", shorttitle="HLC TSI", format=format.price, precision=4, timeframe="", timeframe_gaps=true)
  4. long = input(title="Long Length", defval=15)
  5. short = input(title="Short Length", defval=5)
  6. signal = input(title="Signal Length", defval=5)
  7. price = input(close)
  8. double_smooth(src, long, short) =>
  9. fist_smooth = ta.vwma(src, long)
  10. ta.vwma(fist_smooth, short)
  11. pc = ta.change(price)
  12. double_smoothed_pc = double_smooth(pc, long, short)
  13. double_smoothed_abs_pc = double_smooth(math.abs(pc), long, short)
  14. tsi_value = 99 * (double_smoothed_pc / double_smoothed_abs_pc)
  15. plot(tsi_value, color=#FFFFFF, linewidth=2)
  16.  
  17.  
  18.  
  19. hline(0, title="Zero", color=#787B86)
  20.  
  21. priceh = high
  22. pch = ta.change(priceh)
  23. double_smoothed_pch = double_smooth(pch, long, short)
  24. double_smoothed_abs_pch = double_smooth(math.abs(pch), long, short)
  25. tsi_valueh = 99 * (double_smoothed_pch / double_smoothed_abs_pch)
  26. h1 = plot(tsi_valueh, color=#0000FF,linewidth=2)
  27.  
  28. pricel = low
  29. pcl = ta.change(pricel)
  30. double_smoothed_pcl = double_smooth(pcl, long, short)
  31. double_smoothed_abs_pcl = double_smooth(math.abs(pcl), long, short)
  32. tsi_valuel = 99 * (double_smoothed_pcl / double_smoothed_abs_pcl)
  33. l1= plot(tsi_valuel, color=#FF0000,linewidth=2)
  34.  
  35. vix = request.security('VIX',timeframe.period,close)
  36.  
  37. pcv = ta.change(vix)
  38. double_smoothed_pcv = double_smooth(pcv, long, short)
  39. double_smoothed_abs_pcv = double_smooth(math.abs(pcv), long, short)
  40. tsi_valuev = 99 * (double_smoothed_pcv / double_smoothed_abs_pcv)
  41. plot(tsi_valuev, color=#800080,linewidth=2)
  42.  
  43.  
  44. fill(h1, l1, title = "Background", color=color.rgb(0, 0, 0, 40))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement