# True Strength Index (TSI)

`D07-F03-A07` · Technical Indicators → Momentum · archetype `series-transform` · difficulty 3/5 · verification **verified**

Full page: https://docs.thefintechbuilder.com/technical-indicators/momentum/tsi/
Agent skill: `npx skills add IslamBaraka90/Fintech-Algorithms-Library` — https://docs.thefintechbuilder.com/guides/agent-skill/

## Install and import

```bash
npm install fintech-algorithms
```

```ts
import { tsi } from "fintech-algorithms/technical-indicators/momentum/tsi";
```

## Signature

```ts
tsi(close, g, s)
```

True strength index: price change smoothed twice, divided by absolute price change smoothed the same way. The double smoothing is what separates it from a plain momentum reading.

## Parameters

| Name | Type | Required | Notes |
| --- | --- | --- | --- |
| `close` | `number[]` | yes | Per-bar closing prices, chronological. |
| `g` | `number` | yes | Long smoothing span, applied first. · min: 1, integer: true |
| `s` | `number` | yes | Short smoothing span, applied to the result of the first pass. · min: 1, integer: true |

## Returns

`Record<string, (number | null)[]>` · length same-as-input

A single parallel series, `tsi`.

## Warm-up

The first `g + s − 2` positions are `null`. Both smoothing passes must fill.

## Errors

- When either span is < 1 or is not an integer — throws RangeError

## Complexity

Time `O(n)`, space `O(n)`.

## Worked example

Captured by running this function on the input its own test provides. Real output of real code — but not asserted against a published figure.

### Input

`close`:

```json
[100, 100.999214, 102.324548, 103.755998, 105.030823, 105.911843]
```

Showing 6 of 120 elements.

### Call

```ts
tsi(close, g, s)
```

### Returns

object with 1 field: tsi

```json
{
  "tsi": [null, null, null, null, null, null]
}
```

## Other exports

`rsi`, `stochastic`, `stochasticRsi`, `williamsR`, `cci`, `ultimateOscillator`, `connorsRsi`. Every module additionally exports `run` as an alias of its primary
function, and a `meta` object carrying its catalog id, domain, family, shape and article URL.

## Verification and provenance

Tier: **verified** (via scenario-fixture).

The worked example below is the figure published in this algorithm's article, replayed and asserted by the test suite on every build. The arithmetic cannot drift without the build failing.

Both tiers guarantee the signature. Full explanation: https://docs.thefintechbuilder.com/guides/verification/

Generated from the docs.json payload shipped inside fintech-algorithms@0.13.1.
The signature and parameter list are checked against the compiled implementation at build time,
so a description that contradicts the code fails the build rather than reaching this file.

## Links

- Article (how it works, step by step): https://thefintechbuilder.com/technical-indicators/momentum/tsi/
- Implementation source: https://github.com/IslamBaraka90/Fintech-Algorithms-Library/blob/main/src/technical-indicators/momentum/tsi/impl.ts
- Package on npm: https://www.npmjs.com/package/fintech-algorithms
- Domain index for agents: https://docs.thefintechbuilder.com/technical-indicators/llms.txt
