UNPKG

@4ex/indicators

Version:

Technical indicators for ohlc charts written in TypeScript

54 lines (53 loc) 2.06 kB
import { Indicator, IndicatorInput } from './base-indicator'; import { OHLC, PivotEnum, PivotPointsEnum } from '../types'; export declare type PivotPointsInput = IndicatorInput & { type: PivotPointsEnum; pivot: PivotEnum; }; export interface PivotPointsOutput { pivot: number; levels: Record<string, number>; } /** * A forex pivot point is an indicator developed by floor traders in the * commodities markets to determine potential turning points, also known as * "pivots." Forex pivot points are calculated to determine levels in which * the sentiment of the market could change from "bullish" to "bearish." * Currency traders see pivot points as markers of support and resistance. * Day traders will use pivot points as a way to determine when market * sentiment has gone from bullish to bearish or vice versa. */ export declare class PivotPoints implements Indicator { reference: OHLC; type: PivotPointsEnum; pivot: number; /** * @param {OHLC[]} series candles series * @param {PivotPointsEnum} type type of pivot points calculation * @param {PivotEnum} pivot type of pivot calculation */ constructor(series: OHLC[], type?: PivotPointsEnum, pivot?: PivotEnum); /** * Retrieve PivotPoints values for instance * @return {PivotPointsOutput} values for instance data */ getResults(): PivotPointsOutput; /** * Calculate PivotPoints to next tick * @param {OHLC} candle new candle to add to series * @return {PivotPointsOutput} next PivotPoints value */ next(candle: OHLC): PivotPointsOutput; /** * Create instance from data * @param {PivotPointsInput} input input data * @return {PivotPoints} PivotPoints instance */ static generator({ series, type, pivot, }: PivotPointsInput): PivotPoints; /** * Get PivotPoints values from input * @param {PivotPointsInput} input input data * @return {PivotPointsOutput} PivotPoints values */ static calculate(input: PivotPointsInput): PivotPointsOutput; }