c_exponential_moving_average_21d_close_split_adjusted#
- c_exponential_moving_average_21d_close_split_adjusted(m_close_split_adjusted)[source]
Calculate the 21-day (one month) exponential moving average (EMA) of the split-adjusted close prices.
- Parameters:
m_close_split_adjusted (DataColumn) – The adjusted close prices.
- Returns:
The 21-day exponential moving average.
- Return type:
Notes
The smoothing factor K is given by:
\[K = \frac{2}{n + 1}\]with n = 21. The EMA is then:
\[\mathrm{EMA}_{\mathrm{current}} = (\mathrm{Adjusted\ Close} \times K) + (\mathrm{EMA}_{\mathrm{previous}} \times (1 - K))\]In Excel, assuming adjusted close prices are in column A starting at cell A2:
In cell B22, enter:
=AVERAGE(A2:A22)
In cell B23, enter:
=(A23 * (2/(21+1))) + (B22 * (1 - (2/(21+1))))
Drag the formula down to apply it to the remaining rows.