You can read more about this at http://en.wikipedia.org/wiki/MACD.
For the MACD chart, based on the stock data that contains open, high, low, and close values for different time instances, the following values need to be calculated:
Once the preceding values are calculated, the MACD-related values will be calculated for a record, by applying the following formulae:
MACD line = 12-day EMA - 26-day EMA
Signal line = 9-day EMA of MACD line
MACD histogram = MACD - Signal line
After the MACD line, signal line, and histogram values have been calculated, we need to draw a chart between...