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

Connors RSI

Install and import#

bash
npm install fintech-algorithms
ts
import { connorsRsi } from "fintech-algorithms/technical-indicators/momentum/connors-rsi";

Signature#

connorsRsi(close, pp, sp, rp)

The average of three components: RSI of price, RSI of the up/down streak length, and the percentile rank of the latest return. Designed for short-horizon mean reversion rather than trend.

Parameters#

NameTypeNotes
closenumber[]Per-bar closing prices, chronological.
ppnumberRSI period applied to price.
min: 1 · integer: true
spnumberRSI period applied to the streak-length series.
min: 1 · integer: true
rpnumberLookback for the percentile rank of the most recent return.
min: 1 · integer: true

Returns#

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

Parallel series: price_rsi, streak, streak_rsi, percent_rank and connors_rsi.

Warm-up#

The first the longest of the three components positions are null.

Errors#

  • When any period is < 1 or is not an integer — throws RangeError

Complexity: time O(n × rp), 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#

close
[100, 100.999214, 102.324548, 103.755998, 105.030823, 105.911843]

Showing 6 of 120 elements.

Call#

connorsRsi(close, pp, sp, rp)

Returns#

object with 5 fields: price_rsi, streak, streak_rsi, percent_rank, connors_rsi

{
  "price_rsi": [null, null, null, 100, 100, 100],
  "streak": [0, 1, 2, 3, 4, 5],
  "streak_rsi": [null, null, 100, 100, 100, 100],
  "percent_rank": [null, null, null, null, null, null],
  "connors_rsi": [null, null, null, null, null, null]
}

Other exports#

This module also exports rsi, stochastic, stochasticRsi, williamsR, cci, ultimateOscillator, tsi. Every module additionally exports run as an alias of its primary function, and a meta object carrying its catalog id, domain, family, shape and article URL.

Diagrams#

Connors RSI — connors rsi mechanism

Calculation flow#

Calculation flow
flowchart LR
  A["Finalized strictly positive finalized close"] --> B["Validate order, alignment, and finite values"]
  B --> C["Price RSI"]
  C --> D["Streak and streak RSI"]
  D --> E["Prior-only return rank"]
  E --> F{"History and denominator valid?"}
  F -- "No · short history" --> G["warming-up + reason"]
  F -- "No · no finite scale" --> H["undefined + reason"]
  F -- "Yes" --> I["Three-way mean"]
  I --> J["ready + aligned component trace"]

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#

  • ConnorsRelativeStrengthIndex.cs — QuantConnect LEAN
  • New Concepts in Technical Trading Systems — J. Welles Wilder / Windsor Books
  • Claim-role ledger
  • Evidence boundary

The rest of the Momentum family#