MA Envelope
By LuxAlgoApr 13, 2020
The MA Envelope plots a moving average with upper and lower bands offset by a fixed percentage above and below it (2.5 percent by default), framing how far price has stretched from its own average. The center line's type is selectable, and because the bands sit at a constant relative distance, every tag of the envelope marks the same degree of percentage displacement from the mean. It is the standard envelope construction with no modifications, drawn as the Basis line with Upper and Lower bands and a shaded envelope fill: upper band = basis times (1 + percent/100), lower band = basis times (1 - percent/100).
How to Trade the MA Envelope?
- Tag of the Upper band: price extended a full offset above its average. Check the regime before fading, since trends can ride the band while ranges rotate back.
- Tag of the Lower band with a flat Basis: the classic mean-reversion condition in ranging tape.
- Basis slope: the trend information lives here; a rising Basis frames upper-band rides as strength rather than excess.
- Pullbacks to the Basis in a trend: once direction is established, the centerline is the natural continuation reference.
The width never adapts: a percent tuned in calm conditions gets tagged constantly once volatility picks up. That fixed width is also its appeal: the offset means the same thing on every bar.
MA Envelope Settings
- MA Type (default SMA): moving average used as the envelope basis; options are SMA, EMA, WMA, RMA (SMMA), HMA, and VWMA.
- Length (default 20): number of bars in the basis moving average.
- Source (default close): price series the basis moving average is calculated on.
- Percent (default 2.5): envelope offset as a percentage of the basis. Higher for fewer, more meaningful tags.
Frequently Asked Questions
The Library is free. Quant makes it yours.
Pull any concept or indicator into Quant: rebuild it, retune it, or turn it into a backtested strategy of your own.

