Contextual Candlestick Confidence Score
Install and import#
npm install fintech-algorithmsimport { scoreContext } from "fintech-algorithms/price-action-and-candlesticks/candlestick-scanning-and-context/contextual-candlestick-confidence-score";Signature#
scoreContext(data)combine available, direction-aligned evidence with explicit weights and a minimum evidence-coverage gate.
Parameters#
| Name | Type | Notes |
|---|---|---|
data | { features: { geometry: number; support_resistance: number; trend: number; volatility: number; volume: number; confirmation: number }; minimum_coverage: number } | Topic input record; the required fields are fixed by this topic data-contract. |
Returns#
{ state, score, evidence_coverage, minimum_coverage, contributions, interpretation }
One context-fit record. state is ready with a 0-100 score when the minimum evidence coverage is met, otherwise insufficient-evidence with a null score; this is not a probability.
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#
{
"features": {
"geometry": 0.9,
"support_resistance": 0.8,
"trend": 0.6,
"volatility": 0.7,
"volume": 1,
"confirmation": 0.5
},
"minimum_coverage": 0.7
}Call#
scoreContext(data)Returns#
object with 4 fields: state, score, evidence_coverage, interpretation
{
"state": "ready",
"score": 76.49999999999999,
"evidence_coverage": 1,
"interpretation": "context-fit-index-not-probability"
}Diagrams#
Calculation flow#
Decision flow
flowchart LR
A["Validated point-in-time input"] --> B["Validate aligned features"]
B --> C["Exclude missing evidence"]
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