@4ex/indicators
Version:
Technical indicators for ohlc charts written in TypeScript
47 lines (46 loc) • 1.87 kB
TypeScript
import { OBV as OBVIndicator } from 'technicalindicators';
import { OHLC } from '../types';
import { IndicatorInput, Indicator } from './base-indicator';
export declare type OnBalanceVolumeInput = IndicatorInput;
/**
* On-balance volume (OBV) is a technical trading momentum indicator that
* uses volume flow to predict changes in stock price. Joseph Granville
* first developed the OBV metric in the 1963 book Granville's New Key to
* Stock Market Profits. Granville believed that volume was the key force
* behind markets and designed OBV to project when major moves in the markets
* would occur based on volume changes. In his book, he described the
* predictions generated by OBV as "a spring being wound tightly." He believed
* that when volume increases sharply without a significant change in the
* stock's price, the price will eventually jump upward or fall downward.
*/
export declare class OBV implements Indicator {
indicator: OBVIndicator;
/**
* @param {OHLC[]} series candles series
*/
constructor(series: OHLC[]);
/**
* Retrieve OBV values for instance
* @return {number[]} values for instance data
*/
getResults(): number[];
/**
* Calculate OBV to next tick
* @param {OHLC} candle new candle to add to series
* @return {number | undefined} next OBV value or undefined if period is
* greater than actual series length
*/
next(candle: OHLC): number | undefined;
/**
* Create instance from data
* @param {OnBalanceVolumeInput} input input data
* @return {OBV} OBV instance
*/
static generator({ series }: OnBalanceVolumeInput): OBV;
/**
* Get OBV values from input
* @param {OnBalanceVolumeInput} input input data
* @return {number[]} OBV values
*/
static calculate({ series, }: OnBalanceVolumeInput): number[];
}