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

High-Low Index

Install and import#

bash
npm install fintech-algorithms
ts
import { calculate } from "fintech-algorithms/market-breadth-and-internals/high-low-and-trend-breadth/high-low-index";

Signature#

calculate(records, decisionTime)

A moving average of the high–low ratio, which turns a noisy daily reading into something with a usable trend.

Parameters#

NameTypeNotes
recordsRecord[]Session records with evidence state.
decisionTimestringPoint-in-time bound.

Returns#

Row[] · length same-as-input

The smoothed index per session.

Errors#

  • When insufficient history for the smoothing window — reported per row rather than thrown

Complexity: time O(records), space O(sessions).

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#

records
[
  {
    "session_date": "2026-01-06",
    "available_at": "2026-01-06T21: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": 7,
    "new_lows": 5,
    "eligible_issues": 12,
    "overlap_issues": 0
  },
  {
    "session_date": "2026-01-07",
    "available_at": "2026-01-07T21: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": 7,
    "new_lows": 5,
    "eligible_issues": 12,
    "overlap_issues": 0
  },
  {
    "session_date": "2026-01-08",
    "available_at": "2026-01-08T21: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": 7,
    "new_lows": 5,
    "eligible_issues": 12,
    "overlap_issues": 0
  }
]

Showing 3 of 10 elements.

decisionTime
"2026-03-01T00:00:00Z"

Call#

calculate(records, decisionTime)

Returns#

object with 1 field: 9

{
  "9": {
    "session_date": "2026-01-15",
    "new_highs": 2,
    "new_lows": 10,
    "value": 54.166666666666664,
    "status": "resolved",
    "reason": null
  }
}

Diagrams#

High-Low Index — decision boundary
High-Low Index — family map
High-Low Index — worked state

Calculation flow#

Topic decision flow — High-Low Index
flowchart LR
    A["Daily NH and NL"] --> B{"NH + NL > 0?"}
    B -->|"No"| I["Undefined RHP; contaminate active window"]
    B -->|"Yes"| C["RHP = 100 × NH / (NH + NL)"]
    C --> D["Append to rolling tray"]
    D --> E{"Ten defined values?"}
    E -->|"No"| W["Warming"]
    E -->|"Yes"| F["Mean of ten RHP values"]
    F --> G["Publish percentage points"]

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#

  • Nasdaq Fundamental Data
  • How High/Low and New High/New Low Are Calculated
  • High-Low Index
  • Rolling Mean Documentation
  • Evidence decision

The rest of the High/Low and Trend Breadth family#