Standard Deviation Channels

get_stdev_channels(quotes, lookback_periods=20, standard_deviations=2)


name type notes
quotes Iterable[Quote] Iterable(such as list or an object having __iter__()) of the Quote class or its sub-class.
Need help with pandas.DataFrame?
lookback_periods int, Optional, default 20 Size (N) of the evaluation window. Must be None or greater than 1 to calculate. A None value will produce a full quotes evaluation window (see below).
standard_deviations int, default 2 Width of bands. Standard deviations (D) from the regression line. Must be greater than 0. Default is 2.

Historical quotes requirements

You must have at least N 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.



:paintbrush: Repaint warning: Historical results are a function of the current period window position and will fluctuate over time. Recommended for visualization; not recommended for backtesting.


name type notes
date datetime Date
center_line float, Optional Linear regression line (center line)
upper_channel float, Optional Upper line is D standard deviations above the center line
lower_channel float, Optional Lower line is D standard deviations below the center line
break_point bool Helper information. Indicates first point in new window.


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 StdDevChannels(20,2)
results = indicators.get_stdev_channels(quotes, 20,2)

Alternative depiction for full quotes variant

If you specify None for the lookback_periods, you will get a regression line over the entire provided quotes.


About Standard Deviation Channels

Standard Deviation Channels are based on an linear regression centerline and standard deviations band widths. [Discuss] :speech_balloon: