MCPcopy Index your code
hub / github.com/kernc/backtesting.py / SMA

Function SMA

backtesting/test/__init__.py:25–29  ·  view source on GitHub ↗

Returns `n`-period simple moving average of array `arr`.

(arr: pd.Series, n: int)

Source from the content-addressed store, hash-verified

23
24
25def SMA(arr: pd.Series, n: int) -> pd.Series:
26 """
27 Returns `n`-period simple moving average of array `arr`.
28 """
29 return pd.Series(arr).rolling(n).mean()

Callers 3

_SMAMethod · 0.90
resets_indexMethod · 0.90

Calls

no outgoing calls

Tested by 2

_SMAMethod · 0.72
resets_indexMethod · 0.72