@4ex/indicators
Version:
Technical indicators for ohlc charts written in TypeScript
55 lines (54 loc) • 2.28 kB
TypeScript
import { RSI as RSIIndicator } from 'technicalindicators';
import { OHLC, OHLCEnum } from '../types';
import { IndicatorInput, Indicator } from './base-indicator';
export interface RelativeStrengthIndexInput extends IndicatorInput {
period?: number;
source?: OHLCEnum;
}
/**
* The relative strength index (RSI) is a momentum indicator used in technical
* analysis that measures the magnitude of recent price changes to evaluate
* overbought or oversold conditions in the price of a stock or other asset.
* The RSI is displayed as an oscillator (a line graph that moves between two
* extremes) and can have a reading from 0 to 100. The indicator was originally
* developed by J. Welles Wilder Jr. and introduced in his seminal 1978 book,
* "New Concepts in Technical Trading Systems". Traditional interpretation and
* usage of the RSI are that values of 70 or above indicate that a security is
* becoming overbought or overvalued and may be primed for a trend reversal or
* corrective pullback in price. An RSI reading of 30 or below indicates an
* oversold or undervalued condition.
*/
export declare class RSI implements Indicator {
indicator: RSIIndicator;
source: OHLCEnum;
/**
* @param {OHLC[]} series candles series
* @param {OHLCEnum} source source of values
* @param {number} period period for indicator
*/
constructor(series: OHLC[], source?: OHLCEnum, period?: number);
/**
* Retrieve RSI values for instance
* @return {number[]} values for instance data
*/
getResults(): number[];
/**
* Calculate RSI to next tick
* @param {OHLC} candle new candle to add to series
* @return {number | undefined} next RSI value or undefined if period is
* greater than actual series length
*/
next(candle: OHLC): number | undefined;
/**
* Create instance from data
* @param {RelativeStrengthIndexInput} input input data
* @return {RSI} RSI instance
*/
static generator({ series, source, period, }: RelativeStrengthIndexInput): RSI;
/**
* Get RSI values from input
* @param {RelativeStrengthIndexInput} input input data
* @return {number[]} RSI values
*/
static calculate(input: RelativeStrengthIndexInput): number[];
}