RSI Calculator: Formula, How to Use It
The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.
The Relative Strength Index (RSI) calculator works out the RSI value from a series of closing prices, which traders use to gauge whether an asset is overbought or oversold. You enter a list of prices (typically 14 periods) and the calculator returns the RSI on a 0–100 scale. This article explains the formula, how to interpret the result, and common pitfalls to avoid.
Formula
The RSI is calculated using the average gains and average losses over a lookback period, typically 14 periods. The standard formula is:
RSI = 100 – (100 / (1 + RS))
Where RS (Relative Strength) = Average Gain / Average Loss over the period.
For the first calculation, the average gain is the sum of all gains over the past 14 periods divided by 14, and the average loss is the sum of all losses (as positive numbers) divided by 14. After the first value, most charting platforms use a smoothed average (Wilder’s smoothing) that updates each period: Average Gain = (Previous Average Gain × (N – 1) + Current Gain) / N, and similarly for losses. This calculator uses the simple average of all gains and losses over the entire input list, which is the standard for a standalone calculation.
Worked Example
Using the default list of 14 closing 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.
First, calculate the price changes from one period to the next:
- 44.09 – 44.34 = –0.25 (loss of 0.25)
- 44.15 – 44.09 = +0.06 (gain of 0.06)
- 43.61 – 44.15 = –0.54 (loss)
- 44.33 – 43.61 = +0.72 (gain)
- 44.83 – 44.33 = +0.50 (gain)
- 45.10 – 44.83 = +0.27 (gain)
- 45.42 – 45.10 = +0.32 (gain)
- 45.84 – 45.42 = +0.42 (gain)
- 46.08 – 45.84 = +0.24 (gain)
- 45.89 – 46.08 = –0.19 (loss)
- 46.03 – 45.89 = +0.14 (gain)
- 45.61 – 46.03 = –0.42 (loss)
- 46.28 – 45.61 = +0.67 (gain)
Now sum the gains: 0.06 + 0.72 + 0.50 + 0.27 + 0.32 + 0.42 + 0.24 + 0.14 + 0.67 = 3.34. Sum the losses (as positive numbers): 0.25 + 0.54 + 0.19 + 0.42 = 1.40.
Average gain = 3.34 / 13 = 0.2569 (since there are 13 changes). Average loss = 1.40 / 13 = 0.1077.
RS = 0.2569 / 0.1077 = 2.385. Then RSI = 100 – (100 / (1 + 2.385)) = 100 – (100 / 3.385) = 100 – 29.54 = 70.46 (rounded to two decimals).
How to Read the RSI
The RSI is a momentum oscillator that measures the speed and magnitude of recent price changes. It ranges from 0 to 100. Common thresholds are:
- Above 70 – generally considered overbought, which may suggest a price pullback or reversal is due.
- Below 30 – generally considered oversold, which may suggest a price bounce or upward correction is possible.
- 50 – the midpoint, often seen as a signal of neutral momentum.
However, these levels are not absolute. In strong uptrends, the RSI can stay above 70 for extended periods, and in strong downtrends, it can remain below 30. Many traders look for divergences (price makes a new high but RSI makes a lower high) as a potential reversal warning.
Choosing the Period (N)
The default period is 14, as popularized by J. Welles Wilder in his 1978 book New Concepts in Technical Trading Systems. A shorter period (e.g., 7 or 9) makes the RSI more sensitive, producing more frequent overbought/oversold signals. A longer period (e.g., 20 or 25) smooths the indicator, giving fewer but potentially more reliable signals. The choice depends on your trading style: day traders often use shorter periods, while swing traders may use longer ones.
Common Mistakes and Misconceptions
One common mistake is using closing prices only, but the RSI can also be calculated using other price points (e.g., typical price = (high+low+close)/3). That changes the result. Another mistake is not using a consistent smoothing method. The simple average (as in this calculator) differs slightly from Wilder’s smoothed method, especially when the series is short. Also, many people treat RSI > 70 as a guaranteed sell signal, but in a strong trend, the RSI can stay overbought for a long time. Always use RSI in conjunction with other indicators or price action.
Limits of the Formula
The RSI is a lagging indicator – it uses past prices, so it cannot predict future moves with certainty. It is most useful in ranging (sideways) markets; in trending markets, it can produce many false signals. Also, the RSI does not account for volume or volatility, so it should not be used in isolation. Finally, the simple average method used here assumes you have all the data; in live trading, the smoothed method is more common because it updates incrementally.
Frequently Asked Questions
What does an RSI of 70 mean?
An RSI of 70 or above is traditionally considered overbought, meaning the asset has risen sharply and may be due for a correction or consolidation. However, it does not guarantee a price drop – in strong uptrends, the RSI can remain above 70 for a long time.
What is the best RSI period?
The 14-period RSI is the most widely used, but the best period depends on your trading timeframe. Shorter periods (7–9) give more signals, while longer periods (20–25) give fewer, potentially more reliable signals. Experiment with different periods to see what suits your strategy.
How do I calculate RSI manually?
To calculate RSI manually, you need a series of closing prices. Compute the price changes, separate gains and losses, average them over the period, then apply the formula RSI = 100 – (100 / (1 + RS)), where RS = average gain / average loss. The calculator above does this automatically.
Can RSI be used for any asset?
Yes, RSI can be applied to any asset with price data – stocks, forex, commodities, cryptocurrencies, etc. The interpretation remains the same, though the effectiveness may vary depending on the asset’s volatility and trading volume.
What is the difference between RSI and Stochastic Oscillator?
Both are momentum oscillators, but they measure different things. RSI compares the magnitude of recent gains to losses, while the Stochastic Oscillator compares the closing price to the price range over a period. They often produce similar signals, but they are calculated differently and can diverge.
Related
Formula used
in list | Closing 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 | 0 in p | Period (N) | 14 | 1 out rsi | RSI (14) | - | 100 - (100 / (1 + (mean(max(0, list - prev(list))) / mean(max(0, prev(list) - list))))) | 2 out avg_gain | Average Gain | - | mean(max(0, list - prev(list))) | 4 out avg_loss | Average Loss | - | mean(max(0, prev(list) - list)) | 4
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.