@cmike444/supply-and-demand-zones
Version:
A library for identifying supply and demand zones in candlestick data.
19 lines (18 loc) • 835 B
TypeScript
import { Candle } from '../types';
/**
* Computes Relative Volume (RVOL) for every candle in the series.
*
* RVOL[i] = candles[i].volume / mean(candles[i-period … i-1].volume)
*
* The lookback is exclusive of the current candle — it answers "how does this
* bar's volume compare to the N bars that preceded it?"
*
* - Index 0 (no prior context) → 1.0 (neutral).
* - When fewer than `period` prior candles exist, the average is taken over all
* available prior candles (same graceful fallback as `atr`).
*
* @param candles - Array of Candle objects with a defined `volume` field.
* @param period - Number of prior candles to average (default: DEFAULT_RVOL_PERIOD).
* @returns Array of RVOL values, one per candle, in the same order.
*/
export declare function rvol(candles: Candle[], period?: number): number[];