Appearance
Moving Average Simple
Arithmetic mean of the last N closes.
Kind indicator · Drawn on the price pane
Try it
On the chart, press / and choose Moving Average Simple under Moving averages. To change it, copy the source below into the AlphaScript editor.
Inputs
| Input | Type | Default |
|---|---|---|
| Length | int | 9 |
| Source | source | "close" |
| Color | color | "#2962FF" |
Source
From packages/alphascript/indicators/sma.as.js.
js
indicator({ name: "Moving Average Simple", shortTitle: "SMA", overlay: true });
const length = input.int("Length", 9, { min: 1 });
const src = input.source("Source", "close");
plot(ta.sma(src, length), { title: "MA", color: input.color("Color", "#2962FF", { group: "Style" }) });