Skip to content
MarketClueLearn

Indicators: Moving Averages, RSI and MACD

Intermediate12 min readLesson 12 of 19

7 steps · one page

In short

An indicator is a deterministic function of the price series.

Scope. This article sets out exactly how the three most common indicators are computed and what follows arithmetically from their construction. It gives no settings to use, no levels to act on and no crossover rules. Conventional parameter values are named because a reader will encounter them, and none is presented as effective. Third of the four-article technical cluster introduced in Technical Analysis: What It Is and What the Evidence Says.

That sentence contains almost everything a reader needs, and the rest of this article is the consequences of it. An indicator adds no data. It rearranges the closes that were already on the chart into a form that is easier to look at, and whatever information it displays was in the prices before the transformation was applied.

Practitioners know this and would not dispute it. The reason to be precise about it is that the language surrounding indicators — signal, confirmation, divergence, overbought — implies the arrival of something new, and the arithmetic shows that nothing arrives.

The three constructions, precisely

Simple moving average. The arithmetic mean of the last n closes. Each of the n observations gets weight 1/n and everything older gets zero.

Exponential moving average. A recursive weighted average in which today's value is a times today's close plus (1 minus a) times yesterday's value. The smoothing constant is conventionally set as a equals 2 divided by (n plus 1), which is what makes an EMA comparable to an n-day SMA. Weights decline geometrically and never reach zero.

Relative strength index. Over n periods, the average gain on up days is divided by the average loss on down days to give RS, and the index is 100 minus 100 divided by (1 plus RS). Both averages use the recursive smoothing its originator specified rather than a plain mean. The result is bounded between 0 and 100. The conventional period is 14 and the conventional reference lines are drawn at 70 and 30. Neither the period nor the lines has a derivation — they were chosen by one author in the 1970s and have been copied since, and this portal names them only because a reader will see them on every chart package.

Moving average convergence divergence. The MACD line is a 12-period EMA minus a 26-period EMA. The signal line is a 9-period EMA of the MACD line. The histogram is the difference between the two. It is therefore a difference of two smoothers of the same series, smoothed again.

What the arithmetic of a moving average actually implies

A moving average is a lag, and the size of the lag is exactly calculable. For an n-day simple moving average the mean age of the data in it is (n minus 1) divided by 2. For an exponential moving average with the conventional smoothing constant, the mean age is identical.

Period nSMA mean lagEMA smoothing constantEMA mean lagEMA weight sitting in the last n observations
104.5 days0.1818184.5 days86.56%
209.5 days0.0952389.5 days86.49%
5024.5 days0.03921624.5 days86.47%
20099.5 days0.00995099.5 days86.47%
Worked example

Worked example

Worked example — the exponential average is not faster in the way it is usually described. The received wisdom is that an EMA responds more quickly than an SMA of the same length. Their mean lags are identical — 24.5 days for both at n equals 50, 99.5 days for both at n equals 200. What differs is the distribution of weight, not its centre of gravity: the EMA puts more weight on the single most recent observation and keeps a thin tail of weight on old data forever, and those two effects cancel exactly. A 200-day average is describing where price was roughly a hundred trading days ago, whichever construction is used, and that is a property of averaging rather than a defect. It is why an average that has just turned is reporting something that finished happening some time ago.

The finding that matters most: the indicators are not independent of each other

Practitioners look for confluence — several indicators agreeing. The question is what agreement between deterministic functions of the same input is worth. That is measurable.

On a synthetic driftless random-walk series of 2,000 daily observations with a daily standard deviation of 1.2%, the standard constructions above were computed and correlated against each other and against the plain trailing return.

PairCorrelation
RSI(14) against the trailing 14-day return0.89
RSI(14) less 50, against the MACD line (12, 26)0.80
MACD line (12, 26) against the trailing 14-day return0.71
Worked example

Worked example

Worked example — what confluence is measuring. RSI(14) correlates 0.89 with the plain trailing 14-day return, which means it is close to a rescaled restatement of how much the price has recently moved. RSI and the MACD line correlate 0.80 with each other, on data with no structure in it at all. Two indicators agreeing is therefore mostly the same observation arriving twice, not two independent confirmations, and the impression of corroboration comes from the fact that they are drawn in different panels with different scales. This is arithmetic, not a criticism of anyone's judgement — it follows necessarily from all three being functions of the same closes, and it holds regardless of whether prices contain any predictable structure. (The correlations are properties of the constructions and vary by a few hundredths from one synthetic path to another; the crossing counts below vary more, since they depend on the particular path, but the range and its ratio do not.)

Where the parameters come from, and what changing them does

The conventional values are historical accidents. 12, 26 and 9 for MACD, 14 for RSI, 50 and 200 for the widely watched averages — these come from a period when calculations were done by hand on paper and weekly data made 5, 10 and 20 natural. None was derived, and none has since been shown to be a distinguished choice.

What changing them does is large. On the same 2,000-day synthetic series, counting how many times a fast exponential average crosses a slow one across all 8,526 parameter pairs from the article on technical analysis and the evidence, the number of crossings ranges from 9 at the slowest settings to 487 at the fastest, with a median of 27. The 12/26 pair produces 62 crossings; the 50/200 pair produces 9.

The consequence, and it is the reason no settings appear anywhere in this cluster. The parameter choice determines the number of events by a factor of more than fifty on identical data. That is the mechanism behind the multiple-testing problem in the anchor article: an analyst who tries settings until the chart looks convincing has performed a search, and 8,526 candidates is enough for something convincing to exist with certainty. Pillar 22's article on multiple testing is the general statement of this; indicator parameters are its purest instance, because the search space is explicit and the searcher usually does not think of what they are doing as a search.

What the evidence says about indicators specifically

Moving-average rules are one of the five families in the 7,846-rule universe that the major data-snooping study assembled, and that study's contribution was to show how much the apparent performance of the best rules shrinks once the size of the search is accounted for. The most-cited positive result in the field concerns pattern detection rather than these three indicators. The comprehensive survey of the literature found the balance of modern studies positive but heavily qualified, concentrated in foreign-exchange and futures markets and running at least until the early 1990s.

None of that settles the question, and this article does not attempt to. What it does establish, and what does not depend on the unresolved evidence at all, is the following: the indicators contain no information the prices did not already contain, their lag is exactly calculable, they correlate strongly with each other and with the trailing return, and their conventional parameters are inherited rather than derived. A reader who holds those four facts is better equipped than one who has been told either that indicators work or that they do not.

Frequently asked

8 questions

What is a technical indicator?

A deterministic function of the price series. It adds no data — it rearranges closes that were already on the chart into a form that is easier to look at.

Is an exponential moving average faster than a simple one?

Not in the sense usually meant. At the conventional smoothing constant their mean lags are identical: 24.5 days for both at 50 periods, 99.5 days for both at 200. The EMA weights the single most recent observation more heavily but keeps a permanent thin tail on old data, and the two effects cancel exactly.

How is RSI calculated?

Average gain on up days divided by average loss on down days over the period gives RS; the index is 100 minus 100 divided by (1 plus RS), which bounds it between 0 and 100. The averages use recursive smoothing rather than a plain mean.

What do the 70 and 30 lines on RSI mean?

They are conventional reference lines with no derivation, chosen by one author in the 1970s and copied since. This portal names them because they appear on every chart package and does not attach any interpretation or action to them.

What is MACD made of?

A 12-period exponential average minus a 26-period one, with a 9-period exponential average of that difference as the signal line and the gap between them as the histogram. It is a difference of two smoothers of the same series, smoothed again.

If two indicators agree, is that meaningful confirmation?

Less than it appears. On a series with no structure at all, RSI correlates 0.89 with the plain trailing 14-day return and 0.80 with the MACD line. Two indicators agreeing is mostly the same observation arriving twice in different panels, which follows necessarily from both being functions of the same closes.

Where do the standard settings come from?

From an era of hand calculation on weekly data. None of 12, 26, 9, 14, 50 or 200 was derived, and none has been shown to be a distinguished choice.

Does it matter much which parameters are chosen?

Enormously. On one 2,000-day series, the number of crossings between a fast and a slow average ranges from 9 to 487 across the 8,526 possible pairs — a factor of more than fifty on identical data. That range is also why trying settings until a chart looks convincing is a search rather than an observation.

References

Educational and informational only — not investment advice, a recommendation, or an offer to buy or sell any security. Investing involves risk, including the possible loss of principal. Worked examples use fictional companies and figures.