Skip to content

Trend Strength Index ​

Correlation of price with time, -1 to 1.

Kind indicator · Drawn in its own pane

Try it ​

On the chart, press / and choose Trend Strength Index under Trend. To change it, copy the source below into the AlphaScript editor.

Inputs ​

InputTypeDefault
Lengthint14
Colorcolor"#2962FF"

Source ​

From packages/alphascript/indicators/trendstrength.as.js.

js
indicator({ name: "Trend Strength Index", shortTitle: "Trend Strength", overlay: false, precision: 2 });
const length = input.int("Length", 14, { min: 2 });
const index = ta.cum(ta.calc([candle.close], () => 1));
plot(ta.correlation(candle.close, index, length), { title: "Trend Strength", color: input.color("Color", "#2962FF", { group: "Style" }) });
hline(0, { title: "Zero", color: "rgba(120,123,134,0.5)", style: "dashed" });

AlphaScript language v0.1 · runtime 0.2.0