April 2019
Intermediate to advanced
426 pages
11h 13m
English
Another approach in the calculation of moving averages is the Exponential Moving Average (EMA). Recall that the simple moving average assigns equal weight to prices within a window period. However, in EMA, the most recent prices are assigned a higher weight than older prices. This weight is assigned on an exponential basis.
The ewm() method of the pandas DataFrame provides exponential weighted functions. The span parameter specifies the window period for the decay behavior. The same ABN dataset with EMA is plotted as follows:
In [ ]: %matplotlib inline import quandl import pandas as pd quandl.ApiConfig.api_key = QUANDL_API_KEY df = quandl.get('EURONEXT/ABN.4') df_filled = df.asfreq('D', method='ffill') df_last ...Read now
Unlock full access