@4ex/indicators
Version:
Technical indicators for ohlc charts written in TypeScript
51 lines (50 loc) • 2.01 kB
TypeScript
import { WilliamsR as WRIndicator } from 'technicalindicators';
import { WilliamsRInput } from 'technicalindicators/declarations/momentum/WilliamsR';
import { OHLC } from '../types';
import { IndicatorInput, Indicator } from './base-indicator';
declare type Input = IndicatorInput & Partial<Pick<WilliamsRInput, 'period'>>;
export declare type WilliamsPercentRangeInput = Input;
/**
* Williams %R, also known as the Williams Percent Range, is a type of
* momentum indicator that moves between 0 and -100 and measures overbought
* and oversold levels. The Williams %R may be used to find entry and exit
* points in the market. The indicator is very similar to the Stochastic
* oscillator and is used in the same way. It was developed by Larry Williams
* and it compares a stock’s closing price to the high-low range over a
* specific period, typically 14 days or periods.
*/
export declare class WR implements Indicator {
indicator: WRIndicator;
series: OHLC[];
period: number;
/**
* @param {OHLC[]} series candles series
* @param {number} period period for indicator
*/
constructor(series: OHLC[], period?: number);
/**
* Retrieve WR values for instance
* @return {number[]} values for instance data
*/
getResults(): number[];
/**
* Calculate WR to next tick
* @param {OHLC} candle new candle to add to series
* @return {number | undefined} next WR value or undefined if period is
* greater than actual series length
*/
next(candle: OHLC): number | undefined;
/**
* Create instance from data
* @param {WilliamsPercentRangeInput} input input data
* @return {WR} WR instance
*/
static generator({ series, period }: WilliamsPercentRangeInput): WR;
/**
* Get WR values from input
* @param {WilliamsPercentRangeInput} input input data
* @return {number[]} WR values
*/
static calculate({ series, period, }: WilliamsPercentRangeInput): number[];
}
export {};