# Normalized Advance/Decline Line

> Cumulative (A-D)/(A+D) Breadth

`D04-F01-A04` · Market Breadth and Internals → Advance/Decline Breadth · archetype `record-transform` · difficulty 2/5 · verification **verified**

Full page: https://docs.thefintechbuilder.com/market-breadth-and-internals/advance-decline-breadth/normalized-advance-decline-line/
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 { calculateNormalizedAdLine } from "fintech-algorithms/market-breadth-and-internals/advance-decline-breadth/normalized-advance-decline-line";
```

## Signature

```ts
calculateNormalizedAdLine(records, options)
```

Divides net advances by the number of issues traded before accumulating, which keeps the line comparable across decades as listing counts change.

## Parameters

| Name | Type | Required | Notes |
| --- | --- | --- | --- |
| `records` | `BreadthRecord[]` | yes | Session records with revision and supersession fields. |
| `options` | `{ cutoff: string; expectedStartSequence: number; expectedEndSequence: number; initialValue: number; scale: number; minimumCoverage: number }` | yes | `minimumCoverage` refuses to emit a line when too many sessions are missing, rather than producing one with invisible holes. `scale` sets the units; `cutoff` applies the point-in-time bound. |

## Returns

`{ state, reason_codes, points, ignored_future_revisions, denominator_policy, … }`

The normalised line with the denominator policy applied and a count of revisions ignored for arriving after the cutoff.

## Errors

- When coverage falls below minimumCoverage — reported as a state rather than thrown

## Complexity

Time `O(records)`, space `O(sessions)`.

## Worked example

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

### Input

`records`:

```json
[
  {
    "event_id": "NAD-1",
    "revision": 1,
    "supersedes_revision": null,
    "event_type": "upsert",
    "session_sequence": 1,
    "session_date": "2026-01-05",
    "effective_at": "2026-01-05T21:00:00Z",
    "available_at": "2026-01-05T21:05:00Z",
    "venue_id": "SYNTH-X",
    "universe_id": "SYNTH-100",
    "calendar_id": "SYNTH-CAL",
    "session": "regular",
    "comparison_basis": "comparable-prior-close",
    "corporate_action_policy": "provider-adjusted"
  },
  {
    "event_id": "NAD-2",
    "revision": 1,
    "supersedes_revision": null,
    "event_type": "upsert",
    "session_sequence": 2,
    "session_date": "2026-01-06",
    "effective_at": "2026-01-06T21:00:00Z",
    "available_at": "2026-01-06T21:05:00Z",
    "venue_id": "SYNTH-X",
    "universe_id": "SYNTH-100",
    "calendar_id": "SYNTH-CAL",
    "session": "regular",
    "comparison_basis": "comparable-prior-close",
    "corporate_action_policy": "provider-adjusted"
  }
]
```

`options`:

```json
{
  "cutoff": "2026-01-06T22:00:00Z",
  "expectedStartSequence": 1,
  "expectedEndSequence": 2,
  "initialValue": 0,
  "scale": 100,
  "minimumCoverage": 0.95
}
```

### Call

```ts
calculateNormalizedAdLine(records, options)
```

### Returns

object with 4 fields: state, reason_codes, ignored_future_revisions, points

```json
{
  "state": "resolved",
  "reason_codes": [],
  "ignored_future_revisions": 0,
  "points": {
    "0": {
      "net_advances": 30,
      "mover_count": 90,
      "scaled_contribution": 33.33333333333333,
      "normalized_line": 33.33333333333333
    },
    "1": {
      "net_advances": -20,
      "mover_count": 90,
      "scaled_contribution": -22.22222222222222,
      "normalized_line": 11.111111111111107
    }
  }
}
```

## 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.13.1.
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/market-breadth-and-internals/advance-decline-breadth/normalized-advance-decline-line/
- Implementation source: https://github.com/IslamBaraka90/Fintech-Algorithms-Library/blob/main/src/market-breadth-and-internals/advance-decline-breadth/normalized-advance-decline-line/impl.ts
- Standalone repository: https://github.com/IslamBaraka90/Fintech-Normalized-Advance-Decline-Line-Market-Breadth-algorithm
- Package on npm: https://www.npmjs.com/package/fintech-algorithms
- Domain index for agents: https://docs.thefintechbuilder.com/market-breadth-and-internals/llms.txt
