← Script Marketplace
Open-source scriptindicator/v1

Simple Moving Average

by Kodexius·@kodexius·

Smooth price with an equally weighted average over a configurable lookback period.

#moving-average#sma#trend
Simple Moving Average chart preview

Description

The Simple Moving Average gives every observation in its lookback window equal weight. It is commonly used to clarify trend direction, compare price with a baseline, and identify potential dynamic support or resistance.

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 updatedSimple Moving Average · Aug 31, 2026
Release notes

Initial classic indicator release.

View current source ↓
Source codempl-2.0View source

indicator("Simple Moving Average", { overlay: true });
const length = input.int("Length", 9, { min: 1, max: 500 });
const source = input.source("Source", "close");
plot(sma(source, length), { title: "SMA", color: "#22d3ee", lineWidth: 2 });
  

Community discussion

0 comments

Loading…

No comments yet. Start the discussion.