Moving Average Calculator
Calculate Simple (SMA) and Exponential (EMA) Moving Averages instantly to identify market trends.
Enter data and click calculate
Calculate from a Consistent Data Series
- Enter numeric observations from oldest to newest. Commas, spaces and line breaks are separators; do not include CSV headers, dates or thousands-separator commas.
- Choose a whole period from 1 to the number of observations. Keep a consistent interval and price definition; adjusted and unadjusted prices can produce different averages.
- Select SMA or EMA, then Calculate. The chart uses observation index rather than dates. Editing an input clears the previous result.
- Load Example fills and calculates a clearly synthetic series using a 5-period SMA. It is not market data or a trading result.
Formulas and Initialization
SMA gives equal weight to the latest n observations. EMA uses alpha = 2 / (n + 1); this calculator seeds it with the first n-observation SMA. Later EMA values retain a declining contribution from older data beyond the latest n observations. Results are displayed to four decimal places; the EMA recursion uses unrounded values.
For a hypothetical series 10, 12, 14, 20 and period 3, the first SMA and EMA are 12 at observation 3. The next SMA is 15.3333, while the EMA is 0.5 × 20 + 0.5 × 12 = 16.
What an Average Does Not Establish
Both averages summarize previous observations and lag new prices. An upward slope or a price crossing does not by itself demonstrate a profitable rule. This page calculates one average and does not detect a golden cross, fetch quotes, send alerts or place trades.
When comparing with a charting platform, match source prices, observation interval, period, warm-up history and EMA seed. A different initialization can explain early discrepancies without an arithmetic error.
Formula references: Fidelity SMA guide and Fidelity EMA guide.
Frequently Asked Questions
How is the EMA initialized here?
The first EMA is the arithmetic mean of the first n observations. Later values use alpha = 2 / (n + 1), with EMA = alpha × current value + (1 − alpha) × previous EMA. Platforms with different seeds, histories or missing-value handling can differ.
What does the period count?
The number of observations, not calendar days. Enter values oldest first with one consistent sampling interval. A period of 5 means five observations; it means five days only if your observations are daily.
Why are the first rows blank?
Both SMA and this SMA-seeded EMA require n input observations before their first output. Earlier table cells display a dash, not a zero.
Does this identify profitable trades or crossovers?
No. The page calculates one moving average on your supplied series. It does not fetch quotes, compare two averages, mark trade entries or backtest costs and performance.
Related Tools
MACD Calculator
Compute Moving Average Convergence Divergence values to identify trend direction and momentum.
Bollinger Bands Calculator
Calculate SMA-based Bollinger Bands from user-supplied closing prices.
RSI Calculator
Calculate the Relative Strength Index to identify overbought or oversold conditions.
Support & Resistance Calculator
Calculate pivot levels from manually entered OHLC using Traditional (Floor), Fibonacci, Camarilla, or Woodie with the TradingView current-period open convention.
Turn a Defined Rule into a Testable Script
Specify the data source, period, entry and exit rules, costs and position sizing before generating a Pine Script strategy. Review and test the generated code in TradingView; this calculator does not establish that the rule is profitable.
Explore Pine Script AI