Guppy Multiple Moving Averages (GMMA)

Calculate Daryl Guppy’s Multiple Moving Averages (GMMA), whose spread and order show the strength of the traders’ and the investors’ trend.

They are a group of short and a group of long exponential moving averages, returned with the spreads of the two groups.

The Guppy Multiple Moving Averages are two groups of Exponential Moving Averages: a short group of 3 to 15 periods that follows the traders, and a long group of 30 to 60 periods that follows the investors. A trend is up when the short group lies above the long group and down when it lies below, and a change of trend shows where the groups cross.

The formula is as follows:

\[\text{Short EMA}(n) = \operatorname{EMA}(\text{Close},\; n),\;\; \text{for } n \text{ in 3, 5, 8, 10, 12 and 15}\] \[\text{Long EMA}(n) = \operatorname{EMA}(\text{Close},\; n),\;\; \text{for } n \text{ in 30, 35, 40, 45, 50 and 60}\] \[\text{Short Group Spread} = \max(\text{Short EMAs}) - \min(\text{Short EMAs})\] \[\text{Long Group Spread} = \max(\text{Long EMAs}) - \min(\text{Long EMAs})\] \[\text{Group Spread} = \operatorname{Mean}(\text{Short EMAs}) - \operatorname{Mean}(\text{Long EMAs})\]

Guppy reads the spread within each group as the conviction of that group: a long group that widens confirms the trend, one that compresses warns that the investors are changing their minds, and a short group that compresses near the long group marks a pause in which the traders test the trend. The Group Spread is positive when the short group lies above the long group, and its sign changes where the groups cross.

Also known as: GMMA, Guppy multiple moving average, Guppy ribbons.

Example · AAPL, MSFT · 2021 to 2025

Install the Finance Toolkit with pip install financetoolkit -U, then call get_guppy_multiple_moving_averages:

from financetoolkit import Toolkit

toolkit = Toolkit(
    tickers=["AAPL", "MSFT"],
    api_key="FINANCIAL_MODELING_PREP_KEY",
    start_date="2021-01-01",
    end_date="2025-12-31",
)

guppy = toolkit.technicals.get_guppy_multiple_moving_averages()

guppy.xs("AAPL", level=1, axis="columns").iloc[:, [0, 11, 12, 13, 14]]

Which returns:

Parameters

get_guppy_multiple_moving_averages accepts the following parameters.

ParameterTypeDescriptionExample
periodstrThe time period to consider for historical data. Options are: “intraday” (intraday prices), “daily” (daily prices), “weekly” (weekly prices), “monthly” (monthly prices), “quarterly” (quarterly prices), “yearly” (yearly prices). Defaults to “daily”."weekly"
close_columnstrThe column name for closing prices in the historical data. Defaults to “Adj Close”."Close"
short_windowslist[int] | NoneThe windows of the short group. Defaults to None, which uses Guppy’s 3, 5, 8, 10, 12 and 15.None, which uses Guppy's 3, 5, 8, 10, 12 and 15
long_windowslist[int] | NoneThe windows of the long group. Defaults to None, which uses Guppy’s 30, 35, 40, 45, 50 and 60.None, which uses Guppy's 30, 35, 40, 45, 50 and 60
roundingint | NoneThe number of decimals to round the results to. Defaults to None, which uses the rounding of the Toolkit (4 unless set otherwise).2
growthboolWhether to calculate the growth of the indicator values. Defaults to False.True
lagint | list[int]The lag to use for the growth calculation. Defaults to 1.4
standardizeboolWhether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False.True
show_columnsstr | list[str] | NoneThe columns to keep, a name or a list of names, matched on every column level, or the rows when no column has those names (such as the line items of a financial statement). Names that do not exist are logged, and when none exist the result is returned in full. Defaults to None, which keeps every column.None, which keeps every column

References

  • Paper Guppy, D. (2004). “Trend Trading: A Seven-Step Approach to Success.” Wiley.
  • Library Referenced against TTR (R)’s GMMA
Share