๐Ÿงฐ UtlKit

How to Calculate RSI from Closing Prices: Wilder Smoothing, Strict 70/30 Signals, in the Browser

Paste closing prices one per line or comma-separated, pick a period (default 14), seed the first average, then Wilder-smooth; overbought above 70, oversold below 30, all in the browser.

The RSI Calculator tool turns a list of closing prices into a Relative Strength Index series in the browser. There is a text area whose placeholder says Paste closing prices, one per line, followed by 150.25, 151.30, 149.80, 152.10, and a line of dots; next to it, an RSI Period field pre-filled with 14 and marked from 2; and a full-width Calculate RSI button. Pressing it builds the whole series at once: a result block with a small RSI Result label and a signal badge, the latest RSI in large digits, a bar from 0 to 100 ticked at 30, 50 and 70, and below it a table with columns Day, Close, RSI and Signal, one row per RSI value, marked up, down or flat. The page also carries an educational section, what RSI is, the formula, interpretation, divergence, and a table of common periods 7, 14 and 21, and three short FAQs. Nothing is sent anywhere: the parsing, the seeding, the smoothing, all of it runs on the device.

What the tool takes and what it gives

The inputs are the period field and the prices text area, and the only action is the Calculate RSI button, so nothing is computed live: the result block and the table appear together when you press it, or nothing appears. The large number is the RSI of the last row with its signal, and the table holds the whole series, from the first computable day to the last pasted price. The Day column counts prices, not calendar days: with a period of 14 the first row is Day 15, because RSI needs one price per period step plus one earlier price to compare against. Close is the price the row's RSI is computed from, shown with two decimals, and the Signal column marks overbought rows with an up triangle, oversold rows with a down triangle, and the rest flat.

How the prices text is parsed

The text is cut on line breaks and commas alike, so one price per line and comma-separated lines both work, and each piece is trimmed and read as a number with parseFloat. A piece that is not a finite number is dropped without a trace: a stray word between prices disappears, an empty line disappears. Two quirks are worth knowing because parseFloat is forgiving: a piece like 10abc is read as 10, and 1e2 is read as 100. So the list you compute over is exactly the finite numbers your text contains, in order, and if the text is empty or holds nothing numeric there is no list, and the calculation shows nothing.

How the first value is seeded

RSI compares the size of up moves to the size of down moves, close to close. The tool first builds the change between every pair of neighbors, 31 changes for 32 pasted prices, and takes the first 14 of them. Every change above zero adds to a gain total, every change at or below zero adds its size to a loss total; the two totals are divided by the period, giving the first average gain and average loss. If that first average loss is zero, the first RSI is set to 100; otherwise it is 100 minus 100 divided by one plus the ratio of the average gain to the average loss, the classic RS formula. That number lands in the first table row, Day 15 for a period of 14.

How the remaining values are smoothed

From the 15th change onward the averages do not restart; they follow Wilder's smoothing. Each new change contributes either a gain or a loss, exactly zero contributes to neither, and each average is replaced by the old average times period minus one, plus the new part, divided by the period. Because the old average carries most of the weight, the line moves slowly: a single spike barely dents it, and a calm stretch decays it step by step. Every price pasted after the first 15 adds one table row, so 32 prices at period 14 give 18 rows, and the large result is always the last row. A familiar test: the classic 32-close series at period 14 opens at 70.53, just past the overbought line, and sits in the fifties on the last row.

What overbought, oversold and neutral mean

The badge and the color follow three strict thresholds: an RSI strictly above 70 is overbought, strictly below 30 is oversold, and everything between is neutral, so a value of exactly 70 or exactly 30 is neutral, not a signal. The color is tied to price direction rather than good or bad, and it is locale-aware: in zh-CN a red up mark means the price is rising, the same thing a green up mark means in the West. The bar under the large number is simply the value clamped to 0 to 100, ticked at 30, 50 and 70. Two degenerate inputs are worth remembering: a series that only rises keeps its average loss at zero and reads 100 on every row, and a series that only falls reads 0 on every row.

When the calculation shows nothing

Three inputs produce no result at all, and the page then shows only the input form: a period that is not a number or is smaller than 1, a price list with fewer entries than the period plus one, and a text that parses to nothing. The period field is marked from 2, but typing 1 still computes, and a 14.7 is read as 14. Exactly the period plus one prices do work, and give a single row. A failed press also clears a previous result, which is why a bad press leaves the result block empty until the next good one. Pressing the button again with a fixed input replaces the result in place; there is no clear button, and a reload of the page starts from the empty form.

Where the prices go, and what it is not

Nowhere off the device. The text area is read by the page, the math runs in the browser, and no network request is made at any point; the series lives in the page state only, so a reload empties it. And the tool computes, it does not advise: overbought is a description of recent up momentum, not a sell order, and the page's own guide only says an overbought reading suggests the asset may be due for a pullback. For the companion indicators in the same price-series workflow, the ATR Calculator measures volatility, the Fibonacci Retracement Calculator marks retracement levels, and the Drawdown Calculator sizes the worst peak-to-trough decline; for the sizing side of a trade, see the position size guide.

Related Tools

Frequently Asked Questions

Why does the calculation show nothing?

Three inputs produce no result: a period that is not a number or is smaller than 1, a price list with fewer entries than the period plus one, and a text that parses to nothing. Exactly the period plus one prices is allowed and gives a single row, and a period like 14.7 is read as 14. A failed press also clears a previous result, so the result block is empty after a bad press until the next successful one.

How is the RSI computed here?

The list is compared close to close. The first average is the plain mean of the first period changes: up moves into a gain total, down moves into a loss total, each divided by the period; if that first average loss is zero, the first RSI is 100, otherwise it is 100 minus 100 over one plus the gain-to-loss ratio. Every following value re-averages with Wilder smoothing, where the old average keeps period minus one of the period shares, so the line moves slowly.

Why does the RSI read 100 or 0?

Two degenerate shapes do. A series that only rises keeps its average loss at zero, and zero average loss is the rule that the first RSI becomes 100, and smoothing keeps it there: every row reads 100. A series that only falls keeps its average gain at zero, and every row reads 0. A flat series, where nothing moves, is treated like the rising case: the average loss is zero, so every row reads 100.

Is exactly 70 or exactly 30 overbought or oversold?

No. The thresholds are strict: overbought requires the RSI to be strictly above 70, oversold strictly below 30, so a value of exactly 70 or exactly 30 is neutral, the same as a 50. In practice the smoothed line rarely lands on a whole number, but the code checks the two sides separately, and a row that lands exactly on the line is marked flat, not up or down.

Is this financial advice, and does it match charting packages?

It computes; it does not advise. Overbought is a description of recent up momentum, not a sell order, and the page says only that an overbought reading suggests the asset may be due for a pullback. The method is the standard Wilder smoothing, the same one the classic RSI uses, so on identical price input the numbers should agree; differences you see in charting software come from the price data itself, adjustments, time frame, time zone, not from the formula.

Related Articles