ema#

ema(close, length=None, talib=None, offset=None, **kwargs)[source]#

Exponential Moving Average (EMA)

The Exponential Moving Average is more responsive moving average compared to the Simple Moving Average (SMA). The weights are determined by alpha which is proportional to it’s length. There are several different methods of calculating EMA. One method uses just the standard definition of EMA and another uses the SMA to generate the initial value for the rest of the calculation.

Sources:

https://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:moving_averages https://www.investopedia.com/ask/answers/122314/what-exponential-moving-average-ema-formula-and-how-ema-calculated.asp

Calculation:
Default Inputs:

length=10, adjust=False, sma=True

if sma:

sma_nth = close[0:length].sum() / length close[:length - 1] = np.NaN close.iloc[length - 1] = sma_nth

EMA = close.ewm(span=length, adjust=adjust).mean()

Args:

close (pd.Series): Series of ‘close’s length (int): It’s period. Default: 10 talib (bool): If TA Lib is installed and talib is True, Returns the TA Lib

version. Default: True

offset (int): How many periods to offset the result. Default: 0

Kwargs:

adjust (bool, optional): Default: False sma (bool, optional): If True, uses SMA for initial value. Default: True fillna (value, optional): pd.DataFrame.fillna(value) fill_method (value, optional): Type of fill method

Returns:

pd.Series: New feature generated.