What is a moving average?
A moving average (MA) is a line that connects average prices calculated one after another, and it is often referred to simply as "the MA." Charting software uses it to smooth out short-term price swings so that price changes over a period are easier to see.
A moving average is usually overlaid on the price chart and is a type of technical indicator. It is not another trade price, nor is it a future quote: every point comes from price data that has already been recorded. The "moving" in the name means that each time a new period's price is added, the average is recalculated and the line on the chart extends forward.
There are two common methods: a simple moving average treats the prices of the most recent periods equally, while an exponential moving average gives newer prices a larger share. Below, we first look at how each one is calculated and then compare how they differ.
Simple moving average: every recent period has the same weight
A simple moving average (SMA) adds up the prices of the most recent periods and divides the total by the number of periods. Each period's price takes up the same share of the average; this share is also called its weight. Each time a new period's price is added, the software brings in the latest period and drops the oldest one, so the calculation range moves forward by one step.
The example below uses closing prices, meaning the last trade price at the end of each period. Suppose an asset's closing prices for its first five periods are $8, $10, $12, $16, and $10. Using a three-period SMA gives the following results:
| Point of calculation | Closing prices included ($) | Three-period SMA ($) |
|---|---|---|
| End of period 3 | 8, 10, 12 | (8 + 10 + 12) ÷ 3 = 10 |
| End of period 4 | 10, 12, 16 | (10 + 12 + 16) ÷ 3 ≈ 12.67 |
| End of period 5 | 12, 16, 10 | (12 + 16 + 10) ÷ 3 ≈ 12.67 |
In period 5 the price falls from $16 to $10, yet the moving average does not decline, because the $10 that is added is the same as the $10 that is dropped. How a moving average changes depends on the whole set of inputs, not just on whether the latest price rose or fell compared with the previous period.
Only when the averages from each period are connected does the line on the chart take shape. The three periods used here only illustrate the calculation; they are not a recommended setting.
Exponential moving average: newer prices carry more weight
An exponential moving average (EMA) does not recalculate an equally weighted average over a fixed window each time. Instead, it combines the latest price with the previous period's EMA in fixed proportions to arrive at the new value step by step. A common way to calculate it is:
Current EMA = latest price × smoothing factor + previous EMA × (1 − smoothing factor)
The smoothing factor is the share of the current calculation assigned to the latest price, and it is commonly set as 2 ÷ (number of periods + 1). The calculation needs a starting value at the outset; a common approach is to use the SMA of the first few periods.
Using the same hypothetical prices, the smoothing factor for a three-period EMA is 2 ÷ (3 + 1) = 0.5. Taking the period 3 SMA of $10 as the starting value:
- Period 4 EMA = 16 × 0.5 + 10 × 0.5 = $13;
- Period 5 EMA = 10 × 0.5 + 13 × 0.5 = $11.5.
How SMA and EMA differ
Both methods can be calculated from the same set of prices. The difference lies in how weight is assigned to newer and older prices, and how older prices drop out of the calculation.
| Comparison | Simple moving average (SMA) | Exponential moving average (EMA) |
|---|---|---|
| Weight of newer and older prices | The same for every period in the window | The latest price takes the smoothing-factor share; the older a price, the smaller its share |
| How older prices drop out | They stop counting as soon as they leave the window | Their influence fades period by period rather than disappearing abruptly |
| How it is calculated | The average of the most recent periods is recalculated each time | It is built step by step from the previous period's EMA |
| Affected by the starting value? | No | Yes, by the starting value and by how much historical data is included |
In the example above, the price falls from $16 to $10 in period 5: the three-period SMA stays at about $12.67, unchanged, while the three-period EMA falls from $13 to $11.5. The EMA responds more visibly to the latest price, but that does not mean it predicts the next period more accurately.
A "three-period EMA" also does not mean that only the three most recent prices are used: the influence of older prices has already been carried into the previous period's EMA and fades period by period, rather than disappearing as soon as a price falls outside the latest three periods. If charting software uses a different starting value or a different length of historical data, its EMA values may also differ.
"20 periods" does not necessarily mean 20 days
One "period" of a moving average usually corresponds to one candlestick on the chart, a shape that records trade prices over a span of time; that span can be a day, an hour, or another length. The number of periods is a setting of the moving average calculation, while the chart time frame determines how long each period is. On a daily chart, a 20-period SMA averages the prices of the latest 20 daily candlesticks; on a one-hour chart, it averages the prices of the latest 20 one-hour candlesticks. The two cover different time spans.
With the same method and price input, a smaller number of periods usually makes a moving average more sensitive and leaves in more short-term swings; a larger number of periods usually makes it smoother but slower to respond to price changes. For an EMA, increasing the number of periods also lowers the smoothing factor, giving the latest price a smaller share of the current calculation.
When comparing two moving averages, you also need to confirm whether each is an SMA or an EMA, what the price input is, and which market the price data comes from. Trade prices differ somewhat between trading markets, so moving averages calculated from each market's prices may also differ. Closing prices are a common input, but a moving average can also be calculated from other data, such as opening prices. The number "20" by itself is not enough to explain why two lines are the same or different.
Lag, crossovers, and price position
A moving average describes how the selected data changes after smoothing, not where the price must go next. It lags because older prices are still part of the calculation: when the price has already turned, the moving average may still be heading in its original direction, and the longer the period, the more noticeable this delayed response usually is.
Analysts also watch for crossovers between the price and a moving average, or between moving averages of different periods. A crossover means that their previous positions above and below each other have switched. Such crossovers are also a kind of technical indicator "signal", and they are not a buy or sell conclusion in themselves. When the price moves back and forth within a range, crossovers may occur repeatedly without forming a sustained new direction.
Likewise, a price above the moving average only means it is higher than the average calculated from this set of data; it does not prove the asset has become "expensive." A price below the moving average does not prove the asset has become "cheap" either. A moving average does not verify a project's use, security, or asset value. Its role in technical analysis is to organize historical prices, and it cannot replace judgment on other questions.
Related terms
Learn more about the Relative Strength Index, technical indicators, technical analysis, and candlestick charts, or return to the cryptocurrency glossary.
References
Digital Assets subject to volatility and not insured. Not financial/investment advice. Not all products and services offered in all regions. Exclusions and T&Cs apply.
© 2026 OKX. This article may be reproduced or distributed in its entirety, or excerpts of 100 words or less of this article may be used, provided such use is non-commercial. Any reproduction or distribution of the entire article must also prominently state: “This article is © 2026 OKX and is used with permission.” Permitted excerpts must cite to the name of the article and include attribution, for example “Article Name, [author name if applicable], © 2026 OKX.” Some content may be generated or assisted by artificial intelligence (AI) tools. No derivative works or other uses of this article are permitted.









