get_stoch(quotes, lookback_periods=14, signal_periods=3, smooth_periods=3)
||Iterable[Quote]||Iterable(such as list or an object having
• Need help with pandas.DataFrame?
||int, default 14||Lookback period (
||int, default 3||Smoothing period for the signal (%D). Must be greater than 0.|
||int, default 3||Smoothing period (
Historical quotes requirements
You must have at least
N+S periods of
quotes to cover the warmup 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.
- This method returns a time series of all available indicator values for the
StochResultsis just a list of
- 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+S-2periods will have
NoneOscillator values since there’s not enough data to calculate.
||float, Optional||%K Oscillator over prior
||float, Optional||%D Simple moving average of Oscillator|
||float, Optional||%J is the weighted divergence of %K and %D:
Note: aliases of
j are also provided. They can be used interchangeably with the standard outputs.
See Utilities and Helpers for more information.
from stock_indicators import indicators # This method is NOT a part of the library. quotes = get_history_from_feed("SPY") # calculate STO %K(14),%D(3) (slow) results = indicators.get_stoch(quotes, 14, 3, 3)
About Stochastic Oscillator
Created by George Lane, the Stochastic Oscillator is a momentum indicator that looks back
N periods to produce a scale of 0 to 100. %J is also included for the KDJ Index extension.