calculate SMA
Calculates the Simple Moving Average (SMA) for a list of prices over a specified period.
Return
The calculated SMA, or the average of all prices if the period exceeds the list size.
Parameters
prices
The list of prices to analyze.
period
The number of periods over which to calculate the SMA.