Unified Candlestick Pattern Registry
Install and import#
npm install fintech-algorithmsimport { buildRegistry } from "fintech-algorithms/price-action-and-candlesticks/candlestick-scanning-and-context/unified-candlestick-pattern-registry";Signature#
buildRegistry(data)construct a deterministic, versioned registry that rejects duplicate identities and ambiguous detector metadata.
Parameters#
| Name | Type | Notes |
|---|---|---|
data | { patterns: { pattern_id: string; name: string; direction: string; window: number; detector: string; version: string; enabled: boolean; priority: number }[] } | Topic input record; the required fields are fixed by this topic data-contract. |
Returns#
{ state, registry_id, pattern_count, enabled_count, max_window, patterns }
One ready registry record with stable catalog ordering, a versioned registry identity, aggregate counts, maximum detector window, and the validated pattern specifications.
Complexity: time O(n log n) worst case; see README for topic-specific n,
space O(n).
Worked example#
verified This is the worked example published in the article, replayed by the test suite on every run. The output cannot drift.
Input#
{
"patterns": [
{
"pattern_id": "D06-F03-A01",
"name": "Bullish Engulfing",
"direction": "bullish",
"window": 2,
"detector": "bullish_engulfing",
"version": "v1",
"enabled": true,
"priority": 2
},
{
"pattern_id": "D06-F02-A01",
"name": "Doji",
"direction": "neutral",
"window": 1,
"detector": "doji",
"version": "v1",
"enabled": false,
"priority": 1
}
]
}Call#
buildRegistry(data)Returns#
object with 5 fields: state, pattern_count, enabled_count, max_window, registry_id
{
"state": "ready",
"pattern_count": 2,
"enabled_count": 1,
"max_window": 2,
"registry_id": "D06-F02-A01@v1;D06-F03-A01@v1"
}Diagrams#
Calculation flow#
Decision flow
flowchart LR
A["Validated point-in-time input"] --> B["Validate each specification"]
B --> C["Reject duplicate ID or name"]
C --> D{"Boundary satisfied?"}
D -->|"Yes"| E["Reason-coded ready output"]
D -->|"No"| F["Explicit rejected or unavailable state"]
How it works#
This page states the contract — how to call it correctly. The article explains the concept: why it works, and where it breaks.
References#
- TA-Lib function catalog and pattern-recognition group — TA-Lib project
- TA-Lib C/C++ Core API — TA-Lib project
- Binance Spot kline/candlestick stream — Binance
- CME Group chart types and support/resistance lessons — CME Group
- Foundations of Technical Analysis — Andrew W. Lo, Harry Mamaysky, and Jiang Wang
- Evidence and licensing boundary