Worked Example: RSI and MACD (with Full Assumptions)

Explore What is a worked: mechanics, differences, limitations, and practical checks.

Direct answer: what is a worked example of RSI and MACD?

A worked example is a step-by-step, numbers-in → indicator-out walkthrough using explicit assumptions (data source type, lookback lengths, and the exact formula). Below is a fully specified numerical scenario showing how RSI and MACD values are computed from the same sequence of price changes, without claiming the result predicts future moves.

Mechanism or definition: what RSI and MACD compute

RSI (Relative Strength Index) is an oscillator that maps recent price change balance into a 0–100 scale. In its common form, it uses:

  • A lookback period length, often 14.
  • For each step, a gain (positive change) and a loss (absolute value of negative change).
  • The average gain and average loss across the lookback.
  • Then the RS ratio and RSI:
    • RS = average_gain / average_loss
    • RSI = 100 − (100 / (1 + RS))

Important detail: different platforms may use different averaging methods (for example, a “smoothed” approach versus a simple average). That is a variable market/tool condition, not a fixed law.

MACD (Moving Average Convergence Divergence) is typically defined as:

  • MACD line = EMA(short) − EMA(long)
  • A signal line (often an EMA of the MACD line)
  • A histogram = MACD line − signal line

Common default-style settings people often use are EMA(12) and EMA(26), with a signal EMA of 9. But these are parameters: if you change them, the values change.

Evidence or example: one transparent numerical scenario

Assumptions (state everything before calculating)

  1. We use RSI (14) with simple averaging of gains/losses over 14 changes (to keep the arithmetic transparent).
  2. We compute MACD with EMA(12), EMA(26) and signal EMA(9) using the standard EMA update rule, and we assume the EMA starts from an initial value consistent with the first computed basis (this affects early numbers; later values are less sensitive).
  3. Price is represented by a sequence of closes (the “data feed” assumption). We do not use live market data.
  4. Only a single worked snapshot is shown; we do not claim this snapshot forecasts anything.

Price changes used for RSI

Consider the last 15 closes (so we have 14 changes):

  • Closes: 100, 102, 101, 103, 104, 103, 105, 106, 104, 107, 108, 107, 109, 108, 110
  • Changes (14): +2, −1, +2, +1, −1, +2, +1, −2, +3, +1, −1, +2, −1, +2

Compute gain and loss per change (loss is absolute value):

  • Gains: 2, 0, 2, 1, 0, 2, 1, 0, 3, 1, 0, 2, 0, 2
  • Losses: 0, 1, 0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 1, 0

Now average them over 14 changes:

  • Total gains = 2+0+2+1+0+2+1+0+3+1+0+2+0+2 = 17
  • Total losses = 0+1+0+0+1+0+0+2+0+0+1+0+1+0 = 6
  • Average gain = 17/14 ≈ 1.2143
  • Average loss = 6/14 ≈ 0.4286

Compute RS and RSI:

  • RS = 1.2143 / 0.4286 ≈ 2.8333
  • RSI = 100 − (100 / (1 + 2.8333))
  • Denominator: (1 + 2.8333) = 3.8333
  • 100 / 3.8333 ≈ 26.0869
  • RSI ≈ 100 − 26.0869 = 73.91

So, in this scenario, RSI is about 73.9 based on the explicitly stated assumptions.

MACD needs moving averages (EMAs). Using closes above, we compute:

  • EMA(12) and EMA(26) over the close series
  • MACD line = EMA(12) − EMA(26)
  • Signal line = EMA(9) of MACD line
  • Histogram = MACD − Signal

Because EMAs depend on a full history (or an initialization rule), a single 15-close window is not enough to produce “platform-accurate” MACD values without specifying how the earlier EMAs were seeded. This is the key worked-example limitation for MACD: you must define the starting point.

To still make the example actionable, here is a verification-friendly way to proceed in your own environment:

  • Take the same close series.
  • Use the exact settings you choose (EMA lengths and signal length).
  • Use your platform’s EMA initialization (often the first EMA value is seeded from an initial price or a simple average).
  • Confirm that the computed MACD line and histogram match those values.
Trading foreign exchange and CFDs involves substantial risk. Information on FoxiForex is educational and is not personal financial advice. Sponsored placements are labelled clearly.