fintech-algorithms

Aroon Up, Down, and Oscillator

Measure Extreme Recency

Install and import

bash
npm install fintech-algorithms
ts
import { aroon } from "fintech-algorithms/technical-indicators/trend-systems/aroon";

Signature

aroon(high, low, period)

Measures how recently the highest high and lowest low occurred within the lookback, expressed as 0–100. Unlike most trend indicators it reads *elapsed time* rather than price distance.

Parameters

NameTypeNotes
highnumber[]Per-bar high prices, chronological.
lownumber[]Per-bar low prices, chronological.
periodnumberLookback in bars for the extreme search.
min: 1 · integer: true

Returns

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

Parallel series: aroon_up, aroon_down, and the oscillator difference between them.

Warm-up

The first period positions are null. A full lookback is required before an extreme can be located.

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 × period), 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

high
[101.415, 102.06264, 102.772785, 103.494002, 104.181554, 104.803509]

Showing 6 of 180 elements.

low
[99.3245, 99.468834, 99.976055, 100.625352, 101.389232, 102.216086]

Showing 6 of 180 elements.

period
25

Call

aroon(high, low, period)

Returns

object with 3 fields: aroon_up, aroon_down, oscillator

{
  "aroon_up": [null, null, null, null, null, null],
  "aroon_down": [null, null, null, null, null, null],
  "oscillator": [null, null, null, null, null, null]
}

Diagrams

Aroon Up, Down, and Oscillator — canonical trace
Aroon Up, Down, and Oscillator — failure boundary
Aroon Up, Down, and Oscillator — mechanism map

Calculation flow

Aroon calculation flow
flowchart LR
    A["Validated finalized bar"] --> B["Causal window or recursive state"]
    B --> C["Explicit seed and boundary rule"]
    C --> D["Aligned Aroon output"]
    D --> E["Diagnostics and audit evidence"]

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