MomentumPine Script v6

True Strength Index Pine Script — Complete TradingView Guide

The True Strength Index (TSI) is a double-smoothed momentum oscillator available in Pine Script v6 via ta.tsi(source, short_length, long_length). TSI measures price momentum by applying exponential smoothing twice to raw price changes, producing a cleaner oscillator signal than single-smoothed momentum indicators. The default TSI settings are long_length 25 and short_length 13 — the values William Blau specified when he introduced the indicator in 1991. TSI oscillates roughly between −100 and +100, with the zero line serving as the key bull/bear boundary. A 13-period EMA signal line is overlaid on the TSI to generate crossover buy and sell signals, similar to how the MACD signal line works. This guide covers the complete Pine Script v6 implementation, all configurable parameters with recommended ranges, three TSI trading strategies including signal-line crossovers and divergence, plus a five-step guide to generating TSI scripts instantly using Pineify.

What Is the True Strength Index?

The True Strength Index (TSI) is a double-smoothed momentum oscillator that measures the direction and strength of price momentum, used to identify trend direction, overbought and oversold conditions, and signal-line crossovers. Unlike the Relative Strength Index (RSI), which is bounded between 0 and 100, the TSI oscillates symmetrically around zero — positive values indicate upward momentum, negative values indicate downward momentum, and values near zero indicate consolidation or trend transitions.

William Blau developed the True Strength Index and first published it in Stocks & Commodities magazine in 1991, later presenting it in depth in his 1995 book "Momentum, Direction, and Divergence." Blau's key insight was that raw price momentum — simply measuring how much price changed from one bar to the next — is too noisy for reliable trading signals. By applying exponential moving average smoothing twice in sequence (first a short-period EMA, then a long-period EMA), Blau created an oscillator that preserves genuine trend momentum while eliminating most short-term noise.

Core formula: TSI = 100 × (Double Smoothed Price Change ÷ Double Smoothed Absolute Price Change), where the price change is the 1-bar momentum: pc = close − close[1]. The double smoothing applies EMA(EMA(pc, short_length), long_length) to the raw momentum, and the same double smoothing to abs(pc) to normalize the result. In Pine Script v6, the full calculation is handled automatically by ta.tsi(close, 13, 25). A separate signal line is computed as ta.ema(tsi_value, 13).

The TSI applies equally well across all major asset classes: stocks, crypto, forex, and futures. It excels in trending environments — where the double-smoothed momentum confirms directional conviction — and provides reliable divergence signals at market tops and bottoms. Best timeframes are 1H to Daily charts. On the daily chart, the default 25/13 setting works well for multi-day swing trades. On 4H charts, a 13/7 setting provides faster responses to momentum shifts. On weekly charts, increasing the long period to 40 reduces false crossovers caused by weekly volatility.

Best Markets

Stocks · Crypto · Forex · Futures

Best Timeframes

1H, 4H, Daily

Overlay

No — separate oscillator panel

TSI Pine Script Code Example

The code below implements a True Strength Index oscillator in Pine Script v6 using ta.tsi(close, 13, 25) with a 13-period EMA signal line — the configuration William Blau recommended. To add it to TradingView, open the Pine Script editor with Alt+P, paste the code, and click Add to chart. The TSI will appear in a separate panel below the price chart, with the blue TSI line crossing the red signal line to generate buy and sell signals.

Pine Script v6
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Pineify

//@version=6
indicator(title="True Strength Index", overlay=false, max_labels_count=500)

// TSI — double-smoothed momentum oscillator that filters short-term noise
// Parameters: source=close, long_length=25, short_length=13, signal_length=13
p_ta_tsi(series float source, simple int long_length, simple int short_length, simple int signal_length) =>
    tsi_value = ta.tsi(source, short_length, long_length)
    signal = ta.ema(tsi_value, signal_length)
    [tsi_value, signal]

[p_ind_1_tsi, p_ind_1_signal] = p_ta_tsi(close, 25, 13, 13) // TSI

// Plot TSI line and Signal line
plot(p_ind_1_tsi, title="TSI", color=color.rgb(41, 98, 255, 0), linewidth=1)
plot(p_ind_1_signal, title="TSI - Signal", color=color.rgb(233, 30, 99, 0), linewidth=1)
hline(0, title="TSI - Zero", color=#787B86)

Chart Preview

True Strength Index indicator Pine Script code example in TradingView — TSI with signal line crossovers

TSI Parameters

ParameterDefault ValueDescriptionRecommended Range
sourcecloseThe price series used for the 1-bar momentum calculation. The default close is the most common choice. Can be changed to hlc3 (typical price) or any numeric series.close (recommended), hlc3
long_length25The period for the outer (second) exponential smoothing pass. A larger value produces a smoother TSI line with fewer crossovers and a longer lag. Blau recommended 25 bars for daily charts.13–40 (most common: 25)
short_length13The period for the inner (first) exponential smoothing pass applied to the raw 1-bar momentum. Controls how quickly the TSI reacts to recent price changes. Smaller values produce faster but noisier readings.5–20 (most common: 13)
signal_length13The period of the EMA applied to the TSI line to create the signal line. TSI crossing above the signal line is a buy signal; crossing below is a sell signal. Shorter values generate more frequent crosses.7–21 (most common: 13)

Tuning Guide by Trading Style

  • Scalping (5m–15m charts): long=13, short=7, signal=7 — faster response; expect more frequent crossovers and greater sensitivity to short-term momentum shifts
  • Day trading (1H–4H charts): long=20, short=10, signal=10 — balanced speed; suitable for intraday trend identification with clear signal-line crossovers
  • Swing trading (Daily charts): long=25, short=13, signal=13 — Blau's original daily settings; best for multi-day trend confirmation
  • Position trading (Weekly charts): long=40, short=20, signal=10 — smoother oscillator that filters weekly volatility for major trend identification in stocks and indices

TSI Trading Strategies

The TSI is most effective as a signal-line crossover system in trending markets and as a divergence detector at market turning points. Below are three concrete strategies with specific entry and exit conditions.

Strategy 1 — TSI Signal-Line Crossover

Market environment: trending markets · Best timeframe: Daily, 4H

The TSI signal-line crossover is the primary strategy Blau designed the indicator for. When the TSI line crosses above its signal line (EMA of TSI), momentum is turning bullish; a cross below signals bearish momentum. Pair with ADX(14) above 20 to confirm that a genuine trend is in place and reduce false crossovers in sideways markets.

  1. Calculate TSI and signal line: tsi = ta.tsi(close, 13, 25) and signal = ta.ema(tsi, 13)
  2. Add ADX trend filter: [_, adxVal, _] = ta.dmi(14, 14)
  3. Long entry: ta.crossover(tsi, signal) AND adxVal > 20 — TSI turns bullish in a confirmed trending environment
  4. Short entry: ta.crossunder(tsi, signal) AND adxVal > 20 — TSI turns bearish with trend confirmation
  5. Exit: TSI crosses back in the opposite direction through the signal line, or TSI reaches the opposite extreme (above +25 for longs, below −25 for shorts)

Strategy 2 — TSI Zero-Line Crossover Trend Follow

Market environment: strongly trending markets · Best timeframe: Daily, 1H

The TSI zero-line crossover uses the 0 level as a trend-direction filter. TSI crossing above 0 confirms bullish momentum is dominant; crossing below 0 confirms bearish momentum. Use SMA 200 as a macro trend filter to take only momentum-aligned zero-line crosses.

  1. Calculate macro trend filter: sma200 = ta.sma(close, 200)
  2. Calculate TSI: tsi = ta.tsi(close, 13, 25)
  3. Long entry: ta.crossover(tsi, 0) AND close > sma200 — TSI turns positive in a bull market
  4. Avoid: zero-line long crossovers when price is below SMA 200 — these are counter-trend entries in a bear market with significantly lower win rates
  5. Exit: ta.crossunder(tsi, 0) — TSI returns below zero, indicating momentum has shifted bearish

Strategy 3 — TSI Divergence + MFI Confirmation

Market environment: trending markets approaching exhaustion · Best timeframe: 4H, Daily

TSI divergence — price making new highs while TSI makes lower highs — is one of the earliest trend exhaustion signals. Because TSI is double-smoothed, its divergence signals are more reliable than raw momentum divergence. Pair with Money Flow Index (MFI): a bearish TSI divergence confirmed by MFI dropping below 50 adds volume-based confirmation. In Pine Script v6: mfi = ta.mfi(hlc3, 14).

  1. Calculate TSI: tsi = ta.tsi(close, 13, 25)
  2. Calculate MFI confirmation: mfi = ta.mfi(hlc3, 14)
  3. Bearish divergence signal: price makes a higher high AND TSI makes a lower high compared to the prior swing AND MFI falls below 50 — momentum and volume are weakening despite higher prices
  4. Bullish divergence signal: price makes a lower low AND TSI makes a higher low AND MFI rises above 50 — selling pressure is exhausting with improving money flow
  5. Entry: wait for TSI to cross its signal line in the reversal direction after the divergence forms — this confirms momentum has actually shifted before entering the trade

Disclaimer: The strategies above are for educational purposes only and do not constitute investment advice. Past performance does not guarantee future results. Always apply proper risk management and position sizing.

How to Generate the TSI Indicator in Pineify

  1. 1

    Open Pineify

    Go to pineify.app and sign in — a free account is sufficient to generate TSI indicators and other Pine Script oscillators.

  2. 2

    Click "New Indicator"

    Select "Indicator" as the script type from the creation menu on the Pineify dashboard.

  3. 3

    Describe the TSI configuration you want

    Type a prompt such as: "Plot a True Strength Index with long_length 25, short_length 13, and a 13-period EMA signal line." Pineify's AI Coding Agent generates the complete Pine Script v6 code in seconds.

  4. 4

    Copy to TradingView

    Click "Copy to TradingView" to copy the generated code, then open the TradingView Pine Script editor (Alt+P), paste the code, and click "Add to chart."

  5. 5

    Adjust the length parameters

    In the TradingView indicator settings panel, adjust long_length, short_length, and signal_length to match your trading style — for example, use 13/7/7 for faster intraday signals or 40/20/10 for weekly position trading.

Frequently Asked Questions

Build Your TSI Indicator in Seconds

Skip the manual coding. Pineify's AI Coding Agent generates complete, ready-to-use Pine Script indicators — including True Strength Index with signal-line crossovers, zero-line strategies, and divergence detection — instantly for free.

Try Pineify Free