Moving average examplesSample data · not a real stock
What to look forAs a falling price turns, find where the 20-day line (orange) crosses above the 60-day line (purple) — a golden cross.
CautionThe cross appears after the price has already risen quite a bit. Moving averages always lag the price.
1260 bars · 2018-11-26 – 2023-09-22
On price
Lower panes
Auto
Sample (synthetic) data: not a real stock or real prices, but prices generated to explain the idea. Drag the chart to move through time and use the wheel or two fingers to zoom.
Concept
Daily prices swing a lot, so the trend is hard to see at a glance. A moving average recalculates the average close of the last N days every day and joins those values, filtering out short swings to show the direction.
Simple moving average (SMA): the N closes are averaged with equal weight.
Exponential moving average (EMA): recent prices get more weight. With the same period, it reacts faster to price changes than an SMA.
In the chart above, press the settings button next to Moving avg to open a list of moving averages, as in real charting software. For each line you can set visibility, period, type (simple, exponential, weighted), color, width and opacity, and Add line lets you add up to 10. Switch the 20-day line to “EMA” and you will see the exponential average turn first when the price changes direction. The defaults (5/20/60/120-day SMAs) are common on Korean charts, and your settings are saved in this browser and apply to other charts too.
The EMA starts from the simple average of the first N days. Depending on how the starting value is set, early values can differ slightly between charting tools.
There is no value for the first stretch with fewer than N days of data (which is why the line starts later on the chart).
Work through the numbers
Suppose the last five closes are ₩10,000, ₩10,200, ₩10,400, ₩10,300 and ₩10,600. The 5-day simple moving average is the average of the five values, ₩10,300.
If the next day’s close is ₩11,000, the oldest value, ₩10,000, drops out and ₩11,000 comes in. SMA = (10,200 + 10,400 + 10,300 + 10,600 + 11,000) ÷ 5 = ₩10,500 (up ₩200)
For the 5-day EMA on the same day, α = 2 ÷ (5 + 1) ≈ 0.333, so if yesterday’s value was ₩10,300, it is 10,300 + 0.333 × (11,000 − 10,300) ≈ ₩10,533 (up ₩233)
If the close then falls to ₩10,600 the day after, ₩10,200 drops out of the SMA and ₩10,600 comes in, so the SMA actually rises to ₩10,580, while the EMA becomes 10,533 + 0.333 × (10,600 − 10,533) ≈ ₩10,556
In the third line the price fell but the simple moving average rose. That is because a simple moving average is affected not only by the value that comes in but also by the value that drops out. When a moving average line turns, working out whether it was today’s price or the price from N days ago dropping out makes the line’s movement easier to understand.
Cautions when reading it
Lag: a moving average is an average of past prices, so it always moves later than the actual price. By the time the line turns, the price may already have moved a lot.
Golden and death crosses: a short line crossing above a long line is called a golden cross; crossing below is a death cross. Find where the 20-day line (orange) and the 60-day line (purple) cross on the chart, and you will see that in sideways stretches crosses repeat often and many signals mean nothing.
No right period: 5, 20, 60 and 120 days are common, but only by convention. Changing the period moves the signals.
Read as support or resistance: because many people watch the same line it can matter, but the price does not necessarily stop at the line.
Chart shapes and indicators summarize past prices. The same shape is sometimes right and sometimes wrong depending on the market, and this page does not tell you when to buy or sell any stock. To practice yourself, try the chart lab or mock trading.