UNPKG

@4ex/indicators

Version:

Technical indicators for ohlc charts written in TypeScript

56 lines (55 loc) 2.54 kB
import { IchimokuCloud as IchimokuIndicator } from 'technicalindicators'; import { IchimokuCloudInput, IchimokuCloudOutput } from 'technicalindicators/declarations/ichimoku/IchimokuCloud'; import { OHLC } from '../types'; import { IndicatorInput, Indicator } from './base-indicator'; declare type Input = IndicatorInput & Partial<Omit<IchimokuCloudInput, 'high' | 'low'>>; export declare type IchimokuInput = Input; export declare type IchimokuOutput = IchimokuCloudOutput; /** * The Ichimoku Cloud is a collection of technical indicators that show support * and resistance levels, as well as momentum and trend direction. It does this * by taking multiple averages and plotting them on the chart. It also uses * these figures to compute a "cloud" which attempts to forecast where the * price may find support or resistance in the future. The Ichimoku cloud was * developed by Goichi Hosoda, a Japanese journalist, and published in the late * 1960s. It provides more data points than the standard candlestick chart. * While it seems complicated at first glance, those familiar with how to read * the charts often find it easy to understand with well-defined trading * signals. */ export declare class Ichimoku implements Indicator { indicator: IchimokuIndicator; /** * @param {OHLC[]} series candles series * @param {number} conversionPeriod * @param {number} basePeriod * @param {number} spanPeriod * @param {number} displacement */ constructor(series: OHLC[], conversionPeriod?: number, basePeriod?: number, spanPeriod?: number, displacement?: number); /** * Retrieve Ichimoku values for instance * @return {IchimokuOutput[]} values for instance data */ getResults(): IchimokuOutput[]; /** * Calculate Ichimoku to next tick * @param {OHLC} candle new candle to add to series * @return {IchimokuOutput | undefined} next Ichimoku value or undefined * if period is greater than actual series length */ next(candle: OHLC): IchimokuOutput | undefined; /** * Create instance from data * @param {IchimokuInput} input input data * @return {Ichimoku} Ichimoku instance */ static generator({ series, conversionPeriod, basePeriod, spanPeriod, displacement, }: IchimokuInput): Ichimoku; /** * Get Ichimoku values from input * @param {IchimokuInput} input input data * @return {IchimokuOutput[]} Ichimoku values */ static calculate(input: IchimokuInput): IchimokuOutput[]; } export {};