# Multi-Indicator Divergence Adapters

`D08-F05-A04` · Geometric Chart Patterns → Indicator Divergence Detection · archetype `record-transform` · difficulty 4/5 · verification **contract**

Full page: https://docs.thefintechbuilder.com/geometric-chart-patterns/indicator-divergence-detection/multi-indicator-divergence-adapters/
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 { multiIndicatorDivergenceAdapters } from "fintech-algorithms/geometric-chart-patterns/indicator-divergence-detection/multi-indicator-divergence-adapters";
```

## Signature

```ts
multiIndicatorDivergenceAdapters(payload)
```

Normalizes indicator pivots into one polarity- and scale-aware representation for downstream divergence logic.

## Parameters

| Name | Type | Required | Notes |
| --- | --- | --- | --- |
| `payload` | `{ topic_id: string; data_class: string; as_of: string; bars: { timestamp: string; open: number; high: number; low: number; close: number; finalized: boolean }[]; price_pivots: { kind: string; event_index: number; confirmation_index: number; price: number; prominence: number }[]; indicators: { name: string; family: string; polarity: number; scale: number; pivots: { kind: string; event_index: number; confirmation_index: number; value: number; prominence: number }[] }[]; parameters: { max_lag: number; min_separation: number; max_separation: number; min_price_fraction: number; min_indicator_delta: number; confirmation_horizon: number; invalidation_buffer: number; minimum_indicators: number }; weights: { RSI: number; MACD-Histogram: number; Stochastic-K: number }; as_of_index: number; universe: { symbol: string; state: string; divergence_type: string; confluence_score: number; freshness: number; liquidity: number; data_quality: number; available_index: number; eligible: boolean }[] }` | yes | Topic payload containing zero or more named indicator definitions and their confirmed pivots. |

## Returns

`{ topic_id, state, adapters, adapter_count }`

One adapter record. `state` is `warmup` when no indicators were supplied and `ready` when at least one adapter was built; no positional warmup series is returned.

## Warm-up

The first `1 supplied indicator` positions are `state: warmup`. The function returns one adapter record when no indicator is supplied; it does not emit a positional null prefix.

## Errors

- When an indicator lacks valid identity, family, polarity, scale, or pivot fields — throws

## Complexity

Time `undefined`, space `undefined`.

## Worked example

Captured by running this function on the input its own test provides. Real output of real code — but not asserted against a published figure.

### Input

`payload`:

```json
{
  "topic_id": "D08-F05-A04",
  "data_class": "synthetic-teaching",
  "as_of": "2026-01-08T13:30:00Z",
  "bars": [
    {
      "timestamp": "2026-01-05T14:30:00Z",
      "open": 105.75,
      "high": 107,
      "low": 105,
      "close": 106,
      "finalized": true
    },
    {
      "timestamp": "2026-01-05T15:30:00Z",
      "open": 106.112,
      "high": 107.362,
      "low": 105.362,
      "close": 106.362,
      "finalized": true
    },
    {
      "timestamp": "2026-01-05T16:30:00Z",
      "open": 106.4614,
      "high": 107.7114,
      "low": 105.7114,
      "close": 106.7114,
      "finalized": true
    }
  ],
  "price_pivots": [
    {
      "kind": "low",
      "event_index": 18,
      "confirmation_index": 21,
      "price": 98,
      "prominence": 0.72
    },
    {
      "kind": "low",
      "event_index": 42,
      "confirmation_index": 45,
      "price": 94,
      "prominence": 0.84
    }
  ],
  "indicators": [
    {
      "name": "RSI",
      "family": "bounded-momentum",
      "polarity": 1,
      "scale": 100,
      "pivots": [
        {
          "kind": "low",
          "event_index": 19,
          "confirmation_index": 22,
          "value": 28,
          "prominence": 0.76
        },
        {
          "kind": "low",
          "event_index": 41,
          "confirmation_index": 44,
          "value": 36,
          "prominence": 0.86
        }
      ]
    },
    {
      "name": "MACD-Histogram",
      "family": "moving-average-momentum",
      "polarity": 1,
      "scale": 5,
      "pivots": [
        {
          "kind": "low",
          "event_index": 18,
          "confirmation_index": 21,
          "value": -2.2,
          "prominence": 0.7
        },
        {
          "kind": "low",
          "event_index": 42,
          "confirmation_index": 45,
          "value": -1,
          "prominence": 0.81
        }
      ]
    },
    {
      "name": "Stochastic-K",
      "family": "range-momentum",
      "polarity": 1,
      "scale": 100,
      "pivots": [
        {
          "kind": "low",
          "event_index": 17,
          "confirmation_index": 20,
          "value": 18,
          "prominence": 0.68
        },
        {
          "kind": "low",
          "event_index": 43,
          "confirmation_index": 46,
          "value": 29,
          "prominence": 0.78
        }
      ]
    }
  ],
  "parameters": {
    "max_lag": 3,
    "min_separation": 5,
    "max_separation": 40,
    "min_price_fraction": 0.005,
    "min_indicator_delta": 0.05,
    "confirmation_horizon": 12,
    "invalidation_buffer": 0.005,
    "minimum_indicators": 2
  },
  "weights": {
    "RSI": 0.4,
    "MACD-Histogram": 0.35,
    "Stochastic-K": 0.25
  },
  "as_of_index": 71,
  "universe": [
    {
      "symbol": "SYNTH-A",
      "state": "confirmed",
      "divergence_type": "regular-bullish",
      "confluence_score": 86,
      "freshness": 92,
      "liquidity": 80,
      "data_quality": 98,
      "available_index": 47,
      "eligible": true
    },
    {
      "symbol": "SYNTH-B",
      "state": "candidate",
      "divergence_type": "regular-bearish",
      "confluence_score": 91,
      "freshness": 98,
      "liquidity": 72,
      "data_quality": 94,
      "available_index": 54,
      "eligible": true
    },
    {
      "symbol": "SYNTH-C",
      "state": "confirmed",
      "divergence_type": "hidden-bullish",
      "confluence_score": 74,
      "freshness": 70,
      "liquidity": 96,
      "data_quality": 90,
      "available_index": 39,
      "eligible": true
    }
  ]
}
```

### Call

```ts
multiIndicatorDivergenceAdapters(payload)
```

### Returns

object with 4 fields: topic_id, state, adapters, adapter_count

```json
{
  "topic_id": "D08-F05-A04",
  "state": "ready",
  "adapters": [
    {
      "name": "RSI",
      "family": "bounded-momentum",
      "polarity": 1,
      "scale": 100,
      "pivots": [
        {
          "kind": "low",
          "event_index": 19,
          "confirmation_index": 22,
          "raw_value": 28,
          "normalized_value": 0.28,
          "prominence": 0.76
        },
        {
          "kind": "low",
          "event_index": 41,
          "confirmation_index": 44,
          "raw_value": 36,
          "normalized_value": 0.36,
          "prominence": 0.86
        }
      ]
    },
    {
      "name": "MACD-Histogram",
      "family": "moving-average-momentum",
      "polarity": 1,
      "scale": 5,
      "pivots": [
        {
          "kind": "low",
          "event_index": 18,
          "confirmation_index": 21,
          "raw_value": -2.2,
          "normalized_value": -0.44000000000000006,
          "prominence": 0.7
        },
        {
          "kind": "low",
          "event_index": 42,
          "confirmation_index": 45,
          "raw_value": -1,
          "normalized_value": -0.2,
          "prominence": 0.81
        }
      ]
    },
    {
      "name": "Stochastic-K",
      "family": "range-momentum",
      "polarity": 1,
      "scale": 100,
      "pivots": [
        {
          "kind": "low",
          "event_index": 17,
          "confirmation_index": 20,
          "raw_value": 18,
          "normalized_value": 0.18,
          "prominence": 0.68
        },
        {
          "kind": "low",
          "event_index": 43,
          "confirmation_index": 46,
          "raw_value": 29,
          "normalized_value": 0.29,
          "prominence": 0.78
        }
      ]
    }
  ],
  "adapter_count": 3
}
```

## Other exports

`adaptIndicator`, `alignPivots`, `detectDivergences`, `scoreDivergence`, `advanceState`, `combineConfluence`, `rankUniverse`, `runTopic`, `priceIndicatorPivotAlignment`, `regularBullishBearishDivergenceDetection`, `hiddenBullishBearishDivergenceDetection`, `divergenceStrengthAndQualityScoring`, `divergenceConfirmationAndInvalidationStateMachine`, `multiIndicatorDivergenceConfluence`, `marketWideDivergenceScannerAndRanking`. Every module additionally exports `run` as an alias of its primary
function, and a `meta` object carrying its catalog id, domain, family, shape and article URL.

## Verification and provenance

Tier: **contract**.

The module loads, the entry point is callable and its declared signature matches the compiled code. The example below is real captured output, but no independently published figure asserts the numbers.

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/geometric-chart-patterns/indicator-divergence-detection/multi-indicator-divergence-adapters/
- Implementation source: https://github.com/IslamBaraka90/Fintech-Algorithms-Library/blob/main/src/geometric-chart-patterns/indicator-divergence-detection/multi-indicator-divergence-adapters/impl.ts
- Package on npm: https://www.npmjs.com/package/fintech-algorithms
- Domain index for agents: https://docs.thefintechbuilder.com/geometric-chart-patterns/llms.txt
