Files
QuanTAlib/lib/oscillators/crsi/Crsi.md
T
Miha Kralj 90d5638008 Add new moving average implementations: LTMA, MCNMA, NLMA, NMA, NYQMA, RAIN, and TRAMA
- LTMA (Linear Trend Moving Average): Introduces a predictive moving average using dual cascaded EMAs for trend estimation.
- MCNMA (McNicholl EMA): Implements a zero-lag TEMA using a cascaded EMA structure for enhanced responsiveness.
- NLMA (Non-Lag Moving Average): Utilizes a damped cosine kernel to achieve reduced lag in moving averages.
- NMA (Natural Moving Average): Adapts smoothing based on volatility profiles using a square-root kernel.
- NYQMA (Nyquist Moving Average): Applies the Nyquist-Shannon theorem to prevent aliasing in cascaded moving averages.
- RAIN (Rainbow Moving Average): Combines multiple SMA layers with weighted averages for multi-scale smoothing.
- TRAMA (Trend Regularity Adaptive Moving Average): Adapts smoothing based on the frequency of new highs and lows in price data.
2026-02-20 21:40:32 -08:00

4.3 KiB

CRSI: Connors RSI

Connors RSI is a composite momentum oscillator that combines three independent measurements of price behavior into a single bounded (0-100) output: a short-term RSI of price, an RSI of the consecutive up/down streak length, and a percentile rank of the current rate of change within its recent history. The equal-weighted average of these three components produces a mean-reverting oscillator where extreme readings (above 90 or below 10) identify statistically overbought or oversold conditions with higher reliability than single-component RSI alone.

Historical Context

Larry Connors and Cesar Alvarez introduced Connors RSI in their 2012 publication, building on Connors' earlier research into short-term mean reversion strategies. The indicator addressed a recognized weakness of standard RSI: its tendency to remain in overbought or oversold territory during strong trends without providing actionable reversal signals. By combining three orthogonal measurements of price behavior, each capturing a different aspect of momentum, CRSI reduces the false signal rate inherent in any single oscillator. The streak RSI component was particularly novel, converting the categorical information of consecutive up/down days into a continuous oscillator via a second RSI application. The percent rank component adds a non-parametric statistical dimension that is robust to distribution assumptions. Connors' backtesting showed the composite outperformed standard RSI for mean-reversion entry timing on equity indices and ETFs.

Architecture & Physics

Three-Component Pipeline

CRSI combines three independent calculations with equal weighting:

  1. Price RSI (Component 1): Standard Wilder RSI with exponential smoothing (\alpha = 1/\text{rsiPeriod}) applied to the source series. Uses warmup compensation via the decaying exponential e = \beta^n to correct for initial bias, producing valid output from bar 1.

  2. Streak RSI (Component 2): First computes a consecutive streak counter (positive for up-closes, negative for down-closes, zero for unchanged), then applies the same Wilder RSI to the streak series. This converts run-length information into a bounded oscillator.

  3. Percent Rank (Component 3): Computes 1-bar ROC, stores in a circular buffer, then counts what percentage of historical ROC values are less than or equal to the current ROC. This is a non-parametric ranking that is distribution-free.

Warmup Compensation

Both RSI stages use the "section 2" warmup pattern: track e = \beta^n and apply correction factor c = 1/(1 - e) to the raw exponential averages until e drops below 10^{-10}. This eliminates the startup bias that plagues naive EMA initialization.

Final Composition

The three components are averaged and clamped to [0, 100]:

\text{CRSI} = \text{clamp}\!\left(\frac{\text{PriceRSI} + \text{StreakRSI} + \text{PctRank}}{3}, 0, 100\right)

Mathematical Foundation

Component 1: Price RSI with Wilder smoothing (\alpha = 1/p_1):

\overline{G}_t = \alpha \cdot \max(\Delta x_t, 0) + (1-\alpha) \cdot \overline{G}_{t-1} \overline{L}_t = \alpha \cdot \max(-\Delta x_t, 0) + (1-\alpha) \cdot \overline{L}_{t-1} RSI_1 = \frac{100 \cdot \overline{G}_t}{\overline{G}_t + \overline{L}_t}

Component 2: Streak counter then RSI:

\text{streak}_t = \begin{cases} \text{streak}_{t-1} + 1 & \text{if } x_t > x_{t-1} \text{ and streak}_{t-1} \geq 0 \\ 1 & \text{if } x_t > x_{t-1} \text{ and streak}_{t-1} < 0 \\ \text{streak}_{t-1} - 1 & \text{if } x_t < x_{t-1} \text{ and streak}_{t-1} \leq 0 \\ -1 & \text{if } x_t < x_{t-1} \text{ and streak}_{t-1} > 0 \\ 0 & \text{otherwise} \end{cases} RSI_2 = \text{Wilder\_RSI}(\text{streak}_t, p_2)

Component 3: Percent Rank of 1-bar ROC over window p_3:

ROC_t = \frac{x_t - x_{t-1}}{x_{t-1}} \times 100 PctRank_t = \frac{|\{ROC_i : ROC_i \leq ROC_t,\; i \in \text{window}\}|}{|\text{window}|} \times 100

Composite:

CRSI_t = \frac{RSI_1 + RSI_2 + PctRank}{3}

Default parameters: rsiPeriod = 3, streakPeriod = 2, rankPeriod = 100.

Resources

  • Connors, L. & Alvarez, C. (2012). An Introduction to ConnorsRSI. TradingMarkets
  • Connors, L. (2009). Short-Term Trading Strategies That Work. TradingMarkets
  • PineScript reference: crsi.pine