The Complete RSI Guide
Beyond 30/70
RSI (Relative Strength Index) is one of the most widely used indicators in technical analysis, invented in 1978 by J. Welles Wilder. Every textbook tells you "> 70 is overbought, < 30 is oversold," but that's just the entry point. This article covers the math, 4 advanced techniques, and Pine Script code — by the end you'll be able to write your own RSI strategy.
1. What Is RSI? The Math Behind It
RSI measures the ratio of upward force to downward force over the past N bars, outputting a value between 0 and 100. The default is N=14.
The Formula (no need to memorize — Pine computes it for you)
avg_gain = average of "gains" over the past 14 bars
avg_loss = average of "losses" over the past 14 bars
RS = avg_gain / avg_loss
RSI = 100 - (100 / (1 + RS))A few intuitions:
- RSI = 50: gains and losses are balanced (neutral)
- RSI > 70: gains far outweigh losses (potentially overbought)
- RSI < 30: losses far outweigh gains (potentially oversold)
- RSI = 100: every one of the past 14 bars was up — extreme
2. The Beginner Play: Overbought / Oversold (Most Common, Most Dangerous)
The basic logic: RSI < 30 → oversold, possible bounce → buy; RSI > 70 → overbought, possible pullback → sell.
Pine implementation (pure overbought/oversold — not recommended for live trading):
//@version=5
strategy("RSI Overbought/Oversold (Teaching)", overlay=true)
length = input.int(14, "RSI Period")
oversold = input.int(30, "Oversold Value")
overbought = input.int(70, "Overbought Value")
rsi = ta.rsi(close, length)
if (ta.crossover(rsi, oversold))
strategy.entry("Long", strategy.long)
if (ta.crossunder(rsi, overbought))
strategy.entry("Short", strategy.short)3. The Intermediate Play: Divergence (Where the Real Alpha Lives)
Divergence is where RSI really shines. It means price prints a new high/low, but RSI doesn't confirm it — a signal that momentum is fading.
Bullish Divergence (Buy Signal)
Price prints a lower low, but RSI prints a higher low. The downward force is weakening → a bounce often follows.
Bearish Divergence (Sell Signal)
Price prints a higher high, but RSI prints a lower high. The upward force is weakening → a pullback often follows.
4. The Advanced Play: The RSI 50 Midline as a Trend Filter
Most people overlook the 50 midline. In practice it's a quick-and-dirty trend direction check:
- RSI consistently above 50 → uptrend
- RSI consistently below 50 → downtrend
- RSI repeatedly crossing 50 → ranging market
You can use it as a filter: only take long signals in an uptrend (RSI > 50), only take shorts in a downtrend. Pine:
//@version=5
strategy("RSI 50 Trend Filter", overlay=true)
rsi = ta.rsi(close, 14)
emaFast = ta.ema(close, 9)
emaSlow = ta.ema(close, 21)
trendUp = rsi > 50 // RSI trend filter
trendDown = rsi < 50
// Long only on EMA golden cross + RSI > 50
if (ta.crossover(emaFast, emaSlow) and trendUp)
strategy.entry("Long", strategy.long)
// Short only on EMA death cross + RSI < 50
if (ta.crossunder(emaFast, emaSlow) and trendDown)
strategy.entry("Short", strategy.short)5. The Pro Play: Dual-Timeframe (HTF) RSI
The idea: use a higher timeframe (e.g. daily) RSI to set the broader direction, and a lower timeframe (e.g. 1-hour) to time entries. Stop trading against the trend.
//@version=5
strategy("HTF RSI Trend Filter", overlay=true)
// Current chart RSI (for entry execution)
rsi = ta.rsi(close, 14)
// Daily RSI (for trend judgment)
dailyRsi = request.security(syminfo.tickerid, "D", ta.rsi(close, 14))
longSignal = ta.crossover(rsi, 30) and dailyRsi > 50
shortSignal = ta.crossunder(rsi, 70) and dailyRsi < 50
if (longSignal)
strategy.entry("Long", strategy.long)
if (shortSignal)
strategy.entry("Short", strategy.short)6. Where RSI Works Best — by Asset and Timeframe
| Asset Type | Timeframe | RSI Performance |
|---|---|---|
| BTC / ETH majors | 4h / D | ★★★★ Strong |
| BTC / ETH majors | 1m / 5m | ★★ Noisy |
| Stablecoin pairs | D | ★★★★ Range-bound, overbought/oversold very reliable |
| Small altcoins (memecoins) | Any | ★ Don't bother — pumps will steamroll you |
| Newly listed tokens (< 30 days) | Any | ★ Not enough data — the readings are meaningless |
7. Common Mistakes
❌ Fading a strong trend with overbought/oversold
In a bull market RSI parks at 80 and refuses to drop. If you sell at 70 you get stopped out, repeatedly. Fix: pair RSI with a trend filter (EMA 200 or the RSI 50 midline).
❌ Watching RSI without watching price structure
RSI is a momentum indicator, not a signal on its own. Read it alongside support/resistance, candlestick patterns, and volume. Entering on RSI alone wins about 50% of the time.
❌ Setting the period too short
Some traders crank the RSI period down to 5 to make it "more sensitive." The result: a flood of signals and a win rate that drops to 30%. Unless you really know what you're doing, leave it at the default 14.
❌ Looking at only one timeframe
The 5-minute RSI flashes oversold, but the daily is mid-downtrend — your bounce lasts one candle, then gets engulfed. Dual-timeframe analysis is the single biggest upgrade once you move past beginner.
Get started
Wire your strategy to a TradingView webhook and auto-execute on Binance / OKX / Bybit and 4 more.
Start free trial8. Wiring Today's Lesson Into an Auto-Trading Bot
Once your strategy is written, you can set TradingView Alerts and route them through TVSBot to auto-execute on your exchange. The full workflow is here: The Complete TradingView Webhook Guide.