← Script Marketplace
Open-source scriptindicator/v1

Moving Average Envelope

by Kodexius·@kodexius·

Surround a moving average with configurable percentage bands above and below the basis.

#bands#moving-average#trend
Moving Average Envelope chart preview

Description

Moving Average Envelopes place symmetric percentage bands around a central average. They provide a simple way to examine price extension from a trend baseline, although the appropriate percentage depends on the instrument and timeframe.

Open-source script. Everyone can inspect the source code, use the script on a chart, and save an editable copy.

Release notes

Version history · 1 published version

Version 1CurrentChart updatedMoving Average Envelope · Aug 31, 2026
Release notes

Initial classic indicator release.

View current source ↓
Source codempl-2.0View source

indicator("Moving Average Envelope", { overlay: true });
const length = input.int("Length", 20, { min: 1, max: 500 });
const percent = input.float("Percent", 10, { min: 0.1, max: 100, step: 0.1 });
const source = input.source("Source", "close");
const basis = sma(source, length);
const upper = basis.map((v) => v * (1 + percent / 100));
const lower = basis.map((v) => v * (1 - percent / 100));
plot(upper, { title: "Upper", color: "#2962ff" });
plot(basis, { title: "Basis", color: "#ff9800" });
plot(lower, { title: "Lower", color: "#2962ff" });
fill(upper, lower, { color: "#2962ff", opacity: 0.08 });
  

Community discussion

0 comments

Loading…

No comments yet. Start the discussion.