fintech-algorithms
Using a coding agent? Give it the skill: npx skills add IslamBaraka90/Fintech-Algorithms-Library What it does →

Contextual Candlestick Confidence Score

Install and import#

bash
npm install fintech-algorithms
ts
import { 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#

NameTypeNotes
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#

data
{
  "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#

Contextual Candlestick Confidence Score — decision

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.

Read the article →

References#

The rest of the Candlestick Scanning and Context family#