indicator · own pane · open source
Trend Quality Index indicator
Trend Quality Index is a free open-source indicator. Trend Quality Index (TQI) — |close − SMA| divided by the standard deviation of close. Deepwick Script runs a subset of Pine Script.
Running…
Loading chart…
What Trend Quality Index does
Trend Quality Index (TQI) — |close − SMA| divided by the standard deviation of close. Higher = price is far from its own mean (trending / stretched); lower = price is hugging the mean (ranging).
- Use 1.5 as the 'overextended' stall to fade; 0.5 as the 'ranging' stall to breakout-trade.
Source code
Deepwick Script, a subset of Pine Script · read-only
//@version=6
indicator("Trend Quality Index", overlay=false)
len = input.int(20, "Length", minval=5, maxval=100)
colorMid2 = input.color("color.teal", "Color Mid2")
colorNeutral = input.color("color.gray", "Color Neutral")
tqi = math.abs(close - ta.sma(close, len)) / math.max(ta.stdev(close, len), 0.0001)
hline(1.5, "Stretched", color=colorNeutral)
hline(0.5, "Ranging", color=colorNeutral)
p_TQI = plot(tqi, "TQI", color=colorMid2, linewidth=2)
alertcondition(ta.crossover(tqi, 1.5), "Overextended", "TQI crossed above 1.5 — overextended")
alertcondition(ta.crossunder(tqi, 0.5), "Squeezed", "TQI below 0.5 — ranging")
No comments yet.
Sign in to comment.