Envelopes
A moving average with a band a set distance above and below it.
Inputs
| Name | Type | Default | Range |
|---|---|---|---|
| source | source | close | |
| period | int | 14 | 1 to 5000 |
| deviation | float | 0.1 | 0 to 100 |
| method | ma_method | sma | |
| mode | choice | percent |
Outputs
| Name | Type | Required | Description |
|---|---|---|---|
| upper | value | Optional | color theme.accent, style line, width 1 |
| middle | value | Optional | color theme.accent, dash dash, style line, width 1 |
| lower | value | Optional | color theme.accent, style line, width 1 |
- Warm-up
- pick(method, {'sma': period - 1, 'ema': period - 1, 'smma': period - 1, 'lwma': period - 1, 'wma': period - 1, 'hma': period + round_half_up(sqrt(period)) - 2, 'dema': 2 * period - 2, 'tema': 3 * period - 3}) bars (13 at the defaults)
- Repaints
- No
- Parity
- MetaTrader 5, within 1e-12
Formula
middle = the moving average named by method
percent: upper = middle * (1 + deviation / 100), lower = middle * (1 - deviation / 100)
fixed: upper = middle + deviation, lower = middle - deviation