Moving average calculators compute SMA, EMA, or WMA values for any price series and period — the three most common forms of the indicator that underpin trend filters, crossover signals, and mean-reversion setups. The mathematical difference between types is not cosmetic: a 20-EMA responds roughly twice as fast as a 20-SMA to a new price shock, which directly changes where your signals fire.
How to Use
| Input | What to Enter | Example |
|---|---|---|
| Prices | Closing prices for your lookback window, oldest first | $170.10, $171.80, …, $178.20 |
| Period | Number of bars to average (e.g., 9, 20, 50, 200) | 20 |
| MA Type | SMA, EMA, or WMA | EMA |
The calculator returns the current MA value. For EMA, it also shows the smoothing factor so you can see exactly how much weight is applied to the latest bar versus the prior EMA.
Formula Explained
SMA = (P1 + P2 + ... + PN) / N
EMA = (Price × k) + (Prev EMA × (1 - k))
where k = 2 / (N + 1)
WMA = (PN×N + P(N-1)×(N-1) + ... + P1×1) / (N × (N+1) / 2)
SMA divides the sum of N closes by N. Every bar carries identical weight — a price from 20 days ago pulls the average just as hard as yesterday’s close. This makes the 50-SMA and 200-SMA highly stable trend references, but it also means they react slowly to trend changes.
EMA uses a fixed smoothing factor k = 2/(N+1). For a 9-EMA, k = 0.20, meaning 20% of the new value comes from today’s price and 80% from the prior EMA. For a 20-EMA, k drops to 0.0952 — so the previous EMA accounts for 90.5% of the new value on each bar. This is why the 9-EMA whipsaws far more than the 20-EMA on short timeframes. The 50-EMA has k = 0.038, making it almost as stable as a 50-SMA.
WMA weights bars linearly: on a 20-period WMA, the most recent bar gets weight 20 and the oldest gets weight 1, with the sum divided by 20×21/2 = 210. WMA is more responsive than SMA and roughly equivalent to EMA in speed, but without the exponential curve — futures scalpers use it when they want transparent, rank-based weighting.
Example Calculations
Scenario 1: AAPL Swing Trade — MA Bounce Setup
AAPL is trading at $178 on the daily chart. The 50-day SMA sits at $172 and the 200-day SMA at $165 — a golden cross confirmed 3 weeks prior. Price pulls back to the 20-day EMA at $175.50.
- Entry: $175.50 (20-day EMA)
- Stop: $173.00 (below 50-day SMA)
- Target: $185.00 (prior high)
- Risk per share: $2.50
- Account: $30,000 risking 1% = $300
- Position size: $300 / $2.50 = 120 shares ($21,060 notional)
The 20-day EMA bounce is the highest-probability MA entry in an uptrend, particularly when the MA slope is steep. Confirming on the 5-minute chart with a 9 EMA ($175.80) crossing above the 21 EMA ($175.60) provides a precision intraday trigger for the daily-level setup.
Scenario 2: ES Futures Day Trade — 9/21 EMA Cross
ES is trading at 5,205 on the 5-minute chart. The 9 EMA reads 5,202 and the 21 EMA reads 5,198 — a bullish cross just fired.
- Entry: 5,202 at the cross
- Stop: 5,195 (below 21 EMA, 7 points risk)
- Target: 5,218 (prior 5-min swing high, 16 points)
- Risk/reward: 16/7 = 2.3:1
This 9/21 EMA combination on the 5-minute chart is a standard intraday momentum filter for equity index futures. The signal quality improves significantly when price is already above the 200-SMA on the daily chart — multi-timeframe alignment filters out a large portion of false cross signals.
Scenario 3: Death Cross Warning on SPY
SPY’s 50-day SMA drops below the 200-day SMA. Historically this signal on SPY has had average lag of 8-12% off the prior swing high, meaning by the time the cross fires, much of the decline has already occurred. Traders using this as a risk-off signal typically pair it with a stop above the 200-SMA rather than waiting for the cross itself.
When to Use a Moving Average Calculator
- Period selection: Before applying an MA to a chart, calculate the actual smoothing factor for EMA or check the responsiveness of SMA across your intended lookback window.
- Golden/death cross monitoring: Track the distance between the 50-SMA and 200-SMA in absolute price terms to gauge how close a cross signal is before it appears on the chart.
- MA bounce entries: Confirm the exact current 20-EMA or 50-SMA level on swing trading timeframes to set precise limit orders rather than eyeballing the line.
- Multi-timeframe alignment: Verify that the daily 200-SMA is below current price before acting on 5-minute EMA crosses — this alignment check materially reduces false entries.
- Mean-reversion distance: Calculate how far price has stretched from the 20-EMA as a percentage to identify overextended conditions in technical analysis workflows.
Related Tools
- Fibonacci Retracement Calculator — Identify key support and resistance levels that often align with moving average confluence zones, strengthening MA bounce entries.
- Pivot Point Calculator — Daily and weekly pivot levels frequently coincide with MA levels, and overlapping confluence increases the reliability of both signals.
- Volatility Calculator — MA period selection should reflect the asset’s volatility regime; higher-volatility instruments benefit from longer periods to filter noise.
Frequently Asked Questions
What is the difference between SMA and EMA?
SMA assigns equal weight to every bar in the lookback window, making it slow to react but resistant to noise. EMA applies an exponential smoothing factor of 2/(N+1) that front-weights recent prices, so it responds faster to new moves but generates more false signals. For trend identification on daily charts, SMA is preferred; for intraday entries, EMA is more responsive.
How do you calculate a 20-day moving average?
Add the closing prices of the most recent 20 trading days and divide by 20. For example, if the sum of 20 SPY closes is $10,418.60, the 20-day SMA is $520.93. For a 20-day EMA, apply a smoothing factor of 2/21 = 0.0952 to each new close against the previous EMA value.
What is a golden cross in moving average analysis?
A golden cross occurs when the 50-day SMA crosses above the 200-day SMA on a daily chart, signaling a shift from a long-term downtrend to an uptrend. On SPY, this signal has preceded positive 12-month returns roughly 70% of the time since 2000, though the average entry occurs 8-12% off the prior low due to the lagging nature of both MAs.
Which moving average period should I use for day trading?
ES futures and equity day traders most commonly use a 9 EMA paired with a 21 EMA on the 5-minute chart as a primary trend filter. For swing traders holding 2-10 days, the 20 EMA and 50 SMA are standard. For position trades and macro trend identification, institutional desks rely on the 50-day and 200-day SMA on daily charts.
How is WMA different from EMA?
WMA assigns linearly decreasing weights where the most recent bar gets weight N and the oldest bar gets weight 1, with results divided by N×(N+1)/2. EMA uses exponential decay via a fixed multiplier k = 2/(N+1). WMA is more mechanically transparent and sits between SMA and EMA in responsiveness — it is used heavily by futures scalpers who want recent-price emphasis without the exponential smoothing curve.