UNPKG

@4ex/indicators

Version:

Technical indicators for ohlc charts written in TypeScript

69 lines (68 loc) 2.64 kB
import { KST as KSTIndicator } from 'technicalindicators'; import { OHLC } from '../types'; import { IndicatorInput, Indicator } from './base-indicator'; export interface KnowSureThingInput extends IndicatorInput { signalPeriod?: number; rocLength1?: number; rocLength2?: number; rocLength3?: number; rocLength4?: number; smaLength1?: number; smaLength2?: number; smaLength3?: number; smaLength4?: number; } export interface KnowSureThingOutput { kst: number; signal?: number; } /** * The Know Sure Thing (KST) is a momentum oscillator developed * by Martin Pring to make rate-of-change readings easier for * traders to interpret. In a 1992 Stocks and Commodities article, * Pring referred to the indicator as "Summed Rate of Change (KST)", * but the KST term stuck with technical analysts. The indicator is * relatively common among technical analysts preferring momentum * oscillators to make decisions */ export declare class KST implements Indicator { indicator: KSTIndicator; /** * * @param {OHLC[]} series candle series * @param {number} signalPeriod signal line period * @param {number} rocLength1 * @param {number} rocLength2 * @param {number} rocLength3 * @param {number} rocLength4 * @param {number} smaLength1 * @param {number} smaLength2 * @param {number} smaLength3 * @param {number} smaLength4 */ constructor(series: OHLC[], signalPeriod?: number, rocLength1?: number, rocLength2?: number, rocLength3?: number, rocLength4?: number, smaLength1?: number, smaLength2?: number, smaLength3?: number, smaLength4?: number); /** * Retrieve KST values for instance * @return {KnowSureThingOutput[]} values for instance data */ getResults(): KnowSureThingOutput[]; /** * Calculate KST to next tick * @param {OHLC} candle new candle to add to series * @return {KnowSureThingOutput | undefined} next KST value or undefined if * period is greater than actual series length */ next(candle: OHLC): KnowSureThingOutput | undefined; /** * Create instance from data * @param {KnowSureThingInput} input input data * @return {KST} KST instance */ static generator({ series, signalPeriod, rocLength1, rocLength2, rocLength3, rocLength4, smaLength1, smaLength2, smaLength3, smaLength4, }: KnowSureThingInput): KST; /** * Get KST values from input * @param {KnowSureThingInput} input input data * @return {KnowSureThingOutput[]} KST values */ static calculate(input: KnowSureThingInput): KnowSureThingOutput[]; }