Simple Moving Average

Average of the last N closes.

indicator("Simple Moving Average", shorttitle="SMA", overlay=true)
len = input.int(20, "Length", minval=1, maxval=5000)
src = input.source(close, "Source")
plot(ta.sma(src, len), "SMA", linewidth=2)