Skip to main content

Rsi

Quick Reference

PropertyValue
Dimensiontechnical
Categorytechnical
Versionv0.9.0 (Beta)
Output Columnrsi

Relative Strength Index: 100 - 100 / (1 + avg_gain/avg_loss) measures speed and magnitude of recent price changes

Formula

rsi_from_rs(rolling_mean(clip(diff(price, 1), 0.0), window) / rolling_mean(clip(-diff(price, 1), 0.0), window))

CDM Inputs

ColumnCDM TableDescription
pricecdm_*CDM source table

Parameters

ParameterTypeDefaultDescription
windowinteger [2, 200]14Lookback window for average gain/loss calculation

Output

Column: rsi

Relative Strength Index (0-100), typically 30=oversold, 70=overbought

Market Intuition & Trading Rationale

RSI (Relative Strength Index) is the classic momentum oscillator: 100 - 100/(1 + avg_gain/avg_loss). It measures the speed and magnitude of recent directional price movements on a 0–100 scale. Values above 70 are traditionally considered "overbought" (price has risen too fast, due for a pullback); values below 30 are "oversold" (price has fallen too fast, due for a bounce). RSI at 50 indicates neutral momentum.

The formula compiles to a surprisingly sophisticated IR DAG: rsi_from_rs(rolling_mean(clip(Δprice, 0), w) / rolling_mean(clip(-Δprice, 0), w)). The clip separates gains from losses, the rolling means compute average gain and average loss, their ratio is the Relative Strength (RS), and rsi_from_rs converts RS to the 0–100 RSI scale. All of this is compiled from a single formula string.

RSI is mean-reverting by construction — it's bounded to [0, 100] and oscillates around 50. This makes it useful for mean-reversion strategies in range-bound markets but dangerous in strongly trending markets where RSI can stay overbought or oversold for extended periods.

Usage Cases

  • Overbought/oversold mean reversion: Sell when RSI > 70, buy when RSI < 30. Confirm with trend context — this works best in range-bound markets; in strong trends, wait for RSI to cross back below 70 (or above 30) before entering.
  • RSI divergence: When price makes a higher high but RSI makes a lower high, momentum is weakening — a bearish divergence that often precedes reversals. Conversely, lower price low + higher RSI low = bullish divergence.
  • Midline crossover: RSI crossing above 50 signals bullish momentum; crossing below 50 signals bearish. This is a simpler, more robust signal than the 70/30 extremes, with fewer false positives.

YAML Definition

name: rsi
description: 'Relative Strength Index: 100 - 100 / (1 + avg_gain/avg_loss) measures
speed and magnitude of recent price changes'
category: technical
version: v0.9.0 (Beta)
dimension: technical
status: Pre-release
required_inputs:
- price
output_column: rsi
output_description: Relative Strength Index (0-100), typically 30=oversold, 70=overbought
parameters:
window:
type: integer
description: Lookback window for average gain/loss calculation
required: false
default: 14
constraints:
min: 2
max: 200
formula: rsi_from_rs(rolling_mean(clip(diff(price, 1), 0.0), window) / rolling_mean(clip(-diff(price,
1), 0.0), window))