Skip to content
Syed Ibrahim Omer edited this page Apr 13, 2026 · 1 revision

RSI (Relative Strength Index)

What it is

RSI is a momentum oscillator scaled from 0 to 100, derived from average gains and losses over a rolling window.

Intuition: it compares “how strong up moves have been” vs “how strong down moves have been” in the recent past.

Formula (high level)

Let ( \Delta_t = close_t - close_{t-1} ).

  • (gain_t = max(\Delta_t, 0))
  • (loss_t = max(-\Delta_t, 0))
  • (avg_gain = SMA(gain, N))
  • (avg_loss = SMA(loss, N))
  • (RS = avg_gain / avg_loss)
  • (RSI = 100 - 100 / (1 + RS))

Output column

  • rsi

Configuration

Notes

  • Common interpretation: RSI > 70 “overbought”, RSI < 30 “oversold” (heuristic, not a rule).
  • Edge case: when average loss is 0, the implementation clips the denominator to avoid division-by-zero.

Related pages:

Clone this wiki locally