Tools · Momentum

RSI Calculator, Wilder RSI for Any Period, Step by Step

Paste a column of closing prices, choose a period, and get the Relative Strength Index with every intermediate step shown, average gain, average loss, relative strength and the final reading.

RSI calculator

The sample is the standard 30-close series used to verify RSI implementations. This page reproduces its published values exactly, 70.53, then 66.32, then 66.55. Note the precision: the same series rounded to two decimals returns 70.46, which is how most "my RSI doesn’t match" reports start.

Enter prices and press Calculate.

Closing price and its 14-period RSI, sample seriesThe upper panel plots thirty closing prices. The lower panel plots the 14-period Relative Strength Index of the same series, which starts at 70.53 in the upper half of the range and falls to 45.46 as the closes roll over. The shaded bands mark the conventional 70 overbought and 30 oversold levels; the index never reaches either on this series.46.843.3CLOSE70503045.46RSI 14
Fig. 1: the sample series in the calculator aboveThirty closes and their 14-period RSI, computed at build time by the same arithmetic described below. Note what the index does at the end: price falls roughly two dollars from its high, and RSI drops from the upper 60s to the mid 40s, a full move through the middle of the range without ever touching 30. Most of an indicator's life is spent in the part of the scale where it says the least.

Wilder’s smoothing, step by step

The RSI calculator above works the whole series through for any period you choose, step by step, and prints the intermediate columns rather than only the answer. What it does is compare the size of recent gains to the size of recent losses and express the result on a 0–100 scale. Three steps, in order.

  1. Split each bar’s change into a gain or a loss. A close higher than the previous one contributes its difference to gains and zero to losses; a lower close does the reverse. Losses are recorded as positive numbers.
  2. Average them, with Wilder’s smoothing, not a plain mean. The first average is a simple mean of the first n values. Every average after it is ((previous × (n − 1)) + current) ÷ n, which keeps the whole history in the figure with decreasing weight. This is the step platforms disagree on, and it is why two RSI lines with the same period can differ.
  3. Convert to the index. Relative strength is RS = average gain ÷ average loss, and RSI = 100 − (100 ÷ (1 + RS)). When average loss is zero the formula divides by zero, and RSI is defined as 100.

Reading the result, for any period

Working it step by step is also the only way to see where a disagreement with a platform comes from. Any period can be used and 14 is only Wilder’s own default, so the reading has to be interpreted against the period that produced it: a 5-period RSI reaches both extremes several times a month, and a 30-period one may not reach either in a quarter. The scale is bounded, which is its whole appeal: 0 and 100 are real limits, so readings are comparable across instruments and across time in a way that a raw price change is not. What the number does not tell you is direction. RSI at 78 says the recent gains have dwarfed the recent losses; whether that is exhaustion or the middle of a powerful trend is a question the indicator cannot answer alone.

This is why the two conventional levels are worth treating as observations rather than instructions. In a range, 70 and 30 mark useful edges. In a trend, RSI compresses into the upper or lower half of its range and stays there, during the 2020 recovery, many large-cap names held RSI above 70 for weeks at a time. A trader who sold each crossing would have been out on the first one.

The reading that historically carries more information is divergence: price making a higher high while the RSI calculator returns a lower one, meaning each new price extreme is being achieved with less momentum behind it. Divergence is not a timing signal either (it can persist for a long time), but it is a legitimate warning that the move is being carried by fewer and smaller pushes. Pair it with what the volume is doing and you have two independent readings of the same weakening, which is the whole method this site is built around.

Why two platforms disagree: in order of likelihood

"My RSI does not match" is the most common question about this indicator, and it almost never turns out to be a mistake in the formula. Working through these four in order settles it in a few minutes.

1. Input precision

The most frequent cause and the easiest to overlook. The standard verification series returns 70.53 at full precision and 70.46 when the same closes are rounded to two decimals, a gap large enough to look like a bug and produced entirely by the data. Before comparing anything, check how many decimals each source carries.

2. The smoothing constant

Wilder's averaging is ((previous × (n − 1)) + current) ÷ n. A conventional exponential average uses 2 ÷ (n + 1), which for n = 14 is a materially faster line, equivalent to Wilder's smoothing at a period of 27. An implementation that substitutes one for the other produces a plausible-looking RSI that is simply a different indicator.

3. How much history was supplied

Because the smoothing is recursive, the seed never fully leaves. Two correct implementations fed different amounts of history will disagree in the second decimal for dozens of bars. This is not an error in either; it is a property of the method, and it is why the figure below the calculator says to feed several hundred bars before comparing.

4. Which variant

Wilder's original against Cutler's simple-average version. The lines are close, the shapes differ slightly at turns, and almost no platform states which it implements.

Checking an implementation step by step

The columns this calculator prints exist so that a single value can be verified without trusting anything. The procedure takes about two minutes.

  1. Take any row from the table and note its average gain and average loss, together with the same figures from the row above.
  2. Compute the change between those two bars' closes, and split it: the positive part is the current gain, the negative part the current loss, both as positive numbers.
  3. Apply the recursive step by hand, (previous average × 13 + current) ÷ 14 for a 14-period setting, and confirm it reproduces the printed average.
  4. Divide the averages, apply 100 − (100 ÷ (1 + RS)), and confirm the RSI value.

If step three fails, the smoothing constant is wrong. If steps three and four both hold but the value still disagrees with another platform, the difference is in the input data or in how much history each was given, and neither is a bug.

Why the calculation is shaped this way

Wilder published RSI in 1978 in New Concepts in Technical Trading Systems, alongside the Average True Range, the Directional Movement system and Parabolic SAR, all of which share the same smoothing. The recursive form was not chosen for its statistical properties but for a practical one: a person working with a pencil needs to carry only a single running figure forward from yesterday, rather than re-summing a window of fourteen numbers each evening.

That constraint disappeared decades ago and the convention did not, which is fortunate. The method persisted long enough to become the default on every platform, so the 14-period line a great many participants watch is the same line, and a level many people act on behaves differently from one nobody does. The arithmetic is a historical accident; its ubiquity is the reason it still matters.

Where it misleads

Known failure modes
SituationWhat goes wrong
Strong trendRSI parks above 70 or below 30 for extended stretches; crossings generate a stream of losing counter-trend signals.
Too little dataThe smoothing has not converged, so the reading depends on where your series happens to start rather than on the market.
Illiquid instrumentGaps and stale closes create artificial gains and losses; the index reacts to the quote, not to trading.
After a split or dividendUnadjusted prices produce one enormous "loss" that distorts the average for the whole smoothing window.
Period shoppingTrying 7, then 9, then 21 until a signal appears fits the indicator to the past, which is the definition of a curve fit.

Frequently asked questions

Why does my RSI differ from my charting platform?

Almost always because of smoothing. Wilder’s original RSI averages gains and losses with a smoothed moving average that carries the whole history forward, while some platforms use a simple or exponential average over the last n bars instead. The first reading also depends on how much data you feed in: RSI needs a seed period, and a series that starts 30 bars ago will not match one that starts 300 bars ago until the smoothing converges. Feed at least 5× your period for a stable figure.

What period should I use?

Wilder used 14, and that remains the default almost everywhere, which matters in itself, a level that many participants watch becomes self-reinforcing. Shorter periods (7, 9) react faster and produce far more overbought and oversold readings; longer periods (21, 25) produce fewer but leave you later. Change the period for a reason you can state, not to make a signal appear.

Does RSI above 70 mean sell?

No. In a strong trend RSI can sit above 70 for weeks while price keeps rising, and selling each time it crosses 70 is one of the most reliable ways to exit a trend early. Overbought means the recent gains have been large relative to recent losses, a statement about momentum, not about value or about what happens next.

Is there a period that works better than 14?

Not in any way that survives out of sample, and the search for one is how most people lose time with this indicator. Shorter periods reach the extremes more often and produce more signals of which a larger share are wrong; longer periods produce fewer and later. Fourteen has no statistical claim — Wilder offered none — but it is the default everywhere, which means a great many participants are acting on the same line. That coordination is a real effect and it is the strongest argument for leaving the setting alone.

How should I handle gaps and missing sessions?

Feed a continuous series and let the gap be an ordinary change. A weekend or a holiday is not a missing bar, the next close simply follows the previous one, and the difference between them enters the calculation as any other change would. What does need fixing is genuinely absent data: a symbol that did not trade for a week leaves a hole, and interpolating across it invents changes that never happened.

Can I compare RSI values between two instruments?

For the level, yes, and it is the property that makes this indicator unusual. Because the scale is bounded and the calculation contains nothing external, two instruments at 75 have had a comparably one-sided run of gains against losses. What you cannot infer is comparable magnitude: a stock that rose two per cent on twelve of fourteen sessions and one that rose twenty per cent on the same pattern produce similar readings. The measure describes consistency, not size.

Why does the calculator show only the last eight rows?

Because the purpose is verification rather than a data dump. Eight rows is enough to check the recursive step by hand and see the trajectory, and a full table of several hundred lines would be scrolled past rather than read. The computation runs over everything you paste; only the display is trimmed.

Does the sample data mean anything?

It is the standard thirty-close series used to verify RSI implementations, and this page reproduces its published values exactly, 70.53, then 66.32, then 66.55. If you change nothing and press Calculate, matching those three figures confirms the arithmetic on this page against an external reference before you trust it with your own data.

How many bars does the calculation need before it stabilises?

More than most people feed it. Wilder smoothing is recursive: each average is built from the one before, so the influence of the seed value decays but never disappears. In practice the difference between a series started 50 bars ago and one started 500 bars ago becomes negligible after roughly five times the period, about 70 bars for RSI(14), and is still visible in the second decimal before that. If you are comparing two implementations, give both several hundred bars before concluding anything.

What exactly is the seed value?

The first average gain and average loss are a plain arithmetic mean of the first n changes; every value after that is recursive. That single simple mean is the seed, and it is where two otherwise identical implementations most often diverge, some platforms seed from the first n bars of the data you supplied, others from the first n bars of their own history for that symbol. Neither is wrong, and the results differ until convergence.

What happens when there are no losses at all?

The average loss reaches zero, relative strength is undefined, and RSI is defined as 100 by convention. Implementations handle it differently, some return 100, some return an error, some quietly produce infinity and then render nothing. It is rare on liquid instruments over 14 periods, and common on short periods: RSI(2) hits the boundary regularly, which is one of the reasons that variant behaves so differently.

Does this calculator use Wilder or Cutler smoothing?

Wilder, the recursive form, which is the original and the default nearly everywhere. Cutler's variant uses a simple moving average of the gains and losses instead, forgetting everything older than n bars entirely. Cutler's is reproducible from a short series and Wilder's is not, which is why spreadsheets and academic papers often use it without saying so. If your figures disagree with a published table, this is worth checking before anything else.

Can I paste intraday data?

Yes; the arithmetic does not care what a bar represents. What changes is interpretation: RSI(14) on five-minute bars covers just over an hour, and the same thresholds that are conventional on a daily chart have no standing there. If the series spans a session boundary, note that the gap between the close and the next open enters as a single large change, which can distort the averages for the rest of the window.

What is the most common implementation bug?

Using an exponential moving average with the standard 2 ÷ (n + 1) multiplier in place of Wilder's smoothing, which is equivalent to an EMA of period 2n − 1. An RSI(14) built that way behaves like an RSI(27) and looks plausible (the line is smooth, bounded and shaped roughly right), so the error survives review. The check is to compute one value by hand from the columns this page prints; if the recursive step does not match, the smoothing constant is the culprit.

Can RSI be calculated on volume instead of price?

Yes, and the result is a different indicator with the same arithmetic: substitute volume for the closing price and you get Volume RSI, which measures whether up-volume or down-volume has dominated recently. It answers a question price-based RSI cannot: whether participation is confirming the move.