diff --git a/pandas_ta/statistics/stdev.py b/pandas_ta/statistics/stdev.py index 1f92b3f..74d2fc1 100644 --- a/pandas_ta/statistics/stdev.py +++ b/pandas_ta/statistics/stdev.py @@ -3,15 +3,16 @@ from numpy import sqrt as npsqrt from .variance import variance from ..utils import get_offset, verify_series -def stdev(close, length=None, offset=None, **kwargs): +def stdev(close, length=None, ddof=1, offset=None, **kwargs): """Indicator: Standard Deviation""" # Validate Arguments close = verify_series(close) length = int(length) if length and length > 0 else 30 + ddof = int(ddof) if ddof >= 0 and ddof < length else 1 offset = get_offset(offset) # Calculate Result - stdev = variance(close=close, length=length).apply(npsqrt) + stdev = variance(close=close, length=length, ddof=ddof).apply(npsqrt) # Offset if offset != 0: @@ -39,6 +40,9 @@ Calculation: Args: close (pd.Series): Series of 'close's length (int): It's period. Default: 30 + ddof (int): Delta Degrees of Freedom. + The divisor used in calculations is N - ddof, + where N represents the number of elements. Default: 1 offset (int): How many periods to offset the result. Default: 0 Kwargs: @@ -47,4 +51,4 @@ Kwargs: Returns: pd.Series: New feature generated. -""" \ No newline at end of file +"""