Two bands set a fixed percentage above and below a moving average, framing how far price has drifted from its mean.
Moving Average Envelopes are a pair of lines plotted at a fixed percentage above and below a chosen moving average. The middle line is the moving average itself (often a simple or exponential MA); the upper and lower bands sit a set distance away from it, scaling up and down as the average moves. Because the offset is a fixed percentage of the average rather than a measure of recent volatility, the bands keep a constant relative width. Traders use envelopes as a visual frame for how far price has stretched from its average value. The tool is descriptive, not predictive: it shows where price sits relative to its mean, nothing more. Nothing here is investment advice, and trading carries the risk of loss.
First, a moving average of price is calculated over a chosen lookback length (for example, a 20-period SMA of the close). Then two bands are derived from it: the upper band is the moving average multiplied by (1 + percentage), and the lower band is the moving average multiplied by (1 - percentage). With a 20-period average and a 2.5% offset, the upper band is the average times 1.025 and the lower band is the average times 0.975. The bands therefore track the average exactly and stay the same percentage apart at all times. This is the key difference from Bollinger Bands, which use standard deviation so their width expands and contracts with volatility. Envelope width in percentage terms only changes if you change the percentage input; in absolute price terms the gap widens or narrows as the underlying average rises or falls.
A common starting point is a 20-period moving average with an offset between roughly 1% and 3%, but the right percentage depends heavily on the instrument and timeframe. Higher-volatility markets and longer timeframes generally need a wider offset; quieter markets and shorter timeframes need a narrower one. Some traders use an EMA instead of an SMA for the middle line to reduce lag. The percentage is best set by inspecting how the bands fit the chart you are actually looking at, rather than copied blindly from a default.
//@version=6
indicator("MA Envelopes", overlay = true)
length = input.int(20, "MA Length", minval = 1)
pct = input.float(2.5, "Envelope %", minval = 0.0) / 100.0
basis = ta.sma(close, length)
upper = basis * (1 + pct)
lower = basis * (1 - pct)
plot(basis, "Basis", color.gray)
plot(upper, "Upper", color.teal)
plot(lower, "Lower", color.teal)Pro tip: Because the offset is fixed rather than volatility-based, tune the percentage to the specific instrument and timeframe by eye before reading anything into band touches. If you want bands that widen and narrow with volatility instead, that is a different tool (standard-deviation bands such as Bollinger Bands), not a tweak to envelopes. None of this is a recommendation to trade.
Educational only — not financial advice, not a recommendation to trade. No indicator is predictive; trading involves substantial risk of loss.