SMA

Calculates the Simple Moving Average indicator.

Accepts the following parameters:

Parameter NameTypeDefault ValueNotes
applyToSeries<Number>--
periodNumber14-

Returns: Series<Number>

SMA is a built-in function - you can use it directly. Below is an example implementation:

1 function SMA(applyTo, period = 14):
2 Sum(applyTo, period) / period