简单易用的股票指标计算库

安装

npm install stock-indicator

使用

导入

const { MACD, RSI, BOLL, KDJ, ... } = require('stock-indicator');
or
import { MACD, RSI, BOLL, KDJ, ... } from 'stock-indicator';
or
import stockIndicator from 'stock-indicator'; // 然后通过stockIndicator.MACD, stockIndicator.RSI, stockIndicator.BOLL, stockIndicator.KDJ调用指标函数

指标

const macd = MACD(CLOSE,SHORT, LONG, MID); // CLOSE为收盘价序列数组,默认参数SHORT=12,LONG=26,MID=9
const rsi = RSI(CLOSE,N1,N2,N3); // CLOSE为收盘价序列数组,默认参数N1=6,N2=12,N3=24
const boll = BOLL(CLOSE,M); // CLOSE为收盘价序列,默认参数M=20
const kdj = KDJ(HIGH, LOW, CLOSE, N, M1, M2); // HIGH为最高价序列数组, LOW为最低价数组, CLOSE为收盘价序列数组, 默认参数N=9,M1=3,M2=3
const cci = CCI(HIGH, LOW, CLOSE, N); // HIGH为最高价序列数组, LOW为最低价数组, CLOSE为收盘价序列数组, 默认参数N=14
const dmi = DMI(HIGH, LOW, CLOSE, N, M); // HIGH为最高价序列数组, LOW为最低价数组, CLOSE为收盘价序列数组, 默认参数N=14,M=6
const dma = DMA(CLOSE,N1,N2,M); // CLOSE为收盘价序列数组, 默认参数N1=10,N2=50,M=10
const expma = EXPMA(CLOSE,M1,M2); // CLOSE为收盘价序列数组, 默认参数M1=12,M2=50
const ma = MA(CLOSE,...N ); // CLOSE为收盘价序列数组, 默认参数:5, 10, 20, 60,可添加多个参数,最少一个参数

v1.0.6版本新增指标:

const trix = TRIX(CLOSE,N,M); // CLOSE为收盘价序列数组, 默认参数N=12,M=9

-BRAR

const brar = BRAR(CLOSE, HIGH, LOW, OPEN, N); // CLOSE为收盘价序列数组,HIGH为最高价序列数组, LOW为最低价数组, CLOSE为收盘价序列数组,默认参数N=26

-CR

const cr = CR(HIGH, LOW, N, M1, M2, M3, M4); // HIGH为最高价序列数组, LOW为最低价数组, 默认参数N=26,M1=10,M2=20,M3=40,M4=62

股票指标后续会逐步增加,欢迎大家提出宝贵意见。

注意