Moving Average Envelope

The Moving Average Envelope places a band a fixed percentage above and below a moving average of the price. It is the older and simpler of the band indicators: its width is set by the analyst, not by the market, so it does not widen when volatility rises.

The formula for the Moving Average Envelope starts from the middle band, the simple moving average of the closing price over the last n periods:

\[\text{Middle Band} = \text{SMA}(\text{Close}, n)\]

The bands sit a fixed fraction p above and below it, so their distance from the middle band grows and shrinks with the price, not with its volatility:

\[\text{Upper Band} = \text{Middle Band} \cdot (1 + p)\] \[\text{Lower Band} = \text{Middle Band} \cdot (1 - p)\]

A close outside the envelope marks a move of more than that share away from the trend: in a range-bound market it reads as overbought above the upper band and oversold below the lower one, while in a trend a close outside the band confirms its strength. The width is chosen to fit the asset’s usual swings, wide enough that most closes stay inside the envelope, so a volatile stock needs a wider envelope than a stable one.

Also known as: moving average envelopes, envelopes, envelope indicator, percentage bands.

In the Finance Toolkit this is get_bollinger_bands with method="envelope", the same function as Bollinger Bands.

Example · USDJPY · 2021 to 2025

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

from financetoolkit import Toolkit

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

toolkit.technicals.get_bollinger_bands(method="envelope").xs("USDJPY", level=1, axis="columns")

Which returns:

References

  • Paper StockCharts ChartSchool, “Moving Average Envelopes”; Murphy, J.J. (1999). “Technical Analysis of the Financial Markets.” New York Institute of Finance.
Share