@4ex/indicators
Version:
Technical indicators for ohlc charts written in TypeScript
58 lines (57 loc) • 2.62 kB
TypeScript
import { TRIX as TRIXIndicator } from 'technicalindicators';
import { TRIXInput } from 'technicalindicators/declarations/momentum/TRIX';
import { OHLC } from '../types';
import { IndicatorInput, Indicator } from './base-indicator';
declare type Input = IndicatorInput & Partial<Omit<TRIXInput, 'values'>>;
export declare type TripleMovingAverageInput = Input;
/**
* The triple exponential average (TRIX) indicator is an oscillator used
* to identify oversold and overbought markets, and it can also be used as
* a momentum indicator. Like many oscillators, TRIX oscillates around a
* zero line. When it is used as an oscillator, a positive value indicates an
* overbought market while a negative value indicates an oversold market.
* When TRIX is used as a momentum indicator, a positive value suggests
* momentum is increasing while a negative value suggests momentum is
* decreasing. Many analysts believe that when the TRIX crosses above the zero
* line it gives a buy signal, and when it closes below the zero line, it gives
* a sell signal. Also, divergences between price and TRIX can indicate
* significant turning points in the market. TRIX calculates a triple
* exponential moving average of the log of the price input over the period of
* time specified by the length input for the current bar. The current bar's
* value is subtracted by the previous bar's value. This prevents cycles that
* are shorter than the period defined by length input from being considered by
* the indicator.
*/
export declare class TRIX implements Indicator {
indicator: TRIXIndicator;
/**
* @param {OHLC[]} series candles series
* @param {number} period period for indicator
*/
constructor(series: OHLC[], period?: number);
/**
* Retrieve TRIX values for instance
* @return {number[]} values for instance data
*/
getResults(): number[];
/**
* Calculate TRIX to next tick
* @param {OHLC} candle new candle to add to series
* @return {number | undefined} next TRIX value or undefined if period is
* greater than actual series length
*/
next(candle: OHLC): number | undefined;
/**
* Create instance from data
* @param {TripleMovingAverageInput} input input data
* @return {TRIX} TRIX instance
*/
static generator({ series, period }: TripleMovingAverageInput): TRIX;
/**
* Get TRIX values from input
* @param {TripleMovingAverageInput} input input data
* @return {number[]} TRIX values
*/
static calculate({ series, period, }: TripleMovingAverageInput): number[];
}
export {};