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 — upper band = basis times (1 + percent/100), lower band = basis times (1 - percent/100) — drawn as the Basis line with Upper and Lower bands and a shaded envelope fill.
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
How is an MA Envelope different from Bollinger Bands?
Bollinger Bands scale their width with measured standard deviation, expanding in volatile stretches and pinching in quiet ones. An envelope holds a fixed percentage offset in all conditions — stable and transparent, but dependent on the trader picking an offset that matches the instrument's normal excursion.
What is the best Percent setting?
There is no universal number — the right offset is instrument- and timeframe-specific. Tune Percent so that only meaningful excursions reach the bands over recent history, and re-tune when the volatility regime shifts, since the envelope will not adapt on its own.
What alerts does this build include?
Upper Band Crossover and Lower Band Crossunder fire when the close crosses above the upper band or below the lower band. Each marks fresh percentage-scale displacement from the basis, read against the Basis slope to decide between a fade and a breakout.
Free indicator
Get free access to this indicator on the platforms below.
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.
