fintech-algorithms

Connors RSI

Install and import

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

Signature

connors_rsi(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

connors_rsi(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, stochastic_rsi, williams_r, cci, ultimate_oscillator, 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

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