Stochastic Momentum Index (SMI)

get_smi(quotes, lookback_periods, first_smooth_periods, second_smooth_periods, signal_periods=3)

Parameters

name type notes
quotes Iterable[Quote] Iterable of the Quote class or its sub-class.
See here for usage with pandas.DataFrame
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 for more information.

Return

SMIResults[SMIResult]

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

See Utilities and Helpers for more information.

Example

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 Stochastic Momentum Index (SMI)

Created by William Blau, the Stochastic Momentum Index (SMI) is a double-smoothed variant of the Stochastic Oscillator on a scale from -100 to 100. [Discuss] 💬

image

Sources