RSI Indicator Explained: Formula, Overbought and Oversold, Divergence and Failure Swing
Lesson 5 of 10 · Intermediate
What RSI is and how it is calculated
The Relative Strength Index (RSI) was introduced by J. Welles Wilder in his 1978 book. It is a momentum oscillator that moves between 0 and 100 and compares the size of recent gains with recent losses over a set period. The standard default is 14 periods.
- For each candle, compute the change in close versus the previous close. A positive change is a “gain” and a negative change is a “loss” (recorded as a positive number).
- Take the simple average of gains and the simple average of losses over the first 14 periods.
- From then on, apply Wilder's smoothing: new average = (previous average × 13 + current value) / 14.
- RS = average gain / average loss and RSI = 100 − 100 / (1 + RS).
Wilder's smoothing is equivalent to an EMA with an effective period of about 27, which is why RSI behaves more slowly than the number 14 suggests. Also, because each value depends on all earlier data, RSI can differ slightly between platforms that load different amounts of history.
Overbought, oversold, range shifts and the 50 line
The classic levels are 70 and 30: above 70 is “overbought” and below 30 is “oversold.” But overbought only means price has risen strongly over the recent window, not that it must turn. In strong gold trends RSI can stay above 70 for days, and selling purely because of a high RSI reading means standing in front of the trend. Some traders use 80 and 20 in strong trends instead.
A more useful application is the range shift. In a healthy uptrend, RSI tends to oscillate roughly between 40 and 80, and pullbacks often stall in the 40 to 50 zone; in a downtrend the range moves to roughly 20 to 60. When RSI drops below 40 on a pullback inside an uptrend, the quality of the trend has changed. The 50 line also works as a simple boundary between positive and negative momentum. These ranges are approximate and vary by market and timeframe.
Regular and hidden divergence
Divergence is a mismatch between the path of price and the path of RSI:
- Regular bearish divergence: price makes a higher high while RSI makes a lower high; upward momentum has weakened.
- Regular bullish divergence: price makes a lower low while RSI makes a higher low; selling pressure has eased.
- Hidden (continuation) divergence: in an uptrend, price makes a higher low while RSI makes a lower low. It often shows up in deep pullbacks inside a trend and raises the possibility that the trend continues. The bearish version is the reverse.
Divergence is a warning, not a signal. In strong trends, several divergences can form in a row while price keeps going. Divergence becomes practically meaningful when price structure changes too, for example when the latest higher low breaks. Also compare divergence only between corresponding highs or lows; joining two arbitrary points on RSI that do not match price turning points creates artificial divergence.
Failure swing: Wilder's own pattern
Wilder put a lot of weight on a pattern called the failure swing, which is defined entirely on RSI itself, independent of the shape of price. The top version:
- RSI rises above 70.
- RSI pulls back and forms an interim low.
- RSI rises again but cannot exceed its previous peak (sometimes it does not even reach 70).
- RSI breaks below the interim low from step 2; that is the confirmation point of the pattern.
The bottom version is the mirror image below 30. The logic is that after an extreme phase, momentum no longer has the strength to rebuild itself. As with any pattern, its usefulness varies by market and conditions and should be tested before relying on it.
The advantage of the failure swing is its clear confirmation point and its independence from interpreting price shapes. The drawback is that in strong trends RSI can form this pattern several times while price still continues with the trend. For that reason, view it alongside price structure and key levels rather than alone.
Hypothetical gold example
The numbers are hypothetical. On the 4-hour chart gold makes a high at 3920 with RSI near 76. After a pullback, price makes a new high at 3935, but RSI only reaches 64: regular bearish divergence. At this moment there is no “signal”; there is only a warning about slowing momentum. If price then loses its latest higher low at 3890 and RSI falls below 50, the combination of divergence and a structure break gives stronger evidence for a deeper pullback scenario. If price makes a new high without breaking 3890, the divergence was merely a sign that the pace had slowed.
Timeframe matters too. Divergence on the 5-minute chart may explain only a pause of a few minutes, whereas divergence on the daily chart can matter for weeks. A shorter RSI, for example 7 periods, is more sensitive and noisier, while a longer one, such as 21 periods, is slower and smoother.
Common mistakes
- Selling only because RSI is above 70 in a strong uptrend.
- Acting on divergence without confirmation from price structure.
- Drawing divergence between points that do not match corresponding price highs or lows.
- Constantly changing the RSI period until the chart fits a prior opinion.
- Using RSI, Stochastic and CCI together in the belief that they are three independent confirmations.
What does volume say here?
RSI is built only from closing prices; it says how fast price moved but not who moved it. Delta divergence tests that question directly. Suppose price makes a higher high and RSI shows bearish divergence. If cumulative delta is also lower at the second high, aggressive buying has genuinely faded and the new high came mostly because sellers stepped aside; two pieces of evidence from different sources agree.
A more telling case is when RSI shows divergence but delta at the second high is very strong and price still cannot rise despite heavy aggressive buying. That is a sign of absorption by passive limit sellers, and it often carries more precise information than RSI divergence alone. Conversely, if RSI is overbought but the volume profile shows price accepted in the new area and value migrating higher, “overbought” may signal trend strength rather than its end. For gold, reliable delta and volume come from COMEX GC futures (translated to XAUUSD with the live basis), not from CFD tick volume.
📊 See real gold futures volume behind these ideas: free order flow course · today's gold volume map
Frequently asked questions
What is the best RSI setting for gold?
14 is the standard and most widely used setting. A shorter period adds sensitivity and noise; a longer one gives fewer and later signals. Any change should be tested on enough data.
Is hidden divergence more reliable than regular divergence?
Both are only warnings. Regular divergence points to exhaustion of a move and hidden divergence to a possible continuation. Reliability depends on the higher-timeframe trend context and confirmation from price structure.
Is RSI crossing 50 useful?
Yes. The 50 line is a simple boundary between positive and negative momentum and, alongside trend structure, can show a change in the quality of a move. In a range, repeated crosses of 50 tell you little.
Education only, not a recommendation to buy or sell; we never give signals. Price examples are illustrative. Test any method on a demo account first, with strict risk management.