UNPKG

@4ex/indicators

Version:

Technical indicators for ohlc charts written in TypeScript

50 lines (49 loc) 1.95 kB
import { AwesomeOscillator as AOIndicator } from 'technicalindicators'; import { OHLC } from '../types'; import { IndicatorInput, Indicator } from './base-indicator'; export interface AwesomeOscillatorInput extends IndicatorInput { fastPeriod?: number; slowPeriod?: number; } /** * Awesome Oscillator is developed by famous technical analyst and charting * enthusiast Bill Williams. Awesome Oscillator (AO) is an indicator that is * non-limiting oscillator, providing insight into the weakness or the strength * of a stock. The Awesome Oscillator is used to measure market momentum and to * affirm trends or to anticipate possible reversals. It does this by * effectively comparing the recent market momentum, with the general momentum * over a wider frame of reference. */ export declare class AO implements Indicator { indicator: AOIndicator; /** * @param {OHLC[]} series candles series * @param {number} fastPeriod fast period for indicator * @param {number} slowPeriod slow period for indicator */ constructor(series: OHLC[], fastPeriod?: number, slowPeriod?: number); /** * Retrieve AO values for instance * @return {number[]} values for instance data */ getResults(): number[]; /** * Calculate AO to next tick * @param {OHLC} candle new candle to add to series * @return {number | undefined} next AO value or undefined if period is * greater than actual series length */ next(candle: OHLC): number | undefined; /** * Create instance from data * @param {AwesomeOscillatorInput} input input data * @return {AO} AO instance */ static generator({ series, fastPeriod, slowPeriod, }: AwesomeOscillatorInput): AO; /** * Get AO values from input * @param {AwesomeOscillatorInput} input input data * @return {number[]} AO values */ static calculate(input: AwesomeOscillatorInput): number[]; }