UNPKG

@cmike444/supply-and-demand-zones

Version:

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

23 lines (22 loc) 1.01 kB
import { SupplyZone, DemandZone } from '../types'; /** * Filters out stale zones based on price-level freshness rules: * * - A demand zone can never be priced above a supply zone. If `demand.proximalLine` * (the upper edge of the demand zone) is greater than `supply.proximalLine` * (the lower edge of the supply zone), the zones are in conflict. * * - When a conflict is detected, the zone with the older `endTimestamp` is removed — * it was effectively consumed by the price move that created the newer zone. * On a tie, the demand zone is removed. * * The returned arrays preserve the original ordering of the surviving zones. * * @param supplyZones - Array of identified supply zones. * @param demandZones - Array of identified demand zones. * @returns A new object containing only the fresh, non-conflicting zones. */ export declare function filterFreshZones(supplyZones: SupplyZone[], demandZones: DemandZone[]): { supplyZones: SupplyZone[]; demandZones: DemandZone[]; };