Functions
talib.sma()
Simple moving average of `source` over `length` bars: every bar in the window counts for the same. Reach for this one unless you want a particular weighting, in which case see `talib.ema`, `talib.wma` or `talib.vwma`.
Syntax
talib.sma(series float source, series int length) → series float
Arguments
source required series float The series to average. length required series int How many bars the average covers. Return Type
series float Example
indicator("Simple Moving Average (SMA)", overlay=true)
length = input(20, "SMA Length")
smaValue = talib.sma(close, length)
plot(smaValue, color=color.blue, title="SMA")