c_macd_26d_12d_split_adjusted#
- c_macd_26d_12d_split_adjusted(m_close_split_adjusted)[source]
Calculate the MACD (Moving Average Convergence Divergence) for 12 and 26 day periods, split-adjusted.
MACD is calculated as the difference between 12-day and 26-day EMAs of close prices. This function uses split-adjusted close prices.
- Parameters:
m_close_split_adjusted (DataColumn) – The adjusted close prices.
- Returns:
The MACD values.
- Return type:
Notes
MACD is calculated as:
\[\mathrm{MACD}_{26,12} = \mathrm{EMA}_{12} - \mathrm{EMA}_{26}\]In Excel, assuming your adjusted close prices are in column A starting at cell A2:
To calculate the 12-day EMA: - In cell B13, enter:
=AVERAGE(A2:A13)
In cell B14, enter:
=(A14 * (2/(12+1))) + (B13 * (1 - (2/(12+1))))
Drag the formula in B14 down through column B.
To calculate the 26-day EMA: - In cell C27, enter:
=AVERAGE(A2:A27)
In cell C28, enter:
=(A28 * (2/(26+1))) + (C27 * (1 - (2/(26+1))))
Drag the formula in C28 down through column C.
To compute the MACD line: - In cell D27, enter:
=B27 - C27
Drag the formula in D27 down through column D.