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.
How it is calculated
SMA(N)ₜ = (Pₜ + Pₜ₋₁ + … + Pₜ₋ₙ₊₁) ÷ N
α = 2 ÷ (N + 1)
EMA(N)ₜ = α × Pₜ + (1 − α) × EMA(N)ₜ₋₁
- P is the close and t is the day.
- 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).
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.