# Average Directional Index (ADX)

> Smooth DX Without Inventing Direction

`D07-F02-A05` · Technical Indicators → Trend Systems · archetype `series-transform` · difficulty 3/5 · verification **verified**

Full page: https://docs.thefintechbuilder.com/technical-indicators/trend-systems/adx/
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 { adx } from "fintech-algorithms/technical-indicators/trend-systems/adx";
```

## Signature

```ts
adx(high, low, close, period)
```

Average directional index: the smoothed magnitude of the gap between +DI and −DI. It measures whether a trend exists at all, and says nothing about its direction — which is why it is used as a filter rather than a signal.

## Parameters

| Name | Type | Required | Notes |
| --- | --- | --- | --- |
| `high` | `number[]` | yes | Per-bar high prices, chronological. |
| `low` | `number[]` | yes | Per-bar low prices, chronological. |
| `close` | `number[]` | yes | Per-bar closing prices, chronological. |
| `period` | `number` | yes | Wilder smoothing period, applied twice: once to the DI components and once to DX. · min: 1, integer: true |

## Returns

`Record<string, (number | null)[]>` · length same-as-input

Parallel series: `plus_di`, `minus_di`, `dx` and `adx`.

## Warm-up

The first `2 × period − 1` positions are `null`. ADX is a smoothing of DX, which is itself computed from smoothed components.

## Errors

- When period < 1 or is not an integer — throws RangeError
- When the input series are not all the same length — throws RangeError

## Complexity

Time `O(n)`, space `O(n)`.

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

`high`:

```json
[109.485, 110.139028, 110.859574, 111.590939, 112.283113, 112.89901]
```

Showing 6 of 180 elements.

`low`:

```json
[107.2615, 107.406037, 107.92024, 108.58088, 109.35613, 110.189018]
```

Showing 6 of 180 elements.

`close`:

```json
[108.42, 108.957755, 109.593932, 110.295981, 111.021937, 111.725443]
```

Showing 6 of 180 elements.

`period`:

```json
14
```

### Call

```ts
adx(high, low, close, period)
```

### Returns

object with 4 fields: plus_di, minus_di, dx, adx

```json
{
  "plus_di": [null, null, null, null, null, null],
  "minus_di": [null, null, null, null, null, null],
  "dx": [null, null, null, null, null, null],
  "adx": [null, null, null, null, null, null]
}
```

## Verification and provenance

Tier: **verified** (via scenario-fixture).

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/technical-indicators/trend-systems/adx/
- Implementation source: https://github.com/IslamBaraka90/Fintech-Algorithms-Library/blob/main/src/technical-indicators/trend-systems/adx/impl.ts
- Package on npm: https://www.npmjs.com/package/fintech-algorithms
- Domain index for agents: https://docs.thefintechbuilder.com/technical-indicators/llms.txt
