@4ex/indicators
Version:
Technical indicators for ohlc charts written in TypeScript
55 lines (54 loc) • 1.98 kB
TypeScript
import { ADX as ADXIndicator } from 'technicalindicators';
import { OHLC } from '../types';
import { IndicatorInput, Indicator } from './base-indicator';
export interface AverageDirectionalIndexInput extends IndicatorInput {
period?: number;
}
export interface ADXOutput {
adx: number;
mdi: number;
pdi: number;
}
/**
* The average directional index (ADX) is a technical analysis indicator used
* by some traders to determine the strength of a trend. The trend can be either
* up or down, and this is shown by two accompanying indicators, the negative
* directional indicator (-DI) and the positive directional indicator (+DI).
* Therefore, the ADX commonly includes three separate lines. These are used to
* help assess whether a trade should be taken long or short, or if a trade
* should be taken at all.
*/
export declare class ADX implements Indicator {
indicator: ADXIndicator;
series: OHLC[];
period: number;
/**
* @param {OHLC[]} series candles series
* @param {number} period period for indicator
*/
constructor(series: OHLC[], period?: number);
/**
* Retrieve ADX values for instance
* @return {ADXOutput[]} values for instance data
*/
getResults(): ADXOutput[];
/**
* Calculate ADX to next tick
* @param {OHLC} candle new candle to add to series
* @return {ADXOutput | undefined} next ADX value or undefined if period is
* greater than actual series length
*/
next(candle: OHLC): ADXOutput | undefined;
/**
* Create instance from data
* @param {AverageDirectionalIndexInput} input input data
* @return {ADX} ADX instance
*/
static generator({ series, period, }: AverageDirectionalIndexInput): ADX;
/**
* Get ADX values from input
* @param {AverageDirectionalIndexInput} input input data
* @return {ADXOutput[]} ADX values
*/
static calculate(input: AverageDirectionalIndexInput): ADXOutput[];
}