@4ex/indicators
Version:
Technical indicators for ohlc charts written in TypeScript
50 lines (49 loc) • 1.93 kB
TypeScript
import { ForceIndex as FIIndicator } from 'technicalindicators';
import { OHLC } from '../types';
import { IndicatorInput, Indicator } from './base-indicator';
export interface ForceIndexInput extends IndicatorInput {
period?: number;
}
/**
* The force index is a technical indicator that measures the amount of
* power used to move the price of an asset. The term and its formula were
* developed by psychologist and trader Alexander Elder and published in his
* 1993 book Trading for a Living. The force index uses price and volume to
* determine the amount of strength behind a price move. The index is an
* oscillator, fluctuating between positive and negative territory. It is
* unbounded meaning the index can go up or down indefinitely. The force index
* is used for trend and breakout confirmation, as well as spotting potential
* turning points by looking for divergences.
*/
export declare class FI implements Indicator {
indicator: FIIndicator;
/**
* @param {OHLC[]} series candles series
* @param {number} period period for indicator
*/
constructor(series: OHLC[], period?: number);
/**
* Retrieve FI values for instance
* @return {number[]} values for instance data
*/
getResults(): number[];
/**
* Calculate FI to next tick
* @param {OHLC} candle new candle to add to series
* @return {number | undefined} next FI value or undefined if period is
* greater than actual series length
*/
next(candle: OHLC): number | undefined;
/**
* Create instance from data
* @param {ForceIndexInput} input input data
* @return {FI} FI instance
*/
static generator({ series, period }: ForceIndexInput): FI;
/**
* Get FI values from input
* @param {ForceIndexInput} input input data
* @return {number[]} FI values
*/
static calculate({ series, period, }: ForceIndexInput): number[];
}