UNPKG

meridianalgo-js

Version:

Advanced algorithmic trading library for Node.js & TypeScript with 100+ technical indicators, pattern recognition, and risk management tools.

147 lines 5.42 kB
/** * Volume-based Technical Indicators * * This module provides volume-based technical analysis indicators including * VWAP, Volume Profile, Money Flow Index, and other volume-related metrics. * * @fileoverview Volume indicators for technical analysis * @author MeridianAlgo * @version 1.0.0 */ /** * Volume Weighted Average Price (VWAP) calculation * * VWAP is a trading benchmark that gives the average price a security has traded * at throughout the day, based on both volume and price. It is important because * it provides traders with insight into both the trend and value of a security. * * @param high - Array of high prices * @param low - Array of low prices * @param close - Array of closing prices * @param volume - Array of volume values * @param period - Number of periods for calculation (optional, calculates for entire dataset if not provided) * @returns Array of VWAP values * * @example * ```typescript * const high = [100, 101, 102, 103, 104]; * const low = [99, 100, 101, 102, 103]; * const close = [99.5, 100.5, 101.5, 102.5, 103.5]; * const volume = [1000, 1200, 1100, 1300, 1400]; * const vwap = VolumeIndicators.vwap(high, low, close, volume); * ``` */ export declare function vwap(high: number[], low: number[], close: number[], volume: number[], period?: number): number[]; /** * Volume Weighted Moving Average (VWMA) * * VWMA is similar to VWAP but calculated over a specific period rather than * cumulatively. It gives more weight to periods with higher volume. * * @param prices - Array of price data * @param volume - Array of volume values * @param period - Number of periods for calculation * @returns Array of VWMA values */ export declare function vwma(prices: number[], volume: number[], period: number): number[]; /** * Money Flow Index (MFI) * * The Money Flow Index is a momentum oscillator that uses both price and volume * to identify overbought or oversold conditions. It ranges from 0 to 100. * * @param high - Array of high prices * @param low - Array of low prices * @param close - Array of closing prices * @param volume - Array of volume values * @param period - Number of periods for calculation (default: 14) * @returns Array of MFI values */ export declare function mfi(high: number[], low: number[], close: number[], volume: number[], period?: number): number[]; /** * Chaikin Money Flow (CMF) * * CMF measures the amount of money flow volume over a specific period. * It oscillates around zero and can be used to identify buying and selling pressure. * * @param high - Array of high prices * @param low - Array of low prices * @param close - Array of closing prices * @param volume - Array of volume values * @param period - Number of periods for calculation (default: 20) * @returns Array of CMF values */ export declare function cmf(high: number[], low: number[], close: number[], volume: number[], period?: number): number[]; /** * Volume Price Trend (VPT) * * VPT is a cumulative indicator that uses volume and price to determine * the strength of a price trend. * * @param close - Array of closing prices * @param volume - Array of volume values * @returns Array of VPT values */ export declare function vpt(close: number[], volume: number[]): number[]; /** * Negative Volume Index (NVI) * * NVI tracks price changes only on days when volume decreases from the previous day. * It's used to identify bull markets and can be compared with PVI. * * @param close - Array of closing prices * @param volume - Array of volume values * @returns Array of NVI values */ export declare function nvi(close: number[], volume: number[]): number[]; /** * Positive Volume Index (PVI) * * PVI tracks price changes only on days when volume increases from the previous day. * It's used to identify bull markets and can be compared with NVI. * * @param close - Array of closing prices * @param volume - Array of volume values * @returns Array of PVI values */ export declare function pvi(close: number[], volume: number[]): number[]; /** * Ease of Movement (EMV) * * EMV measures the relationship between volume and price change. It shows how much * volume is required to move prices. * * @param high - Array of high prices * @param low - Array of low prices * @param volume - Array of volume values * @param period - Number of periods for smoothing (default: 14) * @returns Array of EMV values */ export declare function emv(high: number[], low: number[], volume: number[], period?: number): number[]; /** * Volume Oscillator * * The Volume Oscillator shows the relationship between two volume moving averages. * It helps identify volume trends and potential reversals. * * @param volume - Array of volume values * @param shortPeriod - Short period for moving average (default: 5) * @param longPeriod - Long period for moving average (default: 10) * @returns Array of volume oscillator values */ export declare function volumeOscillator(volume: number[], shortPeriod?: number, longPeriod?: number): number[]; /** * Collection of volume-based technical indicators */ export declare const VolumeIndicators: { vwap: typeof vwap; vwma: typeof vwma; mfi: typeof mfi; cmf: typeof cmf; vpt: typeof vpt; nvi: typeof nvi; pvi: typeof pvi; emv: typeof emv; volumeOscillator: typeof volumeOscillator; }; //# sourceMappingURL=volume.d.ts.map