# Contextual Candlestick Confidence Score

`D06-F05-A04` · Price Action and Candlesticks → Candlestick Scanning and Context · archetype `record-transform` · difficulty 3/5 · verification **verified**

Full page: https://docs.thefintechbuilder.com/price-action-and-candlesticks/candlestick-scanning-and-context/contextual-candlestick-confidence-score/
Agent skill: `npx skills add IslamBaraka90/Fintech-Algorithms-Library` — https://docs.thefintechbuilder.com/guides/agent-skill/

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

```ts
scoreContext(data)
```

combine available, direction-aligned evidence with explicit weights and a minimum evidence-coverage gate.

## Parameters

| Name | Type | Required | Notes |
| --- | --- | --- | --- |
| `data` | `{ features: { geometry: number; support_resistance: number; trend: number; volatility: number; volume: number; confirmation: number }; minimum_coverage: number }` | yes | 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

This is the worked example published in the article, replayed by the test suite on every run. The output cannot drift.

### Input

`data`:

```json
{
  "features": {
    "geometry": 0.9,
    "support_resistance": 0.8,
    "trend": 0.6,
    "volatility": 0.7,
    "volume": 1,
    "confirmation": 0.5
  },
  "minimum_coverage": 0.7
}
```

### Call

```ts
scoreContext(data)
```

### Returns

object with 4 fields: state, score, evidence_coverage, interpretation

```json
{
  "state": "ready",
  "score": 76.49999999999999,
  "evidence_coverage": 1,
  "interpretation": "context-fit-index-not-probability"
}
```

## Verification and provenance

Tier: **verified** (via input-expected).

The worked example below is the figure published in this algorithm's article, replayed and asserted by the test suite on every build. The arithmetic cannot drift without the build failing.

Both tiers guarantee the signature. Full explanation: https://docs.thefintechbuilder.com/guides/verification/

Generated from the docs.json payload shipped inside fintech-algorithms@0.12.0.
The signature and parameter list are checked against the compiled implementation at build time,
so a description that contradicts the code fails the build rather than reaching this file.

## Links

- Article (how it works, step by step): https://thefintechbuilder.com/price-action-and-candlesticks/candlestick-scanning-and-context/contextual-candlestick-confidence-score/
- Implementation source: https://github.com/IslamBaraka90/Fintech-Algorithms-Library/blob/main/src/price-action-and-candlesticks/candlestick-scanning-and-context/contextual-candlestick-confidence-score/impl.ts
- Package on npm: https://www.npmjs.com/package/fintech-algorithms
- Domain index for agents: https://docs.thefintechbuilder.com/price-action-and-candlesticks/llms.txt
