Functions
talib.sma()
The sma function returns the moving average, that is the sum of last y values of x, divided by y.
Syntax
talib.sma(series float source, series int length) → series float
Arguments
source required series float Series of values to process. length required series int Number of bars (length). 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")