Moving Average Envelopes
get_ma_envelopes(quotes, lookback_periods, percent_offset=2.5, ma_type=MAType.SMA)
||Iterable[Quote]||Iterable(such as list or an object having
• Need help with pandas.DataFrame?
||int||Number of periods (
||float, default 2.5||Percent offset for envelope width. Example: 3.5% would be entered as 3.5 (not 0.035). Must be greater than 0. Typical values range from 2 to 10.|
||MAType, default MAType.SMA||Type of moving average (e.g. SMA, EMA, HMA). See MAType options below.|
Historical quotes requirements
See links in the supported MAType options section below for details on the inherited requirements for
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.
from stock_indicators.indicators.common.enums import MAType
||Arnaud Legoux Moving Average|
||Double Exponential Moving Average|
||Endpoint Moving Average|
||Exponential Moving Average|
||Hull Moving Average|
||Simple Moving Average (default)|
||Smoothed Moving Average|
||Triple Exponential Moving Average|
||Weighted Moving Average|
Warning: For ALMA, default values are used for
- This method returns a time series of all available indicator values for the
MAEnvelopeResultsis 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 periods will have
Nonevalues since there’s not enough data to calculate; the quantity will vary based on the
Convergence Warning: Some moving average variants have decreasing magnitude, convergence-related precision errors that can be as high as ~5% deviation in indicator values for earlier periods. See links in the supported MAType options section above for more information.
||float, Optional||Moving average|
||float, Optional||Upper envelope band|
||float, Optional||Lower envelope band|
The moving average
center_line is based on the
ma_type type specified.
See Utilities and Helpers for more information.
from stock_indicators import indicators from stock_indicators import MAType # Short path, version >= 0.8.1 # This method is NOT a part of the library. quotes = get_history_from_feed("SPY") # Calculate 20-period SMA envelopes with 2.5% offset results = indicators.get_ma_envelopes(quotes, 20, 2.5, MAType.SMA);
About Moving Average Envelopes
Moving Average Envelopes is a price band overlay that is offset from the moving average of Close price over a lookback window. [Discuss]