Skip to content

Technical indicators

True Strength Index (TSI)

The direction and steadiness of recent price changes, from −100 to +100.

TSI smooths the bar-to-bar change twice with exponential moving averages, and divides by the same smoothing of the absolute change. A steady rise gives a value near +100; choppy moves give values near zero.

Traders read crosses of zero and of the signal line, and readings beyond ±25 as strong.

change = close − previous close
TSI = EMA(EMA(change, first), second) / EMA(EMA(|change|, first), second) × 100
signal = EMA(TSI, signalPeriods)

Call: tsi(firstPeriods, secondPeriods, signalPeriods)

Setting Chart default
firstPeriods: First Periods 25
secondPeriods: Second Periods 13
signalPeriods: Signal Periods 9

What you get: a list of 2, in this order: 1. a number (“tsi”); 2. a number (“tsi Signal”).

Warm-up: with tsi(25, 13, 9), it asks for 2 bars of history and a run-up of 94, and its first value came on bar 47 of the example data.

True Strength Index (TSI) drawn by its own code on example prices

The prices are made up, hourly, and the same on every page, so the chart shows how the indicator behaves, not how a market behaved.

function onIntervalClose() {
const lines = tsi(25, 13, 9);
if (OPEN_POSITIONS_COUNT === 0 && lines[0] > lines[1] && lines[0] < -25) {
openPosition("BUY", { quantity: 10000, stopLossPips: 25, takeProfitPips: 50 });
}
}

Without signalPeriods, tsi(25, 13) gives a single number.