📘 RSI (Relative Strength Index) Guide: The Momentum King’s Application
I. Basic Concept
RSI (Relative Strength Index) is a commonly used momentum indicator, introduced by technical analyst J. Welles Wilder in 1978.
Its core purpose is to measure the strength of price gains versus losses over a certain period, helping identify whether the market is overbought or oversold.
Key Concept: Momentum
- Momentum in RSI refers to the strength of price movements over a given period — how fast and how strongly prices rise or fall.
- Think of it like a car accelerating or decelerating: strong momentum means strong directional movement.
II. Calculation Details
RSI calculation can be broken down into the following steps:
✅ Step 1: Calculate the price change per candle
Compute the difference between the current close and the previous close:
change_t = close_t - close_(t-1)Separate into gain and loss:
gain_t = max(change_t, 0)
loss_t = max(-change_t, 0)2
- If price rises,
gain > 0,loss = 0 - If price falls,
gain = 0,loss > 0 - If unchanged,
gain = loss = 0
✅ Step 2: Compute average gain and average loss
Use a moving average over N periods (default 14) to smooth the values.
Initial values (first 14 candles) use simple average (SMA):
AvgGain_14 = (gain_1 + gain_2 + ... + gain_14) / 14
AvgLoss_14 = (loss_1 + loss_2 + ... + loss_14) / 142
From the 15th candle onward, apply Wilder’s smoothing (exponential smoothing):
AvgGain_t = (AvgGain_(t-1) * (N - 1) + gain_t) / N
AvgLoss_t = (AvgLoss_(t-1) * (N - 1) + loss_t) / N2
This smoothing method responds closer to market dynamics and is more stable.
✅ Step 3: Compute Relative Strength (RS)
RS = AvgGain / AvgLossIt measures the ratio of upward vs. downward momentum.
✅ Step 4: Compute RSI
Convert RS to RSI (range 0–100):
RSI = 100 - (100 / (1 + RS))Interpretation:
- Strong upward momentum (RS → ∞) → RSI → 100
- Strong downward momentum (RS → 0) → RSI → 0
- Balanced momentum (RS = 1) → RSI = 50 (neutral)
📌 RSI Calculation Example (Period 14)
Below is a complete example of calculating RSI with a 14-period setting:
✅ Input: Closing Prices (20 candles)
import pandas as pd
close_prices = [44.34, 44.09, 44.15, 43.61, 44.33,
44.83, 45.10, 45.42, 45.84, 46.08,
45.89, 46.03, 45.61, 46.28, 46.28,
46.00, 46.03, 46.41, 46.22, 45.64]
df = pd.DataFrame({'close': close_prices})2
3
4
5
6
7
8
✅ Calculation Steps (N=14)
N = 14
# Step 1: Price change
df['change'] = df['close'].diff()
# Step 2: Separate gains and losses
df['gain'] = df['change'].apply(lambda x: x if x > 0 else 0)
df['loss'] = df['change'].apply(lambda x: -x if x < 0 else 0)
# Step 3: Compute 14-period averages
df['avg_gain'] = df['gain'].rolling(N).mean()
df['avg_loss'] = df['loss'].rolling(N).mean()
# Step 4: Compute RS and RSI (after first 14 candles)
df['rs'] = df['avg_gain'] / df['avg_loss']
df['rsi'] = 100 - (100 / (1 + df['rs']))2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
✅ Preview Results (Last 5 Rows)
print(df[['close', 'change', 'gain', 'loss', 'avg_gain', 'avg_loss', 'rsi']].tail(5))Sample Output:
| Index | Close | Change | Gain | Loss | Avg Gain | Avg Loss | RSI |
|---|---|---|---|---|---|---|---|
| 15 | 46.00 | -0.28 | 0.00 | 0.28 | 0.5664 | 0.2750 | 67.47 |
| 16 | 46.03 | 0.03 | 0.03 | 0.00 | 0.5380 | 0.2550 | 67.83 |
| 17 | 46.41 | 0.38 | 0.38 | 0.00 | 0.5474 | 0.2364 | 69.41 |
| 18 | 46.22 | -0.19 | 0.00 | 0.19 | 0.5073 | 0.2353 | 68.32 |
| 19 | 45.64 | -0.58 | 0.00 | 0.58 | 0.4705 | 0.2632 | 64.13 |
Note: RSI14 is computed starting from the 15th candle.
III. Trading Signals
| RSI Value | Market Condition | Meaning |
|---|---|---|
| > 70 | Overbought | Possible short-term pullback or reversal |
| < 30 | Oversold | Possible rebound or bottoming |
| Around 50 | Neutral | Market has no clear trend |
Further confirmation can use price action, support/resistance, or candlestick patterns.
IV. Advantages & Disadvantages of RSI
✅ Advantages
1. Highly sensitive, suitable for range-bound markets
RSI responds quickly to price changes. In sideways markets, overbought (>70) and oversold (<30) signals are particularly effective.
✅ Practical example:
- In range-bound markets, RSI approaching 30 and rebounding can be a good buy signal.
- RSI reaching 70 and then falling can be a short-term sell signal.
This works well for stable cryptocurrencies like BTC and ETH in sideways trading ranges.
2. Divergence signals can warn of turning points
RSI can show bullish/bearish divergences to anticipate reversals:
- Bearish divergence: Price makes a new high, RSI does not → upward momentum weakening, potential reversal.
- Bullish divergence: Price makes a new low, RSI does not → potential bottoming signal.
This is one of RSI’s most valuable applications.
❌ Disadvantages
1. Prone to false signals when used alone
In noisy or unclear markets, RSI’s overbought/oversold signals often mislead.
Example:
RSI < 30 indicates oversold, but price continues falling.
Such false signals are especially common in strong downtrends.
2. Fails in Strong Trending Markets
RSI is an oscillator, and in strong trends it often gives counter-trend signals while the price continues along the trend.
📉 Example:
- In a strong bullish trend, RSI can stay between 70–90 for an extended period.
- If one shorts when RSI > 70, this is usually fighting the trend, which can lead to significant losses.
Therefore, in trending markets, RSI must be combined with trend confirmation, moving averages, or channel systems to filter signals.
3. Cannot Determine Trend Direction
RSI is essentially a momentum indicator, measuring the strength of price moves, but it cannot indicate whether the trend is reversing or continuing.
For example:
- RSI rising could be a short-term rebound.
- RSI falling could just be a pullback, not necessarily a trend reversal.
Thus, RSI should be used together with MACD, EMA, trendlines, or other trend-following tools to determine trend direction.
✅ Recommended Usage Summary
| Scenario | Recommended RSI Usage |
|---|---|
| Range-bound | Use RSI overbought/oversold levels as primary signals |
| Uptrend | Use RSI divergence as a supplementary exit signal |
| Downtrend | Use RSI divergence as a low-buy warning, but cautiously |
| Stock/coin selection | RSI < 30 and rebound as a selection factor (with trend filter) |
V. RSI Divergence: Principles, Algorithm, and Practical Application
Divergence occurs when price movement and RSI move in opposite or inconsistent directions. This usually indicates weakening momentum and may signal a trend reversal.
I. Two Types of RSI Divergence
| Divergence Type | Condition (Price vs RSI) | Meaning | Signal Strength |
|---|---|---|---|
| Bearish Divergence (Top) | Price makes new high, RSI does not | Upward momentum weakening → potential downward reversal | Strong bearish signal |
| Bullish Divergence (Bottom) | Price makes new low, RSI does not | Downward momentum weakening → potential upward reversal | Strong bullish signal |
Textual Illustrations
Bearish Divergence Example:
Price:
High1 High2
/‾‾‾‾‾\
/ \
/ \
--/ \---
RSI:
High1 High2
/‾‾‾\
/ \
--- \___
Price makes new high, RSI does not → Bearish divergence → Sell warning2
3
4
5
6
7
8
9
10
11
12
13
14
Bullish Divergence Example:
Price:
Low1 Low2
\ /
\ /
\______/
RSI:
Low1 Low2
\__
\_____/‾
Price makes new low, RSI rises → Bullish divergence → Buy warning2
3
4
5
6
7
8
9
10
11
12
II. Detailed Explanation (with Example)
Divergence occurs when price and RSI move in opposite directions, indicating weakening trend momentum and a potential reversal signal.
| Type | Meaning | Implication |
|---|---|---|
| Bearish Divergence | Price makes new high, RSI does not | Bullish momentum weakening → possible fall |
| Bullish Divergence | Price makes new low, RSI does not | Bearish momentum weakening → possible rebound |
III. Simulated Data Example
▶ Bearish Divergence
| Time | Close | RSI |
|---|---|---|
| T1 | 98 | 70 |
| T2 | 100 | 73 |
| T3 | 102 | 68 ← RSI peak |
| T4 | 105 | 65 ← RSI starts falling (bearish divergence) |
Explanation:
- Price keeps making new highs (100 → 105)
- RSI peaks at T2 (73) and fails to reach a new high afterward (68 → 65)
- Price new high, RSI lower → Bearish divergence
🔎 Signal Meaning: Bullish momentum is weakening; trend may pull back, often appearing at the end of an uptrend.
▶ Bullish Divergence
| Time | Close | RSI |
|---|---|---|
| T1 | 50 | 30 |
| T2 | 48 | 28 |
| T3 | 45 | 32 ← RSI bottom |
| T4 | 43 | 35 ← RSI rises while price makes new low (bullish divergence) |
Explanation:
- Price makes new lows (50 → 43)
- RSI does not reach a new low at the bottom (T4), instead rises 28 → 32 → 35
- Price new low, RSI rising → Bullish divergence
🔎 Signal Meaning: Bearish momentum weakening; trend may rebound, often at the end of a downtrend.
IV. Core Logic of RSI Divergence
Divergence ≠ Reversal. It is a warning signal.
- Divergence shows momentum lagging behind price, i.e., RSI does not support continuation of the trend.
- Essentially, it reflects the conflict between price inertia and weakening momentum.
- Best used in combination with volume changes, candlestick patterns, and support/resistance levels to confirm reversals.
✅ Usage Recommendations
| Complementary Tool | Purpose |
|---|---|
| ✅ Volume (high volume) | Divergence + volume → more reliable reversal |
| ✅ Support/Resistance | Divergence at key levels → stronger signal |
| ✅ Candlestick patterns | Confirm with hammer, engulfing, star patterns |
| ✅ Moving averages | Confirm trend structure around divergence |
⚠ Risk Warning
- RSI divergence is not an immediate reversal signal, only indicates momentum weakening.
- It may lag or fail (especially in strong trends with sustained divergence).
- Always combine with trend structure to determine the main direction; do not use divergence alone to top/bottom trade.
If you want, I can continue translating the RSI advanced usage with Freqtrade strategy integration next, keeping it in the same style as your KDJ guide.
Do you want me to do that?
Here’s the English translation of your advanced RSI techniques and strategy section, keeping the structure and practical examples intact:
VI. Advanced RSI Techniques
🎯 1. Dynamic Threshold Adjustment: Volatility-Adaptive RSI
Traditional RSI thresholds are usually set as:
- Overbought: RSI > 70 (potential pullback)
- Oversold: RSI < 30 (potential rebound)
However, different coins or stocks have very different volatility, and fixed thresholds may cause many false signals or missed opportunities.
✅ Optimization Method:
Adjust thresholds dynamically based on the asset's volatility:
| Volatility Type | Recommended Threshold (Overbought / Oversold) |
|---|---|
| High-volatility coin | 80 / 20 (stricter) |
| Trending asset | 70 / 30 (default) |
| Low-volatility stablecoin | 60 / 40 (more sensitive) |
🔍 Example:
A volatile altcoin may frequently move ±10% in a single day. Using RSI < 30 could trigger premature "oversold" alerts. Adjusting the threshold to RSI < 20 ensures only extreme panic conditions trigger oversold signals, providing more robust entries.
⚠️ Notes:
- Dynamic thresholds can be determined using Bollinger Band width, historical ATR, StdDev, etc.
- Avoid using the same thresholds across all assets indiscriminately.
🎯 2. RSI + EMA Filter: Eliminating Counter-Trend Signals
RSI can capture overbought/oversold levels but often produces false signals in range-bound or early reversal phases.
✅ Improvement Method:
Introduce an EMA (e.g., EMA20 or EMA50) as a trend filter. Activate RSI signals only when trend direction aligns.
📘 Strategy Rule Example:
- Only consider long entries when RSI < 30 AND price > EMA20 (uptrend).
- Only trigger exit or short signals when RSI > 70 AND price < EMA20 (downtrend).
🔍 Practical Benefits:
- Avoid exiting early in an uptrend due to "RSI overbought"
- Filter out counter-trend RSI signals, improving win rate
🎯 3. Multi-Timeframe RSI Confluence: Confirming Trend Strength
Different RSI timeframes reflect different momentum levels:
- 1h RSI → short-term sentiment
- 4h RSI → medium-term trend
- Daily RSI → macro trend
✅ Application Method:
Check whether RSI across multiple timeframes converge in the same direction to assess signal reliability.
📘 Example:
| Timeframe | RSI Value | Interpretation |
|---|---|---|
| 1h | 28 | Oversold |
| 4h | 32 | Approaching oversold |
| Daily | 45 | Neutral |
→ Multi-timeframe RSI all low → asset broadly in a low region → consider scaling in gradually.
⚠️ Notes:
- Confluence ≠ perfect sync; allow for lag and structural offsets
- Avoid too many timeframes to prevent “analysis paralysis”
🧠 Summary
| Technique | Core Goal | Enhancement Dimension |
|---|---|---|
| Dynamic Threshold | Adapt to different volatility assets | Flexibility |
| RSI + EMA | Avoid counter-trend signals | Trend filtering |
| Multi-Timeframe Confluence | Improve directional confirmation | Multi-level confirmation |
VII. RSI Practical Strategy
The RsiEmaStrategy combines oversold rebound signals (RSI < 30) with trend confirmation (price above EMA50), representing a cautious and conservative trend-reversal approach.
from freqtrade.strategy.interface import IStrategy
from pandas import DataFrame
import talib.abstract as ta
class RsiEmaStrategy(IStrategy):
timeframe = '1h'
minimal_roi = {"0": 0.1}
stoploss = -0.05
def populate_indicators(self, df: DataFrame, metadata: dict) -> DataFrame:
# Calculate RSI and EMA
df['rsi'] = ta.RSI(df, timeperiod=7)
df['ema20'] = ta.EMA(df, timeperiod=50)
return df
def populate_entry_trend(self, df: DataFrame, metadata: dict) -> DataFrame:
# Enter long only when RSI < 30 AND price > EMA20 (uptrend)
print(df[['close', 'rsi', 'ema20']].tail(20))
df.loc[
(df['rsi'] < 30) &
(df['close'] > df['ema20']),
'enter_long'
] = 1
return df
def populate_exit_trend(self, df: DataFrame, metadata: dict) -> DataFrame:
# Exit when RSI > 70 AND price >= EMA20
df.loc[
(df['rsi'] > 70) &
(df['close'] >= df['ema20']),
'exit_long'
] = 1
return df2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
📊 Backtest Report: RsiEmaStrategy
2024-06-01 → 2024-08-01
| Metric | Value |
|---|---|
| 📈 Strategy Name | RsiEmaStrategy |
| 📊 Total Trades | 5 |
| 🧮 Average Trade Return | +0.51% |
| 💰 Total P&L (USDT) | +8.205 USDT |
| 📈 Total ROI | +0.82% |
| ⏱ Avg Holding Time | 22h 36m |
| ✅ Win Rate | 80.0% (4W / 1L) |
| 📉 Max Drawdown | 0 USDT / 0.00% |
🧪 Tip: Combine with Bollinger Bands, MACD, or other indicators to further refine entries and exits.
IX. Summary
RSI is a classic and widely-used momentum indicator. It performs well in range-bound markets, effectively identifying overbought/oversold zones and potential reversal points.
However, in strong trending markets, RSI signals can become distorted, and using it alone may lead to premature entries or exits.
Recommendation: Combine RSI with trend-following tools (EMA, MACD, Bollinger Bands) or price action logic to enhance signal stability and reliability.
If you want, I can also translate the entire guide into a polished “trader-friendly English article”, keeping all diagrams, examples, and tips intact, ready for publication.
Do you want me to do that?