Skip to content
GetProfitable
Search

RSI and MACD explained as math, not magic

Lesson 21 · about 9 min

Most indicators are a moving average wearing a costume. RSI and MACD are the two you will see most often, and both are worth understanding, not because they are especially powerful but because once you know what they compute you can read any similar indicator in a minute. Neither one knows anything that the price candles do not. They just rearrange it.

Bearish divergence between price and RSIA price line whose second peak is higher than its first, drawn above an RSI panel whose second peak is lower than its first, with the two peaks joined by sloping dashed lines.PRICEhigher highRSI (14)70overbought30oversoldlower high
Divergence between price and RSI. RSI measures how one-sided recent price moves have been on a 0–100 scale. Here price sets a higher peak while RSI sets a lower one, so the second push carried less momentum than the first.

RSI: relative strength index

RSI measures how much of the recent movement was up versus down. Take the last N candles (14 is the default). Add up the size of every up-close, add up the size of every down-close, and compare.

Step by step, for a 5-period example:

Day Close Change Gain Loss
1 40.0
2 40.8 +0.8 0.8 0
3 41.2 +0.4 0.4 0
4 40.9 -0.3 0 0.3
5 41.6 +0.7 0.7 0
6 42.0 +0.4 0.4 0

Average gain over 5 days: (0.8 + 0.4 + 0 + 0.7 + 0.4) / 5 = 0.46. Average loss: 0.3 / 5 = 0.06. Relative strength = 0.46 / 0.06 = 7.67. RSI = 100 - (100 / (1 + 7.67)) = 88.5.

The formula squashes the ratio into a range from 0 to 100. If every close was up, RSI is 100. If every close was down, RSI is 0. If gains and losses were equal, RSI is 50. (Real RSI uses a smoothed average rather than a simple one, but the idea is identical.)

So RSI of 88 means: over the last five days, up-moves dwarfed down-moves. That is all. It is a description of what already happened.

What "overbought" actually means

Charting platforms draw lines at 70 and 30 and call them overbought and oversold. Beginners read RSI 75 as "too high, must fall." What RSI 75 says is "the last 14 closes were mostly up, strongly." In a range, that often precedes a pullback, because ranges alternate. In a strong trend, RSI stays above 70 for weeks while price keeps rising, because the closes keep being up. Selling because RSI is "overbought" in a trend is selling because the trend is strong.

The useful read is the opposite: RSI staying high is what a strong trend looks like. RSI dropping back to 50 or 40 in an uptrend is what a pullback looks like, and if structure is still intact that is a place to look for the pullback ending.

 Price                                  RSI

        /\      /\                     70 -- ...... ........ ..
       /  \    /  \    /              ..  ..    ..     ..   ..
      /    \  /    \  /            50 --...  ....     ...  ....
     /      \/      \/               ..
    /                              30 --
   /

Divergence

The one RSI read with some real content is divergence: price makes a higher high but RSI makes a lower high. In arithmetic terms, the second push up was made of smaller daily gains than the first. The trend is still going but the pace is fading. That is a warning, not a signal, and it is the same warning you could get by noticing that the candle bodies on the second push were smaller. RSI just makes it easier to see.

Divergence fails often in strong trends. Treat it as a reason to tighten a stop or to stop adding, not a reason to reverse.

Key idea: RSI compares recent up-closes to recent down-closes and squashes the ratio to 0-100. High RSI means the recent closes were mostly up; it does not mean price must fall. In trends RSI stays high. Divergence, where price makes a new high with smaller daily gains, is a fading-pace warning and nothing more.

MACD: two moving averages and their difference

MACD is even simpler once you see it. Take a 12-period EMA and a 26-period EMA of closes. Subtract the long one from the short one. That difference is the MACD line. Then take a 9-period EMA of the MACD line; that is the signal line. The histogram is the gap between the two.

Component Calculation What it shows
MACD line 12-EMA minus 26-EMA How far the short-term average is above or below the longer one
Signal line 9-EMA of the MACD line A smoothed version of the MACD line
Histogram MACD line minus signal line Whether the gap is widening or narrowing

When the 12-EMA is far above the 26-EMA, MACD is high: short-term prices are well above medium-term prices, meaning a strong recent rise. When they are equal, MACD is zero. When the short is below the long, MACD is negative.

That is the entire indicator. It is a way of watching two moving averages converge and diverge without drawing them on the price chart.

What MACD signals mean

  • MACD crosses above zero: the 12-EMA just crossed above the 26-EMA. That is an MA crossover, with all the lag from the previous lesson. Price has usually already risen a fair way.
  • MACD line crosses above signal line: the MACD line is rising faster than its own average. Momentum is picking up. This happens earlier than the zero cross but also produces many false starts in ranges.
  • Histogram shrinking while price rises: the gap between the EMAs is closing. The rise is slowing. Same pace warning as RSI divergence.

Every one of those is derived from closes you can see. MACD saves you from mentally comparing two averages. It does not add information.

Using either one honestly

If you want to use RSI or MACD, use it for one job: as a pace gauge that confirms what structure and levels already suggest. Price pulls back to a level in an uptrend, RSI drops toward 40-50 and turns up, MACD histogram stops shrinking. That is three views of the same event agreeing. It is not three separate signals.

What they cannot do: tell you where support is, tell you a trend will end, or replace looking at the candles. When an indicator disagrees with the candles, the candles are right, because the indicator was computed from them.

Try it: Put RSI(14) on a daily chart. Find the longest stretch where it stayed above 70. Note how far price rose during that stretch. Then find a stretch where it stayed between 40 and 60. What was price doing? You are learning what "overbought" actually looks like in the market you watch.

Recap

  • RSI compares average up-closes to average down-closes over N periods and squashes the result to 0-100.
  • "Overbought" means recent closes were mostly up; in trends RSI stays high. It is not a sell signal.
  • RSI divergence is a pace warning: a new price high made of smaller daily gains.
  • MACD is the difference between a 12-EMA and a 26-EMA, plus a smoothed version and a histogram. Its crosses are MA crossovers with lag.
  • Use either as a pace gauge that confirms structure; when an indicator disagrees with the candles, the candles win.