Purpose of the Envelopes
Envelopes consist of a moving average (the middle line) and two bands placed a fixed percentage above and below it. Unlike Bollinger Bands, the distance does not change with volatility. Price reaching a band can signal an overextended market or a breakout.
How It Works
When you select Envelopes in the Trade Rule block, you can configure it with the following settings:
MA Period of Envelopes
The number of candles used for the middle moving average (standard: 14).
Shift of Envelopes (Advanced Option)
Moves the bands forward or backward on the chart by a set number of candles.
MA Method of Envelopes
Method used to calculate the moving average.
Simple: Equal weight to all values.
Exponential: More weight on recent data.
Smoothed: Longer-term smoothing with reduced noise.
Weighted: Highest weight on the most recent data, decreasing linearly.
Applied Price of Envelopes (What the bands are calculated from)
Close Price: Uses the candle's closing price.
Open Price: Uses the candle's opening price.
High Price: Uses the highest price in the candle.
Low Price: Uses the lowest price in the candle.
Median Price: (High + Low) ÷ 2
Typical Price: (High + Low + Close) ÷ 3
Weighted Price: (High + Low + Open + Close) ÷ 4
Deviation of Envelopes
The distance of the bands from the middle line, in percent.
Example: 0.1 places the bands 0.1% above and below the moving average.
Mode of Envelopes (Which line to use)
Middle Line: The moving average itself.
Upper Band: Moving average + deviation %.
Lower Band: Moving average − deviation %.
Time Frame of Envelopes
Sets the chart time frame for the Envelopes calculation.
Can be replaced with a variable or input for quick testing and optimization.
Candle ID of Envelopes
Defines which candle the calculation starts from.
0: Current candle (still forming).
1: Most recently closed candle.
Higher IDs refer to older candles.
Adjust of Envelopes (Modify the Result)
Apply an adjustment to the calculated value by adding, subtracting, multiplying, or dividing by a number.
Example
If you set:
MA Period: 14
MA Method: Simple
Deviation: 0.1
Mode: Upper Band
Candle ID: 1
You get the upper band value of the most recently closed candle: the 14-period simple moving average plus 0.1%.
Use Cases
Detect overextended prices when price closes outside a band.
Trade breakouts when price moves strongly beyond a band.
Use the middle line as a dynamic support or resistance level.
Can also be used as a Custom level stop-loss or take-profit, as a pending-order price, and as the Modify SL/TP reference price.
⚠ Tip: The right deviation differs per symbol and time frame. Test a few values so that price only reaches the bands at meaningful moments.
⚠ Note: When you use Crosses Above or Crosses Below with this indicator, the cross is currently calculated on its first line, whatever Mode you select. To compare two specific lines, use > or < instead.

