Moving Average Calculator (SMA, EMA, WMA)
Enter your data points separated by commas, choose a period and a moving average type, and get a complete breakdown table plus a line chart comparing your raw data against the smoothed series. Supports Simple (SMA), Exponential (EMA), and Weighted (WMA) moving averages. Results update as you type.
Formula
Worked example
For data [44, 45, 47, 46, 48] with a 3-period SMA: window 1 = (44+45+47)/3 = 45.33; window 2 = (45+47+46)/3 = 46.00; window 3 = (47+46+48)/3 = 47.00. The 3-period EMA seeds at 45.33, then applies k = 2/(3+1) = 0.5, so the next EMA = 46 x 0.5 + 45.33 x 0.5 = 45.67.
What is a moving average?
A moving average (MA) is a statistical method that smooths out short-term fluctuations in a data series by averaging consecutive groups of values over a fixed window called the period. Because the window slides forward by one point at a time, the result is a new series that follows the general trend of the original data while dampening noise. Moving averages are used everywhere from financial charting and signal processing to demand forecasting and epidemiology. The key decision you face each time is choosing the period and the weighting scheme, both of which control how responsive the smoothed line is to recent changes.
SMA vs EMA vs WMA: which type should you use?
The Simple Moving Average (SMA) gives equal weight to every data point in the window. It is the most straightforward to calculate and understand, and it is less sensitive to sudden spikes or outliers. The downside is that it reacts slowly to new information because yesterday's data counts exactly as much as today's. The Exponential Moving Average (EMA) applies a multiplier k = 2/(n+1) that gives the most-recent value a higher weight and lets older values fade exponentially over time. A 10-period EMA with k = 0.182 means today's value contributes about 18.2% to the result. EMA reacts faster than SMA to price changes, which is why it is preferred for short-term trading strategies. The Weighted Moving Average (WMA) uses linear integer weights from 1 to n, so the newest value carries weight n, the second-newest carries n-1, and so on. WMA is more responsive than SMA but less extreme than EMA in how it discounts older data. It is commonly used in situations where a smooth but still trend-sensitive output is needed.
How to read a moving average chart
Plot both the raw data series and the moving average line on the same chart. When the raw price line crosses above the MA from below, that is called a bullish crossover and often signals the start of an uptrend. When price crosses below the MA from above, that is a bearish crossover and may signal a downtrend. A narrow gap between price and the MA suggests consolidation, while a widening gap indicates accelerating momentum in the direction of the gap. The longer the period, the smoother the MA line and the fewer (but more significant) crossovers it will produce. Traders often combine a short-period MA with a long-period MA: when the short MA crosses above the long MA that is called a Golden Cross (bullish); when it crosses below it is called a Death Cross (bearish).
Practical limitations of moving averages
Moving averages are lagging indicators: they summarize past data, so they always trail the current price. This lag grows with the period length. A 200-period SMA on daily data will not confirm a trend reversal until weeks or months after it began. Using a shorter period reduces lag but increases false signals. Moving averages also perform poorly in sideways or choppy markets, where prices oscillate around the MA without establishing a clear trend, generating repeated crossovers that would cause losses in a trend-following strategy. For best results, combine the MA with momentum indicators such as RSI or MACD, or with volume analysis, rather than relying on it in isolation.
Common moving average periods and uses
| Period | Typical use | Asset class |
|---|---|---|
| 3 | Very short-term smoothing, intraday signals | Stocks, crypto, commodities |
| 5 | Weekly trend on daily charts | Stocks, ETFs |
| 10 | Two-week momentum on daily charts | Stocks, ETFs |
| 20 | Monthly trend, Bollinger Bands basis | Stocks, forex, crypto |
| 50 | Medium-term trend, widely watched support/resistance | Stocks, indices, forex |
| 100 | Long-term trend filter | Stocks, indices |
| 200 | Long-term bull/bear market signal (Golden/Death Cross) | Stocks, indices, crypto |
Standard period choices used by traders and analysts across different timeframes.
Frequently asked questions
What period should I use for a moving average?
The right period depends on your timeframe and purpose. For short-term signals on daily data, 5-20 periods are common. For medium-term trend analysis, 50 periods is widely watched. For long-term trend filters, 100 or 200 periods are standard. In general, start with the period most commonly used in your market (20 or 50 for stocks) and adjust based on whether you want more sensitivity (shorter period) or more smoothness (longer period).
What is the difference between SMA and EMA?
SMA gives equal weight to every data point in the window. EMA applies an exponential decay factor so that recent points carry more weight than older ones. For the same period length, EMA reacts faster to new data than SMA. This makes EMA better for trend-following in fast-moving markets, while SMA is better for filtering out noise in slower-moving or mean-reverting series.
How many data points do I need before the first MA value appears?
For SMA and WMA you need exactly n data points to produce the first moving average value, where n is your period. A 10-period SMA on 15 data points will produce 6 MA values (positions 10 through 15). For EMA the same applies: the first EMA is seeded as the SMA of the first n values, and from there each new data point produces one additional EMA value.
Can I use a moving average for non-financial data?
Yes. Moving averages are a general smoothing technique used in many fields. Common examples include smoothing daily temperature readings or rainfall totals in meteorology, tracking the 7-day rolling average of infection rates in epidemiology, smoothing sensor readings in engineering, and forecasting demand in supply-chain planning. The math is identical regardless of what the values represent.
What is a Golden Cross and a Death Cross?
A Golden Cross occurs when a short-period moving average (often the 50-day SMA) crosses above a longer-period moving average (often the 200-day SMA). It is widely regarded as a long-term bullish signal. A Death Cross is the opposite: the short-period MA crosses below the long-period MA, signaling a potential long-term downtrend. These crossovers are lagging signals and work best in trending markets, not in sideways, range-bound conditions.