> For the complete documentation index, see [llms.txt](https://nighostchris.gitbook.io/traders/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nighostchris.gitbook.io/traders/categories/technicalanalysislibrary/stochastic-momentum-index-smi.md).

# Stochastic Momentum Index (SMI)

An advancement for the Stochastic Oscillator. Note that you might need at least data with   \* length of at least double period in order to have the latest records more accurate.

{% tabs %}
{% tab title="JavaScript" %}

```javascript
import { Ticker, TechnicalAnalysisLibrary } from 'traders';

const ticker = new Ticker('V');

const data = await ticker.historical('1d', '2021-02-01', '2021-03-13');

const ta = new TechnicalAnalysisLibrary();

try {
  const result = ta.SMI(10, 3, data);
} catch (error) {
  console.log(error);
}
```

{% endtab %}

{% tab title="Typescript" %}

```typescript
import { HistoricalData, Ticker, TechnicalAnalysisLibrary } from 'traders';

const ticker = new Ticker('V');

const data: HistoricalData[] | undefined = await ticker.historical('1d', '2021-02-01', '2021-03-13');

const ta = new TechnicalAnalysisLibrary();

try {
  const result = ta.SMI(10, 3, data);
} catch (error) {
  console.log(error);
}


```

{% endtab %}
{% endtabs %}

```bash
# Example of SMI result
# Visa daily closing price from 2021-02-01 to 2021-03-13
# Value ranges from -40 to 40
[
  32.25, 28.68, 32.12, 35.03,
  32.49, 27.65, 25.44, 13.06,
   8.88, 14.53, 26.57, 23.77,
  17.28, 18.72, 20.08, 19.71,
  14.15, 14.42, 16.03, 16.64,
  20.81, 26.82, 29.14
]
```
