@cmike444/supply-and-demand-zones
Version:
A library for identifying supply and demand zones in candlestick data.
23 lines (22 loc) • 1.21 kB
TypeScript
import { Candle } from '../types';
/**
* Validates that a base (a run of indecisive candles) is well-formed relative to
* local volatility. Two checks are applied:
*
* 1. **Gap check** — rejects the base if any consecutive open-to-prior-close gap
* *between base candles* (base[0]→base[1], etc.) exceeds MAX_BASE_GAP_ATR_MULTIPLIER × ATR.
* The precedingCandle→base[0] transition is excluded because a gap entering the base
* from the explosive leg is valid (and often a strong zone signal).
*
* 2. **Height check** — rejects the base if its overall high-to-low range exceeds
* MAX_ZONE_ATR_MULTIPLIER × ATR.
*
* When `localATR` is zero or negative (e.g. insufficient data at the start of a series),
* the checks are skipped and `true` is returned.
*
* @param baseCandles - The indecisive candles that form the base.
* @param precedingCandle - The candle immediately before the first base candle.
* @param localATR - ATR computed from the context window around the base.
* @returns `true` if the base is valid, `false` if either check fails.
*/
export declare function isValidBase(baseCandles: Candle[], precedingCandle: Candle, localATR: number): boolean;