Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=5
- //by SpreadEagle71
- indicator("HLC True Strength Indicator (with Vix)", shorttitle="HLC TSI", format=format.price, precision=4, timeframe="", timeframe_gaps=true)
- long = input(title="Long Length", defval=15)
- short = input(title="Short Length", defval=5)
- signal = input(title="Signal Length", defval=5)
- price = input(close)
- double_smooth(src, long, short) =>
- fist_smooth = ta.vwma(src, long)
- ta.vwma(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 = 99 * (double_smoothed_pc / double_smoothed_abs_pc)
- plot(tsi_value, color=#FFFFFF, linewidth=2)
- hline(0, title="Zero", color=#787B86)
- priceh = high
- pch = ta.change(priceh)
- double_smoothed_pch = double_smooth(pch, long, short)
- double_smoothed_abs_pch = double_smooth(math.abs(pch), long, short)
- tsi_valueh = 99 * (double_smoothed_pch / double_smoothed_abs_pch)
- h1 = plot(tsi_valueh, color=#0000FF,linewidth=2)
- pricel = low
- pcl = ta.change(pricel)
- double_smoothed_pcl = double_smooth(pcl, long, short)
- double_smoothed_abs_pcl = double_smooth(math.abs(pcl), long, short)
- tsi_valuel = 99 * (double_smoothed_pcl / double_smoothed_abs_pcl)
- l1= plot(tsi_valuel, color=#FF0000,linewidth=2)
- vix = request.security('VIX',timeframe.period,close)
- pcv = ta.change(vix)
- double_smoothed_pcv = double_smooth(pcv, long, short)
- double_smoothed_abs_pcv = double_smooth(math.abs(pcv), long, short)
- tsi_valuev = 99 * (double_smoothed_pcv / double_smoothed_abs_pcv)
- plot(tsi_valuev, color=#800080,linewidth=2)
- fill(h1, l1, title = "Background", color=color.rgb(0, 0, 0, 40))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement