True Strength Index (TSI)
Summary
True Strength Index: William Blau's double-smoothed momentum oscillator. The one-bar price change is smoothed twice with exponential averages, and the same pair of averages is applied to the magnitude of that change; the ratio of the two is scaled by 100. Dividing the smoothed signed momentum by the smoothed absolute momentum normalises the reading, so the result is bounded by -100 and +100 and comparable across instruments. The double smoothing is what separates it from a raw momentum plot: the curve is smooth enough to read while keeping far less lag than a single average of the same total length.
Zero is the reference line — positive means the smoothed momentum is net upward, negative net downward — and its crossings are the usual trade trigger. Extreme readings mark overbought and oversold conditions, and divergence against price is the classic Blau reading. A signal line is not part of the output; apply EMA to outReal to obtain one, since no source agrees on its period.
Chart
Chart metadata i
Outputs
outReal:line·zero·positive·negative
Formula
m = close - previous close
TSI = 100 * EMA(EMA(m, firstPeriod), secondPeriod) / EMA(EMA(|m|, firstPeriod), secondPeriod)
The first period is applied first, to the raw change; the second smooths its result. The order matters: the two averages do not commute, because each is seeded from a simple average of its own inputs.
Notes
- An input whose every change is exactly zero leaves both the numerator and the denominator at zero. Rather than divide, TSI emits 0 there, its neutral value, as CCI and IMI emit theirs. Some implementations divide unguarded and return a non-finite value.
- Each exponential average is seeded with a simple average of its own first inputs, the same seeding TA-Lib's EMA uses, so the first published values converge toward an unlimited-history result rather than reproducing it exactly.
TA_SetUnstablePeriod(TA_FUNC_UNST_EMA, ...)discards more of that warm-up. Implementations seeding from a single first sample — trading-signals among them — differ over the transient and agree once it decays. - The parameters are named by the order they are applied in, not fast and slow. Blau's published pair applies the longer average first, the inverse of the differenced fast/slow pairs elsewhere in the library, so swapping them silently returns a different indicator with the same lookback.
Inputs
inReal— Source price/value series, canonically the close
Outputs
outReal— True Strength Index, -100 to +100
Parameters
| Parameter | Type | Default | Accepted values | Description |
|---|---|---|---|---|
optInFirstPeriod | integer | 25 | 2–100000 | Period of the first smoothing, applied to the raw momentum |
optInSecondPeriod | integer | 13 | 2–100000 | Period of the second smoothing, applied to the first |
Properties
Numerical Stability: Initial Unstable Period — Inherited from EMA, which TSI computes internally; tunable via EMA's unstable period.
| ☐ Overlap Input |
| ✅ Independent Y-Axis i |
| ☐ Candlestick |
| ☐ Display Shift |
| ☐ Can Output NaN or ±Inf |
| ☐ Identity at Period 1 |
| ☐ Uses Transcendental |
| ☐ Input Must Be Positive |
Example
#include <stdio.h>
#include <ta_libc.h>
int n = 252;
double series[252]; /* your data, oldest first */
double out[252];
int outBegIdx, outNBElement;
TA_Initialize();
TA_TSI( 0, n - 1, series, 25, 13, &outBegIdx, &outNBElement, out );
printf( "%d values from bar %d: [%.4f, ..., %.4f]\n", outNBElement, outBegIdx, out[0], out[outNBElement - 1] );use ta_lib::Core;
let series = vec![0.0; 252]; // your data, oldest first
let mut out = vec![0.0; 252];
let core = Core::new();
let range = core.tsi(0, series.len() - 1, &series, 25, 13, &mut out)?;
println!("{} values from bar {}: [{:.4}, ..., {:.4}]", range.count, range.beg_idx, out[0], out[range.count - 1]);import io.github.talib.Core;
import io.github.talib.OutRange;
import java.util.Locale;
double[] series = new double[252]; // your data, oldest first
double[] out = new double[252];
Core core = Core.DEFAULT;
OutRange r = core.tsi(0, series.length - 1, series, 25, 13, out);
System.out.printf(Locale.ROOT, "%d values from bar %d: [%.4f, ..., %.4f]%n", r.count(), r.begIdx(), out[0], out[r.count() - 1]);using System;
using TALib;
var series = new double[252]; // your data, oldest first
var outReal = new double[252];
var core = Core.Default;
OutRange r = core.Tsi(0, series.Length - 1, series, 25, 13, outReal);
Console.WriteLine(FormattableString.Invariant($"{r.Count} values from bar {r.BegIdx}: [{outReal[0]:F4}, ..., {outReal[r.Count - 1]:F4}]"));import { tsi } from 'ta-lib';
const series = new Float64Array(252); // your data, oldest first
const { begIdx, values } = tsi(series, { firstPeriod: 25, secondPeriod: 13 });
console.log(values.length + ' values from bar ' + begIdx + ': [' + values[0].toFixed(4) + ', ..., ' + values[values.length - 1].toFixed(4) + ']');import (
"fmt"
"log"
talib "ta-lib.github.io/go"
)
series := make([]float64, 252) // your data, oldest first
out := make([]float64, 252)
core := talib.NewCore()
r, err := core.TSI(0, len(series)-1, series, 25, 13, out)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])Implementation
Added in 0.8.1 (ta-lib-python 0.8.1).
TA-Lib Definition: tsi.c · tsi.yaml
| Native | File |
|---|---|
| C | ta_TSI.c |
| Rust | tsi.rs |
| Java | Core_TSI.java |
| C# | Core_TSI.cs |
| TypeScript | tsi.ts |
| Go | tsi.go |
Python: talib.TSI (ta-lib-python 0.8.1 or later), see ta-lib-python.
TA-Lib is also available for R and more using a wrapper.
Aliases
true strength index, Blau true strength index
See Also
References
- William Blau, "True Strength Index", Technical Analysis of Stocks & Commodities, v9:11 (November 1991), pp. 438-446
- William Blau, Momentum, Direction and Divergence, Wiley 1995 (ISBN 0471027294)
- StockCharts: True Strength Index