# New Highs–New Lows

`D04-F03-A01` · Market Breadth and Internals → High/Low and Trend Breadth · archetype `record-transform` · difficulty 2/5 · verification **verified**

Full page: https://docs.thefintechbuilder.com/market-breadth-and-internals/high-low-and-trend-breadth/new-highs-new-lows/
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 { calculate } from "fintech-algorithms/market-breadth-and-internals/high-low-and-trend-breadth/new-highs-new-lows";
```

## Signature

```ts
calculate(records, decisionTime)
```

Counts issues making new 52-week highs and lows. Unlike advance/decline it measures position against a long lookback rather than one session, so it detects a rally where fewer and fewer names reach new ground.

## Parameters

| Name | Type | Required | Notes |
| --- | --- | --- | --- |
| `records` | `Record[]` | yes | Session records with evidence state and universe identity. |
| `decisionTime` | `string` | yes | Point-in-time bound on which revisions may be used. |

## Returns

`Row[]` · length same-as-input

Per-session highs and lows with the eligible count — the denominator matters, because a count of 30 new highs means different things in a universe of 500 and one of 3,000.

## Errors

- When a record lacks the lookback history the count requires — excluded and reported 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
[
  {
    "session_date": "2026-01-15",
    "available_at": "2026-01-15T21:30:00Z",
    "source_evidence_state": "ready",
    "venue_id": "SYNTH-X",
    "universe_id": "SYNTH-HIGH-LOW-12",
    "methodology_id": "synthetic-high-low-v1",
    "lookback_sessions": 252,
    "new_highs": 2,
    "new_lows": 10,
    "eligible_issues": 12,
    "overlap_issues": 0
  }
]
```

`decisionTime`:

```json
"2026-03-01T00:00:00Z"
```

### Call

```ts
calculate(records, decisionTime)
```

### Returns

object with 1 field: 0

```json
{
  "0": {
    "session_date": "2026-01-15",
    "new_highs": 2,
    "new_lows": 10,
    "value": -8,
    "status": "resolved",
    "reason": null
  }
}
```

## 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/high-low-and-trend-breadth/new-highs-new-lows/
- Implementation source: https://github.com/IslamBaraka90/Fintech-Algorithms-Library/blob/main/src/market-breadth-and-internals/high-low-and-trend-breadth/new-highs-new-lows/impl.ts
- Package on npm: https://www.npmjs.com/package/fintech-algorithms
- Domain index for agents: https://docs.thefintechbuilder.com/market-breadth-and-internals/llms.txt
