Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kaelzhang/macd
FinTech utility to calculate MACD, the Moving Average Convergence / Divergence.
https://github.com/kaelzhang/macd
Last synced: 4 days ago
JSON representation
FinTech utility to calculate MACD, the Moving Average Convergence / Divergence.
- Host: GitHub
- URL: https://github.com/kaelzhang/macd
- Owner: kaelzhang
- License: other
- Created: 2017-09-13T07:47:55.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2021-03-02T03:24:29.000Z (over 3 years ago)
- Last Synced: 2024-11-07T01:16:54.156Z (6 days ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 24
- Watchers: 3
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.md
- License: LICENSE-MIT
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/kaelzhang/macd.svg?branch=master)](https://travis-ci.org/kaelzhang/macd)
[![Coverage](https://codecov.io/gh/kaelzhang/macd/branch/master/graph/badge.svg)](https://codecov.io/gh/kaelzhang/macd)# WARNING
This module is lack of maintainance.
If you are familiar with python programming maybe you could check [**stock-pandas**](https://github.com/kaelzhang/stock-pandas) which provides powerful statistic indicators support, and is backed by [`numpy`](https://numpy.org/) and [`pandas`](https://pandas.pydata.org/).
The performance of [**stock-pandas**](https://github.com/kaelzhang/stock-pandas) is many times higher than JavaScript libraries, and can be directly used by machine learning programs.
****
# macd
FinTech utility to calculate [MACD](https://en.wikipedia.org/wiki/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.
## Install
```sh
$ npm install macd
```## Usage
```js
import macd from 'macd'macd(data)
// which returns:
// {
// MACD: ,
// signal: ,
// histogram:
// }
```## macd(data, slowPeriods, fastPeriods, signalPeriods)
- **data** `Array.` the collection of prices
- **slowPeriods** `Number=26` the size of slow periods. Defaults to `26`
- **fastPeriods** `Number=12` the size of fast periods. Defaults to `12`
- **signalPeriods** `Number=9` the size of periods to calculate the MACD signal line.Returns `MACDGraph`
### struct `MACDGraph`
- **MACD** `Array.` the difference between [EMAs](https://www.npmjs.com/package/moving-averages#exponential-moving-average-emadata-size) of the fast periods and EMAs of the slow periods.
- **signal** `Array.` the EMAs of the `MACD`
- **histogram** `Array.` `MACD` minus `signal`In some countries, such as China, the three series above are commonly known as:
```sh
MACD -> DIF
signal -> DEA
histogram -> MACD
```## License
MIT