UNPKG

@cmike444/supply-and-demand-zones

Version:

A library for identifying supply and demand zones in candlestick data.

15 lines (14 loc) 664 B
import { Candle } from '../types'; /** * Computes the Average True Range (ATR) for a series of candles using a simple mean. * * True Range for each candle (after the first) is: * TR = max(high − low, |high − prev.close|, |low − prev.close|) * * For the first candle (no previous close), TR = high − low. * * @param candles - Array of Candle objects. Should contain the context window preceding the zone. * @param period - Number of TR values to average (default: DEFAULT_ATR_PERIOD). * @returns The mean TR over the last `period` values, or 0 if the array is empty. */ export declare function atr(candles: Candle[], period?: number): number;