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

Advance/Decline Volume Line

Install and import#

bash
npm install fintech-algorithms
ts
import { calculate } from "fintech-algorithms/market-breadth-and-internals/thrust-and-pressure/advance-decline-volume-line";

Signature#

calculate(rows, seed)

The cumulative line built from advancing minus declining volume rather than issue counts. Where the issue-based line counts participants, this one weights them by how much they traded.

Parameters#

NameTypeNotes
rowsRow[]Sessions carrying directional volume. Rows carry a ready flag; a row that is not ready is excluded rather than treated as zero, because a missing count and a count of zero mean opposite things about market breadth.
seednumberStarting value of the accumulation; affects the level only.

Returns#

{ status, value, series }

The cumulative series and its latest value.

Errors#

  • When volume fields are absent on a ready row — reported as a status rather than thrown

Complexity: time O(n), space O(n).

Worked example#

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

rows
[
  {
    "session_date": "2026-01-05",
    "advances": 520,
    "declines": 480,
    "unchanged": 20,
    "advancing_volume": 92000000,
    "declining_volume": 78000000,
    "ready": true
  },
  {
    "session_date": "2026-01-06",
    "advances": 480,
    "declines": 520,
    "unchanged": 20,
    "advancing_volume": 86000000,
    "declining_volume": 94000000,
    "ready": true
  },
  {
    "session_date": "2026-01-07",
    "advances": 540,
    "declines": 460,
    "unchanged": 20,
    "advancing_volume": 108000000,
    "declining_volume": 72000000,
    "ready": true
  }
]

Showing 3 of 24 elements.

seed
0

Call#

calculate(rows, seed)

Returns#

object with 3 fields: status, value, series

{
  "status": "resolved",
  "value": 96000000,
  "series": [
    {
      "date": "2026-01-05",
      "net": 14000000,
      "value": 14000000
    },
    {
      "date": "2026-01-06",
      "net": -8000000,
      "value": 6000000
    },
    {
      "date": "2026-01-07",
      "net": 36000000,
      "value": 42000000
    }
  ]
}

Diagrams#

Advance/Decline Volume Line — decision boundary
Advance/Decline Volume Line — family map

Calculation flow#

Calculation Flow — Advance/Decline Volume Line
flowchart LR
    A["Declared seed"] --> B["Ordered session"]
    B --> C["Net volume = V+ − V−"]
    C --> D["Level = prior level + net volume"]
    D --> E["Append increment and level"]
    E --> B
    B -->|"Missing or unordered"| X["Stop recursive tail"]

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#

  • Claim-to-source map
  • Advance-Decline Volume Line — StockCharts ChartSchool
  • Advance-Decline Indicators — StockCharts ChartSchool
  • Volume Summary Client Specification v1.1d — New York Stock Exchange
  • Historical-example decision

The rest of the Thrust and Pressure family#