RSI Oversold Overbought (Mean reversion)

Buys when the 14-bar RSI drops below the 30 oversold level and holds until it rises above the 70 overbought level.

How It Works

  1. Compute the 14-bar RSI of the close.
  2. Buy when the RSI drops below 30 — selling has been so one-sided the market is called oversold.
  3. Hold until the RSI rises above 70 — buying has become just as one-sided (overbought) — then sell into that strength.

Worked example. After a two-week slide the 14-bar RSI prints 27 — under the 30 oversold line — and the strategy buys. The recovery carries the RSI up through 70, where the position is sold.

The Math Behind The Indicators

Everything runs on closing prices of the traded timeframe: P is a close, Pt today's close, and N counts bars — one bar is one candle of that timeframe, so 20 bars on a 1h chart is 20 hours.

Relative Strength Index (RSI)
A 0–100 gauge of how one-sided recent moves have been. It compares G, the average size of up-moves, to L, the average size of down-moves, over the last N bars (using Wilder's smoothed averages): near 100 almost every recent bar went up, near 0 almost every bar went down, 50 is balanced.
2026-07-23T00:16:18.093279 image/svg+xml Matplotlib v3.11.1, https://matplotlib.org/
Example: If over the last 14 bars up-moves averaged 2.0 and down-moves averaged 1.0, then G/L = 2 and RSI = 100 − 100 / 3 ≈ 67. Readings below 30 are called oversold, above 70 overbought.

Example Chart

Real Data — Score 30 / 100

Metrics Per Trade

Final Metrics

Scores

Resampled Data — Score 32 / 100

Metrics Per Trade

Final Metrics

Scores