Home / Guides / RSI formula

RSI formula

The relative strength index is 100 minus 100 divided by (1 plus RS), where RS is the average gain divided by the average loss over a period, usually 14. In a worked example with 16 sample closes the first reading is 70.7, and in a second example with a falling series it is 23.5 (sample arithmetic, 26 Nov 2026).

Illustration for the rsi-formula guide: the RSI scale from 0 to 100 with marks near 30 and 70 and a reading line.

Last updated 26 Nov 2026. Reviewed by the Custom Trading Platform education desk. Every figure on this page is sample arithmetic, shown in full.

The formula in five steps

  • Step 1, changes: subtract each close from the next one. A rise is a gain. A fall is a loss, written as a positive number.
  • Step 2, first averages: add the gains of the first 14 changes and divide by 14. Do the same for the losses.
  • Step 3, RS: divide average gain by average loss.
  • Step 4, RSI: RSI equals 100 minus (100 divided by (1 plus RS)).
  • Step 5, smoothing: for each later close, new average equals (previous average times 13 plus the new gain or loss) divided by 14. This is Wilder smoothing.
  • If average loss is zero, RSI is 100. If average gain is zero, RSI is 0.

Worked example 1: a rising series (sample numbers)

Sixteen closes: 44, 44.5, 43.8, 44.6, 45.2, 45, 45.8, 46.3, 45.9, 46.5, 47, 46.4, 46.9, 47.4, 47.1 and 46.2. The first 14 changes have gains adding to 5.3 and losses adding to 2.2. Average gain is 5.3 divided by 14, 0.3786, and average loss is 2.2 divided by 14, 0.1571. RS is 2.409 and RSI is 100 minus 100 divided by 3.409, which is 70.7. The 15th change is minus 0.9 (47.1 to 46.2): new average gain is (0.3786 times 13 plus 0) divided by 14, 0.3515, new average loss is (0.1571 times 13 plus 0.9) divided by 14, 0.2102, RS is 1.672 and RSI is 62.6.

Worked example 2: a falling series (sample numbers)

Sixteen closes: 50, 49.4, 49.9, 49.1, 48.6, 48.9, 48.2, 47.8, 48, 47.3, 46.9, 47.2, 46.5, 46.1, 46.4 and 45.6. The first 14 changes are minus 0.6, 0.5, minus 0.8, minus 0.5, 0.3, minus 0.7, minus 0.4, 0.2, minus 0.7, minus 0.4, 0.3, minus 0.7, minus 0.4 and 0.3. The gains add to 1.6 and the losses add to 5.2. Average gain is 1.6 divided by 14, 0.1143, and average loss is 5.2 divided by 14, 0.3714. RS is 0.3077 and RSI is 100 minus 100 divided by 1.3077, which is 23.5. The 15th change is minus 0.8 (46.4 to 45.6): new average gain is (0.1143 times 13 plus 0) divided by 14, 0.1061, new average loss is (0.3714 times 13 plus 0.8) divided by 14, 0.4020, RS is 0.264 and RSI is 20.9.

ExampleAverage gainAverage lossRSRSI
1, first reading0.37860.15712.40970.7
1, next reading0.35150.21021.67262.6
2, first reading0.11430.37140.307723.5
2, next reading0.10610.40200.26420.9

Wilder smoothing against a simple average

Some tools average the last 14 changes with a plain average instead of Wilder smoothing. In example 2, the plain average of the last 14 changes (dropping the first change and adding the 15th) has gains of 1.6 and losses of 5.4, which gives RSI 22.9 instead of 20.9. The difference is small but real, which is why two charts can show different values for the same prices. Check which method your chart uses.

How RS turns into RSI

RSRSI
0.2520.0
0.428630.0
150.0
2.33370.0
480.0

Laying it out in a spreadsheet

Put the closes in column A. In column B, the change (this close minus the one above). In column C, the gain (the change if positive, otherwise 0), and in column D, the loss (minus the change if negative, otherwise 0). In the row of the 14th change, E is the average of C and F is the average of D for the first 14 rows. In each later row, E equals (E above times 13 plus C) divided by 14, and F likewise with D. Then G is E divided by F and H is 100 minus 100 divided by (1 plus G). Or use the RSI calculator, which shows every step.

What the formula cannot tell you

The formula measures the balance of recent gains and losses. It says nothing about what price does next. For what RSI 30 and 70 readings were followed by in our own hourly tests on five markets, see the RSI guide, and for the effect of the period and the marks, see the best RSI settings. Results quoted from our tests are from past data and do not predict what will happen. These tests were run on the signal matrix with a flat cost per market (spread, slippage and commission, not swap). The gold and BTCUSD costs are assumptions, and a tick level spread read would refine them. The newer events, divergence especially, and the costs have not been checked independently by a second person.

Sources and method

Every figure on this page is sample arithmetic, shown in full, as of 26 Nov 2026. Each worked example was recomputed by a second method before it was kept. How we check numbers is on the methodology page, the people behind the site are on the about page, and corrections go through contact.

How we will test it

We will run both examples and every table row through a second spreadsheet calculation, compare with the working above, and repeat at a second set of sample closes and at periods 7 and 21. Last tested: not yet, results pending.

Questions people type

What is the RSI formula? RSI equals 100 minus (100 divided by (1 plus RS)), where RS is the average gain divided by the average loss over the period.

How do you calculate RSI step by step? Find the changes, average the gains and losses over 14 periods, divide to get RS, apply the formula, then smooth each later average.

What is RS in the RSI formula? Relative strength: the average gain divided by the average loss over the period.

What is Wilder smoothing? Each new average equals the previous average times 13 plus the new value, divided by 14, so older changes fade gradually.

Why does my RSI differ from my chart? Charts differ in smoothing and in how many earlier closes they use to start the averages.

What does an RSI of 100 mean? Average loss is zero over the window: every change was a gain or none.

Related

Glossary, RSI guide, RSI calculator, RSI indicator test, RSI divergence test, MACD indicator test, Bollinger Bands test, volatility calculator, stop loss calculator, position size calculator, disclaimer

Start free: create a free account to get the weekly note on tools and tests.

Education only. Nothing here is financial advice or a signal.

More: all indicator guides, guides.