TradingView indicators

True Strength Index indicator on TradingView

The True Strength Index indicator (TSI) divides double-smoothed price changes by double-smoothed absolute changes. It shows net momentum around zero. A signal line adds crossover events, but neither line predicts the next price move.

The conventional range is -100 to +100. Pine Script returns a ratio from -1 to +1 unless you scale it. That distinction matters whenever a rule uses a numeric threshold.

How double smoothing produces TSI

Let PC be the current close minus the previous close. Smooth PC with a long EMA, then smooth that result with a short EMA. Apply the same operations to the absolute value of PC. Divide the two results and multiply by 100. The signal line is a separate EMA of the resulting TSI.

Numerator = EMA(EMA(PC, long), short)

Denominator = EMA(EMA(|PC|, long), short)

TSI = 100 × Numerator / Denominator

Signal = EMA(TSI, signal length)

Illustrative calculation: a smoothed signed change of 0.30 and smoothed absolute change of 0.75 produce a TSI of +40. The raw Pine ratio is +0.40. This describes the balance of recent changes, not a 40% expected return or a 40% success probability. When the denominator is zero, the ratio is undefined; do not treat a missing value as a signal.

Since the same positive EMA weights are applied to both series, the absolute numerator cannot exceed the denominator. TSI is bounded; there is simply no universal threshold at which price must reverse. Check the scale before importing levels from another script.

Sources: TradingView calculation guide and Pine Script scaling reference.

Zero crosses, signal crosses, and divergence

Three different TSI observations and their limits
ObservationWhat changedWhat it does not establish
TSI crosses zeroThe smoothed signed change switches sign.The next bar need not continue in that direction.
TSI crosses its signalTSI passes its own moving average.An upward cross below zero still has negative net momentum.
Price and TSI divergePaired swings disagree on the strength of a new price extreme.The disagreement does not date a reversal.

Illustrative cross: yesterday TSI was -12 and its signal was -10. Today they close at -8 and -9. TSI crossed upward through the signal, but remains below zero. A crossover rule accepts this event; a rule requiring positive TSI does not. Decide that distinction before testing.

Define the swing pair before calling it divergence

One explicit bullish-divergence rule pairs two confirmed price lows and compares TSI on those same bars. In a hypothetical example, price lows of 100 then 98 and TSI readings of -30 then -20 qualify. Requiring two bars to the right of each low means the second low is only known two bars later. A backtest cannot enter on the earlier pivot bar using that future confirmation. Reverse the inequalities for bearish divergence.

This price-pivot method is different from separately pairing TSI pivots. Choose one method and define minimum swing spacing. Divergence may persist while price continues against the proposed trade; frequent signal crosses may also reverse without a sustained move. TradingView documents both limitations in its TSI guide.

An open bar can change both lines and erase a crossover. Waiting for the close adds a confirmation delay. Pivot markers drawn backward on a chart can hide a further delay, as explained in TradingView repainting documentation.

Compare smoothing lengths without inventing a best setting

The table is an illustrative experiment, not a performance ranking. Lengths are measured in chart bars. A 25-bar EMA on a five-minute chart uses a different time horizon from a 25-bar EMA on a daily chart; its influence also extends beyond the most recent 25 bars.

Hypothetical TSI parameter comparisons
Long / short / signalPurposeExpected mechanical tradeoff
25 / 13 / 13Baseline used in this exampleTwo smoothing stages, followed by a signal EMA.
15 / 7 / 13Change momentum smoothing onlyShorter memory; greater sensitivity to recent price changes.
40 / 20 / 13Change momentum smoothing onlyLonger memory; more smoothing and generally later turns.
25 / 13 / 7Change the signal line onlyTSI is unchanged; its signal line follows it more closely.

Changing the signal length cannot change zero crossings because it does not change TSI itself. It can change signal-line crossings. Shorter smoothing does not imply better entries, and longer smoothing does not guarantee fewer losing trades.

For a reproducible comparison, hold the symbol, session, price source, date window, entries, exits, position size, fees, and slippage fixed. Record event counts and the number of bars between a price turn and each confirmation. If evaluating trades, include drawdown and turnover. Check nearby parameter values and a separate period before accepting a result that depends on one isolated setting.

Pine Script v6 with confirmed crossover alerts

Copy this indicator into TradingView Pine Editor and add it to a chart. The inputs begin at long 25, short 13, and signal 13. The function call takes short length before long length. Both plotted lines use the -100 to +100 scale.

Pine Script v6
//@version=6
indicator("True Strength Index: confirmed crosses", overlay = false)

source = input.source(close, "Source")
longLength = input.int(25, "Long length", minval = 1)
shortLength = input.int(13, "Short length", minval = 1)
signalLength = input.int(13, "Signal length", minval = 1)

// Convert the built-in ratio to the -100 to +100 scale.
tsi = 100 * ta.tsi(source, shortLength, longLength)
signal = ta.ema(tsi, signalLength)

plot(tsi, "TSI", color = color.blue, linewidth = 2)
plot(signal, "Signal", color = color.orange, linewidth = 2)
hline(0, "Zero", color = color.gray)

// Evaluate crosses each bar, then require the bar to close.
crossUp = ta.crossover(tsi, signal)
crossDown = ta.crossunder(tsi, signal)
confirmedUp = crossUp and barstate.isconfirmed
confirmedDown = crossDown and barstate.isconfirmed

plotshape(confirmedUp, "Confirmed up cross", shape.triangleup, location.bottom, color.blue, size = size.tiny)
plotshape(confirmedDown, "Confirmed down cross", shape.triangledown, location.top, color.orange, size = size.tiny)
alertcondition(confirmedUp, "TSI above signal", "TSI crossed above its signal line on a closed bar.")
alertcondition(confirmedDown, "TSI below signal", "TSI crossed below its signal line on a closed bar.")

The blue upward and orange downward markers use closed bars. Create an alert from the matching condition in TradingView and select Once Per Bar Close. The live lines still update during an open bar. This example does not detect divergence, place orders, or produce a strategy backtest; those require additional rules.

Build a TSI rule in Pineify

The Pineify Visual Editor includes True Strength Index inputs for the source, long length, short length, and signal length, with separate TSI and Signal outputs. Its existing TSI output uses the raw ratio scale. A +25 threshold in the example on this page therefore corresponds to +0.25 in that output; zero and line-to-line crosses are unaffected when both lines use the same scale.

Use the Visual Editor to combine TSI outputs with other conditions, or ask the AI Coding Agent to write an explicit rule. For example: "Use TSI 25/13/13. Mark an upward signal cross only at bar close and only when TSI is above zero. Expose all lengths as inputs." Review the generated conditions on a TradingView chart.

To compare trading outcomes, first define a strategy with exits and position sizing. Then use Strategy Optimizer to compare exposed input combinations. Evaluate neighboring settings and an untouched test period yourself; an optimized historical result is not evidence of future profitability.

Build a TSI rule with the AI Coding Agent

TSI questions

TSI compares double-smoothed signed price changes with double-smoothed absolute price changes. Its sign describes net momentum direction; a signal line compares that momentum with its own recent average. It does not measure order flow or the probability of a profitable trade.

Yes. With a defined, nonzero denominator, the conventional TSI scale runs from -100 to +100. Pine Script ta.tsi() returns the ratio from -1 to +1, so multiply it by 100 when using percentage-scale levels. Fixed bounds do not establish universal overbought or oversold thresholds.

There is no universal best setting. This example starts with long 25, short 13, and signal 13, matching the Pineify TSI configuration. Compare nearby lengths on the same data and trading rules, then check an untouched period with fees and slippage included.

The TSI line can move while the current bar is open because its price input changes. This example waits for the bar to close before marking crossovers. That does not prevent feed revisions or changes caused by different input data, and it does not make every higher-timeframe or divergence script safe from repainting.

No. Both may be abbreviated TSI, but True Strength Index uses double-smoothed price changes. The TradingView Trend Strength Index calculates the correlation between closing prices and bar index values. Check the full indicator name when adding it to a chart.

Yes. TSI can rise above its signal line while both remain negative. That shows an improvement relative to the signal line, while net smoothed momentum is still negative. A rule requiring TSI above zero would reject that crossover.

Sources and related reading

Official references checked October 16, 2026.

Compare this calculation with MACD, or review RSI for a different momentum measure. Browse the TradingView indicator guides for related chart tools.

Educational information, not investment advice. Numbers and parameter comparisons on this page are illustrative, not backtest results. Indicators and historical tests cannot guarantee returns.