Moving Average Calculator
Calculate Simple Moving Average (SMA) and Exponential Moving Average (EMA) from price data.
Understanding Moving Averages
What is a Moving Average?
A moving average (MA) is a technical analysis indicator that smooths out price data by creating a constantly updated average price over a set period. It filters out short-term noise and helps identify the direction of the trend. Moving averages are lagging indicators — they follow price rather than predict it — but they are one of the most widely used tools in trading.
Formulas
SMA = (P₁ + P₂ + ... + Pₙ) / n
EMA = Pₜ × k + EMAₜ₋₁ × (1 - k), k = 2/(n+1)
SMA vs EMA
SMA
- • Equal weight to all prices in the period
- • Smoother and less reactive to sudden spikes
- • Slower to react to trend changes
- • Best for identifying long-term trends
EMA
- • Higher weight to recent prices
- • Faster to react to price changes
- • Fewer false signals in trending markets
- • Best for short-term trading and quick signals
Key Signals
🟢 Golden Cross
When SMA50 crosses above SMA200, it signals a potential long-term bullish trend shift. Historically reliable but can produce false signals in sideways markets.
🔴 Death Cross
When SMA50 crosses below SMA200, it signals a potential long-term bearish trend shift. Often confirmed by declining volume and broader market weakness.
Common Periods
| Period | Type | Use Case |
|---|---|---|
| 5 | Short-term | Day trading and scalping signals |
| 20 | Medium-term | Swing trading support/resistance levels |
| 50 | Long-term | Trend direction and golden/death cross signals |
| 200 | Very long-term | Major trend identification and bull/bear market divide |
Frequently Asked Questions
What is the difference between SMA and EMA?
SMA gives equal weight to all prices in the period. EMA gives more weight to recent prices, making it more responsive to new information.
What are golden cross and death cross?
A golden cross occurs when the short-term MA (e.g., 50-day) crosses above the long-term MA (e.g., 200-day), signaling a bullish trend. A death cross is the opposite.
Report a Problem
Found a bug or have a suggestion? Help us improve this tool.
What is this tool?
Moving average calculator computes Simple Moving Average (SMA) and Exponential Moving Average (EMA) from price data. Moving averages smooth price fluctuations to identify trends. SMA gives equal weight to all periods, while EMA gives more weight to recent prices. Commonly used periods: 20-day (short-term), 50-day (medium-term), and 200-day (long-term) moving averages.
How to use
- 1
Enter price data
Input a series of closing prices.
- 2
Set period
Choose the moving average period (e.g., 20, 50, 200).
- 3
View results
See SMA and EMA values with trend analysis.
Frequently Asked Questions
SMA or EMA, which is better?
EMA responds faster to recent price changes (better for short-term trading). SMA is smoother and shows clearer long-term trends. Many traders use both: EMA for entry timing and SMA for trend confirmation. The 200-day SMA is a widely watched long-term trend indicator. Neither is universally better—choose based on your trading style.
SMA or EMA which is better?
EMA reacts faster. SMA is smoother.
How are moving averages calculated?
SMA is calculated by adding the closing prices for a specified period and dividing by the number of periods. For example, a 10-day SMA = (Sum of last 10 closing prices) / 10. EMA applies a weighting factor to give more importance to recent prices. The smoothing factor for EMA = 2 / (Period + 1). EMA = (Close × Smoothing Factor) + (Previous EMA × (1 - Smoothing Factor)).