---
title: Stochastic Momentum Index (SMI)
permalink: /indicators/Smi/
type: oscillator
layout: indicator
---

# {{ page.title }}

><span class="indicator-syntax">**get_smi**(*quotes, lookback_periods, first_smooth_periods, second_smooth_periods, signal_periods=3*)</span>

## Parameters

| name | type | notes
| -- |-- |--
| `quotes` | Iterable[Quote] | Iterable of the [Quote class]({{site.baseurl}}/guide/#historical-quotes) or [its sub-class]({{site.baseurl}}/guide/#using-custom-quote-classes). <br><span class='qna-dataframe'> • [See here]({{site.baseurl}}/guide/#using-pandasdataframe) for usage with pandas.DataFrame</span>
| `lookback_periods` | int, *default 13* | Lookback period (`N`) for the stochastic.  Must be greater than 0.
| `first_smooth_periods` | int, *default 25* | First smoothing factor lookback.  Must be greater than 0.
| `second_smooth_periods` | int, *default 2* | Second smoothing factor lookback.  Must be greater than 0.
| `signal_periods` | int, *default 3* | EMA of SMI lookback periods.  Must be greater than 0.

### Historical quotes requirements

You must have at least `N+100` periods of `quotes` to cover the convergence periods.

`quotes` is an `Iterable[Quote]` collection of historical price quotes.  It should have a consistent frequency (day, hour, minute, etc).  See [the Guide]({{site.baseurl}}/guide/#historical-quotes) for more information.

## Return

```python
SMIResults[SMIResult]
```

- This method returns a time series of all available indicator values for the `quotes` provided.
- `SMIResults` is just a list of `SMIResult`.
- It always returns the same number of elements as there are in the historical quotes.
- It does not return a single incremental indicator value.
- The first `N-1` periods will have `None` SMI values since there's not enough data to calculate.

>&#9886; **Convergence warning**: The first `N+100` periods will have decreasing magnitude, convergence-related precision errors that can be as high as ~5% deviation in indicator values for earlier periods.

### SMIResult

| name | type | notes
| -- |-- |--
| `date` | datetime | Date
| `smi` | float, Optional | Stochastic Momentum Index (SMI)
| `signal` | float, Optional | Signal line: an Exponential Moving Average (EMA) of SMI

### Utilities

- [.condense()]({{site.baseurl}}/utilities#condense)
- [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date)
- [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods)
- [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods)

See [Utilities and Helpers]({{site.baseurl}}/utilities#utilities-for-indicator-results) for more information.

## Example

```python
from stock_indicators import indicators

# This method is NOT a part of the library.
quotes = get_historical_quotes("SPY")

# Calculate SMI(14,20,5,3)
results = indicators.get_smi(quotes, 14, 20, 5, 3)
```

## About {{ page.title }}

Created by William Blau, the Stochastic Momentum Index (SMI) is a double-smoothed variant of the [Stochastic Oscillator](../Stoch/#content) on a scale from -100 to 100.
[[Discuss] &#128172;]({{site.dotnet.repo}}/discussions/625 "Community discussion about this indicator")

![image]({{site.dotnet.charts}}/Smi.png)

### Sources

- [C# core]({{site.dotnet.src}}/s-z/Smi/Smi.Series.cs)
- [Python wrapper]({{site.python.src}}/smi.py)
