@4ex/indicators
Version:
Technical indicators for ohlc charts written in TypeScript
49 lines (48 loc) • 1.82 kB
TypeScript
import { MFI as MFIIndicator } from 'technicalindicators';
import { OHLC } from '../types';
import { IndicatorInput, Indicator } from './base-indicator';
export interface MoneyFlowIndexInput extends IndicatorInput {
period?: number;
}
/**
* The Money Flow Index (MFI) is a technical oscillator that uses price
* and volume data for identifying overbought or oversold signals in an
* asset. It can also be used to spot divergences which warn of a trend
* change in price. The oscillator moves between 0 and 100. Unlike
* conventional oscillators such as the Relative Strength Index (RSI),
* the Money Flow Index incorporates both price and volume data, as opposed
* to just price. For this reason, some analysts call MFI the volume-weighted
* RSI.
*/
export declare class MFI implements Indicator {
indicator: MFIIndicator;
/**
* @param {OHLC[]} series candles series
* @param {number} period period for indicator
*/
constructor(series: OHLC[], period?: number);
/**
* Retrieve MFI values for instance
* @return {number[]} values for instance data
*/
getResults(): number[];
/**
* Calculate MFI to next tick
* @param {OHLC} candle new candle to add to series
* @return {number | undefined} next MFI value or undefined if period is
* greater than actual series length
*/
next(candle: OHLC): number | undefined;
/**
* Create instance from data
* @param {MoneyFlowIndexInput} input input data
* @return {MFI} MFI instance
*/
static generator({ series, period }: MoneyFlowIndexInput): MFI;
/**
* Get MFI values from input
* @param {MoneyFlowIndexInput} input input data
* @return {number[]} MFI values
*/
static calculate({ series, period, }: MoneyFlowIndexInput): number[];
}