Envelope

A simple moving average with bands a fixed percent above and below it.

Moving-average envelope: middle = SMA(x, period); upper = middle × (1 + percent ÷ 100); lower = middle × (1 − percent ÷ 100). Ready at period candles.

Settings

SettingDefaultRangeWhat it does
period201 to 1000Candles averaged.
percent50.01 to 100Band distance, % of the middle line.

What it gives

OutputWhat it is
Middle lineThe SMA.
Upper envelopeMiddle + percent.
Lower envelopeMiddle − percent.

What it reads

It reads open, high, low, close, hl2, hlc3, ohlc4, hlcc4, close by default.

Warm-up

With its default settings, Envelope needs 20 closed candles before its first value. A backtest loads them before its start date, so the first trade can already use it.

Test it

Copy this sentence into the Algonney chat to backtest it:

Backtest a strategy on BTC that uses Envelope with its default settings