How RSI Strategies Are Calculated

RSI calculation parameters inputs limitations verification.

Direct answer

RSI (Relative Strength Index) is calculated from a time series of prices by turning each period’s gain or loss into two running averages—average gains and average losses—over a chosen lookback window. Those two averages are converted into a relative-strength ratio, which is then mapped to an oscillator value from 0 to 100.

Mechanism and definition

What RSI tries to measure

RSI aims to express how strong recent price increases are compared with recent price decreases. To do that, it needs step-by-step price changes (for example, closing-to-closing changes per period). Each period’s change is split into:

  • Gain: the increase from the prior period, or 0 if the change is negative.
  • Loss: the decrease from the prior period, expressed as a positive number, or 0 if the change is positive.

Core ingredients (inputs)

To calculate RSI consistently, you must have:

  1. A price series at a defined frequency (e.g., one value per bar). RSI is not a “magic number”; it is computed from the sequence you provide.
  2. A lookback window length (N), commonly 14 periods in many charting contexts.
  3. A smoothing method for average gains and losses (a major source of differences between RSI implementations).
  4. A convention for the first averages (initialization), since the earliest RSI values depend on how the averages start.

The widely used RSI formula structure

RSI uses the following intermediate values:

  • Average Gain over the lookback window
  • Average Loss over the lookback window
  • Relative Strength (RS) = (Average Gain) / (Average Loss)

Then RSI is mapped to:

  • RSI = 100 − (100 / (1 + RS))

This structure means RSI is high when average gains dominate average losses, and low when average losses dominate average gains.

Wilder’s smoothing (common variant)

Many platforms use Wilder’s smoothing to update the averages each period. In that approach, if you already have the prior average gain and average loss, you update them using the current gain/loss and the previous averages.

At a high level, the update follows the pattern:

  • New average gain is a mix of previous average gain and current gain, weighted by the lookback window.
  • New average loss is a mix of previous average loss and current loss, weighted by the lookback window.

The exact arithmetic update is implementation-dependent, but the key idea is the same: it smooths gains and losses rather than recomputing simple averages from scratch every step.

How “RSI Strategies” relate to calculation

“RSI strategies” can mean any rule set that uses RSI values (for example, conditions based on RSI being above or below a threshold, or RSI crossing a level). The important separation is:

  • Calculation: RSI is computed deterministically from price data, N, and the smoothing/initialization choices.
  • Strategy logic: any trading-style rule interprets RSI values. The same RSI calculation can be used with many different decision rules.

If you want to independently verify RSI, focus on the calculation steps and ensure you match the exact RSI settings used by your data source or software.

Evidence or example (with clear assumptions)

Example setup and assumptions

Because different RSI implementations can differ, this example states its assumptions explicitly:

  • We use a period-by-period close-to-close price series.
  • We choose a lookback window N = 14.
  • We use a smoothing approach conceptually consistent with Wilder-style smoothing.
  • We compute gains and losses using: gain = max(change, 0) and loss = max(-change, 0).

Step-by-step structure you can reproduce

  1. Compute changes: change[t] = price[t] − price[t−1].
  2. Split into gain and loss:
    • gain[t] = max(change[t], 0)
    • loss[t] = max(−change[t], 0)
  3. Initialize average gain and average loss at the point where enough periods exist to cover N.
    • A common initialization is a simple average over the first N gains and the first N losses.
  4. Update averages each new period using the chosen smoothing method.
  5. Compute RS: RS = averageGain / averageLoss.
  6. Convert to RSI: RSI = 100 − (100 / (1 + RS)).

A critical edge case to check

If the average loss becomes 0, then RS becomes undefined or effectively infinite depending on implementation. Many RSI implementations handle this by assigning RSI values at the extremes (for example, an RSI of 100 when there are no losses in the averaging window). When you verify an RSI output, confirm how your tool handles cases with zero average loss (and similarly what happens if average gain is 0).

Limitations and risks (what can go wrong)

1) Initialization and early values

RSI values at the start of a series depend on initialization. Different platforms may:

  • use a simple average for the first averageGain/averageLoss,
  • use a different warm-up approach,
  • or choose a different way to seed the smoothing.

That means early RSI values can differ even if later values converge.

2) Variant differences (smoothing and input definition)

Even with the same N, RSI can vary because implementations differ in:

  • smoothing method (Wilder-style vs simple averaging vs other approaches),
  • whether the input is closes, typical price, or another price field,
  • how periods are defined (timeframe alignment, missing bars).

So “the RSI value” is only well-defined once you specify the exact calculation variant and the exact input series.

3) Data dependency and non-predictive nature

RSI is a transformation of historical price changes. Historical transformations do not guarantee how RSI will behave in the future, and the same RSI value does not imply a single outcome. Also, costs and execution details (which are not part of the RSI calculation) can dominate any practical results.

4) Verification can be undermined by mismatched settings

A common failure mode is assuming the default RSI settings match what you need to reproduce. To verify independently, you must match:

  • the exact N,
  • the smoothing/averaging variant,
  • the price series used,
  • and the handling of edge cases.

Verification and next question

How to verify your RSI calculation independently

To validate RSI values from any system, recompute RSI using the same inputs and settings:

  1. Export or recreate the same price series used by the tool.
  2. Match N exactly.
  3. Match smoothing/averaging method and initialization.
  4. Recalculate gain/loss splits, then average gains/losses, then RS, then the RSI mapping.
  5. Compare with the tool’s RSI output for several points, especially after the warm-up period.

If values disagree, the cause is usually a difference in smoothing variant, initialization, or input price definition.

Trading foreign exchange and CFDs involves substantial risk. Information on FoxiForex is educational and is not personal financial advice. Sponsored placements are labelled clearly.