Envelopes¶
Indicators · Bands & Channels
Moving-average envelope — basis ± a fixed percentage.
Envelopes wrap a moving average in two bands set a fixed percentage above and below it. Unlike Bollinger Bands (which breathe with volatility) or Keltner Channels (which breathe with ATR), an Envelope's width is constant — the bands are always the same percent from the centre line. That simplicity makes them a clean, predictable map of "how far is too far" from the average, ideal for mean-reversion in steady markets.
How it works¶
The Basis is a moving average of the Source over the Period (default 20), and you choose whether it's a simple or exponential average with MA type (sma/ema). The Upper band is Basis × (1 + Percent/100) and the Lower is Basis × (1 − Percent/100), with Percent defaulting to 3.0. Because the offset is a fixed percentage, the bands scale with price but not with volatility. The block also exposes Above / Below signals when the source pushes past a band.
When to use it¶
Envelopes are a mean-reversion tool for markets that oscillate around a stable trend: when price stretches to the outer band it's statistically extended, and a reversion toward the basis is the trade. They also work as a trend filter — price riding the upper band confirms an uptrend. The key is choosing the Percent to fit the instrument's typical swing; too tight and price is always outside, too wide and it never reaches. Because the width is fixed, they handle changing volatility worse than Bollinger or Keltner.
Example¶
A reversion fade: wire bars into Envelopes, take the Below signal (price stretched under the lower band), confirm with price turning back up via a Crosses Above, and route to a Buy Signal targeting the Basis. Only trade it in a non-trending regime (ADX / DMI gate), protect with a Fixed Stop-Loss, and backtest in the Tester.
Tips & gotchas¶
- Fixed width is the trade-off. Simpler and more predictable than Bollinger/Keltner, but it doesn't adapt to volatility — re-tune Percent per market.
- Percent must fit the instrument. Calm FX majors want a small percent; volatile crypto a large one.
- Don't fade a trend — a band ride is continuation; filter the regime.
- Basis is the target. Mean-reversion entries aim back at the centre line, not the opposite band.
Related blocks¶
Inputs¶
| Socket | Type | What to wire in |
|---|---|---|
| Source | bars / series |
Price bars or any indicator series |
Outputs¶
| Output | Type | Plots as | Description |
|---|---|---|---|
| Basis | series |
Line | Moving-average basis |
| Upper | series |
Line | Basis × (1 + percent) |
| Lower | series |
Line | Basis × (1 − percent) |
| Above | signal |
— | Source above the upper band |
| Below | signal |
— | Source below the lower band |
Parameters¶
| Parameter | Type | Default | What it does |
|---|---|---|---|
| Period | number · 2–400 | 20 |
|
| Percent | number · 0.1–50.0 | 3.0 |
|
| MA type | choice (sma, ema) |
sma |
|
| Source | choice (close, open, high, low, hl2, hlc3, ohlc4) |
close |
|
| Basis color | colour | #ffb74d |
|
| Band color | colour | #78909c |
Reference auto-generated from the block catalog · category Indicators.