WhitmanTrading

Moving Average: What It Is, How to Calculate One, and How Late It Turns

A moving average is the average closing price over the last set number of bars, recalculated on every new bar. Its slope describes the trend, and because the line moves with price it also works as a level that shifts over time, always a step behind the market it summarizes.

Moving Average: What It Is, How to Calculate One, and How Late It Turns — illustrated on a chart Watch: Moving Averages for Beginners (Full Course)

Covered on this page: TradingView.

A moving average is the average closing price over the last set number of bars, such as 20, 50 or 200 days, recalculated as each new bar closes. It smooths price into one line whose slope shows the trend, and because it is built only from past closes it always turns after price does; this page measures how long after.

How it works

Each point on the line is the mean of the last N closes. On a 10-day average, today’s point is the average of the ten closes up to today. Tomorrow the oldest close drops out and the newest comes in, and the line takes one step. There is no forecast in it, only arithmetic on a window that slides forward.

Three kinds cover almost every chart. A simple moving average (SMA) weights every close in the window equally. An exponential moving average (EMA) gives the newest close a fixed share, 2 ÷ (N + 1), and carries the rest forward from yesterday’s value, so old closes fade instead of dropping out. A weighted moving average gives the newest close weight N, the next N − 1, and so on down to 1.

Length decides what the line ignores. A 10-day average follows price closely and reacts to noise; a 200-day average ignores anything shorter than a few months. Neither is more accurate. Picking a length is picking which moves you want the line to treat as noise.

How to calculate one, with real closes

Simple: add the closes and divide by how many there are. The S&P 500 closed at 7,764.70, 7,764.64, 7,706.03, 7,704.13 and 7,743.41 on the five trading days from 21 to 25 September 2026. Those add to 38,682.91, and 38,682.91 ÷ 5 gives a five-day simple moving average of 7,736.58.

The next bar swaps one close for another. The five closes up to 24 September began with 7,650.50 on 18 September and averaged 7,718.00. On 25 September that old close left the window and 7,743.41 entered, so the average rose by (7,743.41 − 7,650.50) ÷ 5 = 18.58 points. The change in a simple average is always the new close minus the one that dropped out, divided by the length.

Exponential: weight the newest close and carry the rest. The weight for five days is 2 ÷ 6, a third. Seeded with the 7,718.00 simple average on 24 September, the usual way to start one, the EMA for 25 September is 7,743.41 × 1/3 + 7,718.00 × 2/3 = 7,726.47.

So the two versions moved differently on the same day. The simple average rose 18.58 points, largely because a weak close fell out of its window. The exponential rose 8.47, because it never drops a close outright. That difference is the whole of the EMA against SMA question.

What to read off it

The slope. A rising line means recent closes are higher than the ones leaving the window. A flat line means they are not, whatever price is doing today, and a flat average is a real reading: there is no trend to be in.

Its position, as a level. Because so many traders watch the same lengths, price often pauses near them, the same crowding behind support and resistance, except that this level moves every bar. On 30 October 2026 the S&P 500 closed at 7,580.07, under its 50-day average of 7,697.08 and above its 200-day of 7,309.76.

The crossover. When a fast average crosses a slow one, the recent average has moved past the longer one. The general rule has its own page on the moving average crossover, and the 50/200 pair has two, the golden cross and the death cross. Subtract one EMA from another and you have MACD; it is this same idea drawn as a gap.

A worked example: the 2025 low

The S&P 500 closed at a record 6,144.15 on 19 February 2025 and fell 18.90% to 4,982.77 on 8 April. Here is what the two most-watched averages did around that low, day by day from the closes.

The death cross came after the bottom. The 50-day average crossed under the 200-day on 14 April, four sessions after the low, when the index had already climbed 8.49% to 5,405.97. A rule that sold on the cross sold into the rebound.

The 200-day barely noticed. It was 5,755.72 on the day of the low and bottomed at 5,745.91 on 1 May, 16 sessions later, a dip of about 10 points; it never fell below its 5,691.81 level of the February peak. The index closed back above it on 12 May at 5,844.19, 17.29% above the low.

The 50-day bottomed on 12 May, 23 sessions after the low, at 5,549.41. Anyone waiting for that average to turn up before calling the low over was waiting for a 17.29% rise that had already happened. The golden cross, the 50-day back over the 200-day, came on 1 July at 6,198.01, 24.39% above the low and two sessions after the index had already closed above its February record, on 27 June.

S&P 500 daily closes from January 2025 to October 2026 with its 50-day and 200-day simple averages, marking the 8 April 2025 low at 4,982.77, the 50-day's own low on 12 May and the 50-day crossing back above the 200-day on 1 July.
S&P 500 closes with the 50-day and 200-day simple moving averages, January 2025 to October 2026, marking the closing low and where the 50-day turned and crossed. Source: Yahoo Finance, S&P 500 daily closes (m104-sp500-50-and-200-day-averages-2025-2026.csv).

None of that is a defect in the line. A 50-day average on 12 May still held every close from 3 March on, including March closes well above the April lows, and it could only rise once the closes leaving the window were lower than the ones arriving. The average told the truth about the last 50 days; it was simply describing a market that had already changed.

The original data

How late the average turns, at every big low. The test uses S&P 500 daily closes from Yahoo Finance, 3 January 1950 to 30 October 2026, downloaded 1 November 2026, price only. A decline is a fall of 10% or more from a closing high to the lowest close before the index closed back at that high; there were 26, with lows from 17 July 1950 to 8 April 2025.

For each, the date the 20, 50, 100 and 200-day simple average reached its lowest value between the closing low and the recovery counts as its turn, and the gain is the index’s rise from the low to that day.

The median 50-day average turned 24.5 sessions after the low, with the index up 9.42%. The 20-day turned a median 10 sessions after, at +5.11%; the 100-day 49 sessions after, at +11.64%; and the 200-day 82 sessions after, at +15.38%. In the 11 declines of 20% or more, the 200-day turned a median 130 sessions after the low, with the index already up 21.50%.

Horizontal bars of how many sessions after an S&P 500 closing low each simple average hit its own low, across 26 declines of 10% or more since 1950: 10 for the 20-day, 24.5 for the 50-day, 49 for the 100-day and 82 for the 200-day, each labeled with the index gain by then.
Median sessions from an S&P 500 closing low to the low of each simple average, with the index's median gain by then, across declines of 10% or more, 1950 to 2026. Source: Yahoo Finance, S&P 500 daily closes (m104-sp500-moving-average-bottom-after-10pct-declines-1950-2026.csv).

Sometimes the long average never turned at all. In 6 of the 25 declines with a 200-day average available, it was still rising on the day of the closing low, and in 3 of 26 the 100-day was too; those cases are left out of the medians rather than counted as zero.

Every decline, length and date is in the lows file. FRED’s S&P 500 series from 31 October 2016 to 28 October 2026 matches the Yahoo closes to 0.05 points on all but 3 of 2,512 days, none of them in 2025 or 2026.

How often price crosses each length. Over the same span for every length, 19 October 1950 to 25 September 2026, a crossing is a close on the other side of the average from the previous close. The full table is in the crossings by length file.

Simple average Crossings Per year Next crossing within 5 trading days Days closed above it
10-day 2,974 39.2 57.2% 58.7%
20-day 2,018 26.6 53.4% 61.1%
50-day 1,188 15.6 52.4% 64.5%
100-day 794 10.5 52.4% 67.9%
200-day 448 5.9 53.1% 71.6%

Length cut the number of crossings, not the share that failed fast. Going from a 10-day to a 200-day average took crossings from 39.2 a year to 5.9, yet at every length 52% to 57% of crossings were followed by another within five trading days. The index crossed its 200-day four times in 2025, on 10 March, 24 March, 26 March and 12 May, and twice in 2026 through 30 October, on 19 March and 8 April.

Horizontal bars of how many times a year the S&P 500 closed across its 10, 20, 50, 100 and 200-day simple averages since 1950, falling from 39.2 to 5.9, each labeled with the share undone within five trading days.
Times a year the S&P 500 closed across each simple average, October 1950 to September 2026, with the share reversed within five trading days. Source: Yahoo Finance, S&P 500 daily closes (m48-sp500-ma-crossings-by-length-1950-2026.csv).

Picking the length afterward, tested. Holding the index for the next session after any close above its N-day simple average, and staying out otherwise, for every length from 10 to 250 days in steps of 10, price only, with no costs: from 1951 to 1987 every length grew faster than holding the index, 7.80% to 13.71% a year against 6.94%, with the 10-day first.

From 1988 to 23 October 2026 none did, 2.03% to 7.42% against 9.24%, and the 10-day came last. The rank order largely reversed, a Spearman correlation of −0.77 between the halves; both are in the two-halves file.

Across our study of 24,971 trading videos, 496 have moving average in the title. The median one gets 4,917 views and 76% never pass 50,000.

Questions people ask

How do you compute a moving average?

Add the last N closes and divide by N, then repeat on every new bar, dropping the oldest close. The worked example above does it on five real S&P 500 closes; for an EMA, multiply today’s close by 2 ÷ (N + 1) and add yesterday’s EMA times the rest.

What is EMA 12 and EMA 26?

They are the 12-period and 26-period exponential averages, the two default lengths inside MACD, which is the 12 EMA minus the 26 EMA. Their weights on the newest close are 2 ÷ 13, about 15.4%, and 2 ÷ 27, about 7.4%.

Which is better, the 50-day or the 200-day moving average?

Neither; they answer different questions. On the S&P 500 the 50-day was crossed 15.6 times a year and turned a median 24.5 sessions after big lows; the 200-day was crossed 5.9 times a year and turned 82 sessions after. The 50-day reports sooner and gives about 2.6 times as many crossings to sort through; the 200-day is quieter and later.

Should I use a simple or an exponential moving average?

The exponential turns sooner and so also whipsaws more: over the same span, price crossed a 50-day EMA 1,356 times against 1,188 for the 50-day SMA. Length moves the result far more than the type does.

When it fails

This is where crossovers do their damage. In a range the averages flatten and lie on top of each other, and each cross is soon undone; more than half of all crossings in the table above were reversed within five trading days.

You read it as a forecast

The line is an average of the past and nothing else. A turn or a cross reports that something has already happened. In April 2025 the death cross arrived four sessions after the low, an accurate summary of the previous months and a poor guide to the next ones.

The stop moves with the line

“Below the average” is a different price every day. The invalidation has to come from a fixed level, such as a swing low from market structure, sized through risk management.

You found the settings afterward

Any length can be tuned to past moves. The 10-day rule that led every length from 1951 to 1987 came last from 1988, which is the whole problem of overfitting.

Market structure is the natural pair: the average says a trend exists, and structure gives the price at which it stops existing.

Support and resistance is where the moving-level idea comes from, and the fixed version is easier to trust because it does not shift under you.

The slower line has its own page on the 200-day moving average, and how to use moving averages sets out the reading step by step, including Bollinger Bands and other tools built on an average.

What I actually do

I treat the faster average as a moving support level and the slower one as my bail-out line. If price breaks below both, I’m out of the trade. One average on its own isn’t a strategy, it’s just a line. What I read is how two or three of them sit relative to each other, and I backtest the combination on the asset I’m actually trading before I trust it.

— Michael Whitman, from this video

This page is educational, not financial advice. Test every idea on your own charts before risking money. Some links on this page earn a commission if you buy through them. It costs you nothing and it does not decide what appears here or in what order — how these pages are made is set out in our methodology.