FinTech utility to calculate MACD.
MACD, short for Moving Average Convergence / Divergence, is a trading indicator used in technical analysis of stock prices, created by Gerald Appel in the late 1970s.
$ npm install macdimport macd from 'macd'
macd(data)
// which returns:
// {
// MACD: <Array>,
// signal: <Array>,
// histogram: <Array>
// }- data
Array.<Number>the collection of prices - slowPeriods
Number=26the size of slow periods. Defaults to26 - fastPeriods
Number=12the size of fast periods. Defaults to12 - signalPeriods
Number=9the size of periods to calculate the MACD signal line.
Returns MACDGraph
- MACD
Array.<Number>the difference between EMAs of the fast periods and EMAs of the slow periods. - signal
Array.<Number>the EMAs of theMACD - histogram
Array.<Number>MACDminussignal
In some countries, such as China, the three series above are commonly known as:
MACD -> DIF
signal -> DEA
histogram -> MACDMIT