You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are three steps to calculating an exponential moving average (EMA). First, calculate the simple moving average for the initial EMA value. An exponential moving average (EMA) has to start somewhere, so a simple moving average is used as the previous period's EMA in the first calculation.
so instead of 13.66666 it should be (20+1)/2 =>10.5
pandas/pandas/core/generic.py
Lines 10159 to 10166 in 1700680
Running this code :
pd.DataFrame({'B': [1,20,400,1,1,1]}).ewm(span=2,min_periods=2,adjust=False).mean().values.flatten()
I am getting
array([ nan, 13.66666667, 271.22222222, 91.07407407, 31.02469136, 11.00823045])
As I understand the first item should be the simple moving average with window equals to span ( here it is 2 ). See for example see this link : https://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:moving_averages
so instead of 13.66666 it should be (20+1)/2 =>10.5
Afterwards the formula is :
The formula also can be found here : http://pandas.pydata.org/pandas-docs/stable/user_guide/computation.html when adjust is set to False .
What do you think ?
Thanks,
Boris
The text was updated successfully, but these errors were encountered: