RSI Calculator
Turn average gain and loss into RSI, then see how to get RSI from 15 closing prices, in Excel, and what 70 and 30 mean. The form takes averages, not prices.
This RSI calculator converts Average Gain and Average Loss into a Relative Strength Index value. For positive averages, RSI = 100 − 100 ÷ (1 + Average Gain ÷ Average Loss). Prepare the averages first: the form does not accept closing-price history or perform Wilder’s smoothing, which updates averages using earlier values. Changing RSI Period alone does not recalculate the averages or the result.
The current form replaces a zero average gain or loss with a preset positive value. Its Trading Signal, Trend Strength, Divergence Check and Momentum Score labels also lack the price history needed to assess your chart. Extreme Level includes unsupported frequency claims. Use the positive-input arithmetic as a formula check and disregard those extra interpretations.
The three inputs are a final calculation step
- Average Gain: the positive average of upward price changes, using the chosen method and period. Enter a price-change amount, not the RSI reading or total percentage return.
- Average Loss: the size of downward changes averaged using the same method. Enter its positive magnitude, rather than a negative number.
- RSI Period: records the intended lookback. The form does not use this field to rebuild averages, so calculate them separately for that period.
The gain and loss figures must describe the same instrument, price source, timeframe and ending bar. A bar is one chart interval. Mixing a daily average gain with an intraday average loss produces a number with no consistent interpretation. There is no field here for choosing a symbol, uploading a price series or selecting a chart interval.
RS, shown as Relative Strength, is the average gain divided by the average loss. It is a ratio within the same price series. It does not compare a stock’s return with an index. The similarly named relative-strength comparison is a separate idea.
Worked example: average gain and loss to RSI
For a made-up example, assume Average Gain is 15 points and Average Loss is 10 points, prepared for a 14-period calculation. These are illustrative averages, not current Nifty, Bank Nifty or company data. Enter 15, 10 and 14 in the fields.
- Relative strength = 15 ÷ 10 = 1.5.
- RSI = 100 − 100 ÷ (1 + 1.5) = 60.00.
The RSI Value should display 60.00 for these positive inputs. The reading describes the balance of the supplied average changes; it is not a probability, percentage profit or forecast. If you change only the period field while leaving the averages unchanged, this calculator still gives the same RSI. New period settings require newly prepared averages.
As a separate illustrative check, Average Gain of 8 points and Average Loss of 8 points give RS = 1 and RSI = 50.00. Equal average gains and losses therefore sit at the centre of the RSI scale. Scaling both averages by the same factor leaves their ratio and RSI unchanged.
How Wilder’s averages are prepared
Wilder-style RSI begins with the average gains and losses over an initial window, then updates them using the earlier averages and the newest change. The chart provider StockCharts documents this sequence. Include a zero gain for a falling or unchanged interval, and a zero loss for a rising or unchanged interval. Divide by the whole window, rather than only the count of rising or falling intervals.
For the standard 14-period starting window, use 15 closing prices to obtain 14 close-to-close changes. Add the upward changes and divide by 14. Separately add the positive magnitudes of downward changes and divide by 14. Starting-window averages are only the seed; later Wilder values carry earlier information forward.
- Next average gain = (previous average gain × 13 + latest gain) ÷ 14.
- Next average loss = (previous average loss × 13 + latest loss) ÷ 14.
Continue the fictional example with previous averages of 15 and 10, followed by a price rise of 7 points. The latest gain is 7 and the latest loss is zero. The updated average gain is (15 × 13 + 7) ÷ 14 = 14.428571, rounded. The updated average loss is (10 × 13 + 0) ÷ 14 = 9.285714, rounded. Using the unrounded averages gives RSI of 60.84.
This update happens outside the form. The form has no previous-average or latest-change fields. You can enter the resulting positive averages to check the final RSI conversion. Keep extra decimal places until the last step; rounding each intermediate calculation can create a small difference from a chart.
Calculate RSI from closing prices: a full worked table
The form above takes finished averages. If you only have closing prices, build the averages first. The 15 closing prices below are invented for the example and are not market data. The first close is 100 (step 0, not shown in the table). Fifteen closes give 14 close-to-close changes, which fills the standard 14-period window.
| Step | Close | Change | Gain | Loss |
|---|---|---|---|---|
| 1 | 102 | +2 | 2 | 0 |
| 2 | 101 | −1 | 0 | 1 |
| 3 | 103 | +2 | 2 | 0 |
| 4 | 105 | +2 | 2 | 0 |
| 5 | 104 | −1 | 0 | 1 |
| 6 | 106 | +2 | 2 | 0 |
| 7 | 108 | +2 | 2 | 0 |
| 8 | 107 | −1 | 0 | 1 |
| 9 | 109 | +2 | 2 | 0 |
| 10 | 108 | −1 | 0 | 1 |
| 11 | 110 | +2 | 2 | 0 |
| 12 | 112 | +2 | 2 | 0 |
| 13 | 111 | −1 | 0 | 1 |
| 14 | 113 | +2 | 2 | 0 |
- Total gains over 14 changes = 18. Average gain = 18 ÷ 14 = 1.285714.
- Total losses = 5. Average loss = 5 ÷ 14 = 0.357143.
- RS = 1.285714 ÷ 0.357143 = 3.6.
- RSI = 100 − 100 ÷ (1 + 3.6) = 78.26.
Now the next close arrives at 112, a fall of 1 (gain 0, loss 1). Wilder's update gives a new average gain of (1.285714 × 13 + 0) ÷ 14 = 1.193878 and a new average loss of (0.357143 × 13 + 1) ÷ 14 = 0.403061. RS = 2.962025 and RSI = 100 − 100 ÷ (1 + 2.962025) = 74.76. You can type 1.1939 and 0.4031 into the form above to check the last step.
Wilder, simple and exponential averages
Wilder's smoothing keeps the old average and adds a fraction of the new change. For a 14-period RSI the old average gets a weight of 13/14 and the new change 1/14, which is the same as an exponential moving average with a smoothing factor of 1/14. A plain simple average drops the oldest change each bar instead. Both start from the same first 14-bar average, then drift apart, which is one reason two tools can show slightly different RSI values.
Why your chart can show a different RSI
TradingView’s own RSI documentation uses smoothed gains and losses and identifies the closing price as its default source. A single pair of hand-calculated averages will only reproduce a platform’s result when the price data and averaging method match.
- Check the instrument and data source: the underlying index, a futures contract and an option premium are different price series.
- Check the bar being compared: an unfinished bar can change while you type.
- Check the averaging method and its starting history. A fresh simple average and an ongoing Wilder average need not agree.
- Check price units: both averages need the same unit. Keep the loss input positive.
- Check the source setting, interval and lookback before concluding that the final RSI formula is wrong.
A useful comparison note records the symbol, interval, ending bar, method, input averages and chart value together. It makes a difference traceable. Repeatedly changing the period field in this form cannot resolve a mismatch caused by different historical inputs.
RSI in Excel or Google Sheets
Put closing prices in column B, starting at B2 (the first close is B2, the second B3). Then:
- Change in C3: =B3-B2
- Gain in D3: =MAX(C3,0)
- Loss in E3: =MAX(-C3,0)
- First average gain in F16 (after 14 changes, rows 3 to 16): =AVERAGE(D3:D16)
- First average loss in G16: =AVERAGE(E3:E16)
- Next average gain in F17: =(F16*13+D17)/14, and copy it down
- Next average loss in G17: =(G16*13+E17)/14, and copy it down
- RSI in H16: =IF(G16=0,100,100-100/(1+F16/G16))
The IF handles the case where there are no losses, which the form above does not. Compare your sheet with a chart using the same close prices and the same ending bar.
What RSI period suits intraday trading
Wilder's default is 14 periods, and charting tools commonly start there. A shorter period reacts faster and swings more; a longer one is smoother and slower. No setting is proven best, and the right choice depends on the timeframe you chart. If you change it, change it in your journal notes too so you can compare like with like. On an intraday chart a period is one bar, so 14 periods on a 5-minute chart cover 70 minutes.
Overbought and oversold describe conditions
Fidelity describes RSI on a scale from 0 to 100, with traditional overbought readings above 70 and oversold readings below 30. Its guide also cautions that readings can remain extended during strong trends. Those thresholds do not establish when a reversal will happen or where an exit will execute.
For an illustration, a reading of 75 is above the conventional upper threshold, while 25 is below the lower threshold. Those made-up readings describe position on a scale. They do not prove that the next price change will reverse. The RSI indicator guide expands on interpretation.
Divergence means price and RSI swings disagree. Assessing it requires observations across time, not one gain/loss pair. This form has no chart swings or previous RSI input. Its displayed Divergence Check cannot verify a real chart pattern. For the method itself, see how RSI divergence is read.
Is RSI above 70 or below 30 good or bad?
Neither. Above 70 and below 30 are the traditional markers for overbought and oversold, as StockCharts and Fidelity describe them, and both say the levels can be adjusted. In a strong trend RSI can stay above 70 for a long time. In a sideways market, traders often watch these levels more closely, but a turn is never assured. Treat RSI as a description of recent momentum, not as a buy or sell instruction. It tells you nothing about size, stop or exit, which you still have to plan.
- Trending market: RSI can stay extended; an extended reading alone is a weak reason to act.
- Range-bound market: readings near the ends of the scale are checked against support and resistance.
- Always write down what you will do before you take a trade, and test your rule in your journal over many trades.
Zero averages are an important exception
If average loss is zero while average gain is positive, the usual RSI endpoint is 100. If average gain is zero while average loss is positive, it is 0. This version does not handle those entered zeros correctly because it substitutes defaults before reaching the endpoint logic. Calculate such cases separately.
If both averages are zero, the gain/loss ratio cannot be calculated. Avoid treating a neutral display chosen by software as evidence of directional momentum. A flat series and equally sized nonzero average gains and losses are different input situations, even when a platform chooses a similar-looking midpoint display.
RSI divergence explained
Divergence is when price and RSI move in different directions. Bearish divergence: price makes a higher high while RSI makes a lower high. Bullish divergence: price makes a lower low while RSI makes a higher low. In both cases momentum is not confirming the price move.
A fictional example: a stock rises to 200, pulls back, then rises to 205. At 200 the RSI read 72. At 205 it reads 66. Price is higher, RSI is lower, so a chartist would call this bearish divergence. It is a warning that the push is weaker, not a signal that price must fall. Divergences can fail, and price can keep trending while RSI diverges. Read the full method in how to trade RSI divergence, and the RSI indicator guide.
Related indicators
RSI is a momentum oscillator. Others used alongside it include the stochastic oscillator and MACD, which measure momentum differently and do not always agree with RSI. Whichever you use, note it on each trade so your journal can later show whether it helped.
Sources
- TradingView: RSI formula and source settings (checked 15 October 2026).
- StockCharts: initial averages and Wilder smoothing (checked 15 October 2026).
- Fidelity: RSI scale, thresholds and trend caveats (checked 15 October 2026).
Related Topics
Related Articles
Absolute Returns Calculator: Total Gain or Loss
Absolute return calculator with formula, worked rupee examples and a comparison with CAGR and XIRR. Learn when absolute return misleads, such as for SIPs.
Options Rollover Calculator
Work out the debit or credit of rolling an option from premiums and lots. Learn roll up, down and out, charges, STT, and futures rollover cost and percentage.
Options Probability Calculator: Model Inputs and Limits
Estimate an option's expected move and price range from price, volatility and days to expiry, with a worked example and why the probability cards need care.
Trading Expectancy Calculator: Formula and Example
Trading expectancy calculator (EV per trade) from win rate, average win and average loss. See R-multiples, profit factor, sample size and low win-rate examples.
Trading Emotion Tracker: Review Feelings and Plan Discipline
Free trading emotion tracker. Log the mood, intensity and plan discipline behind a trade, get a simple rule-based score, and keep a record to review later.
MACD Calculator: Line, Signal and Histogram
Calculate the MACD line, signal line and histogram from your moving averages, with the formula, a worked example and how to read crossovers.
The trading journal for Nifty, Bank Nifty and Indian F&O. Track your trades, spot patterns, build discipline.
- Log one trade a day by hand, on purpose
- AI mentor finds your repeat mistakes
- Behavioural analytics catch tilt early
- Trading calendar with P&L heatmap
- Pre-trade checklist flags risks
Yearly ₹3,499 · No broker credentials