Search the site

What are you looking for?

Enter a broker, tool or topic.

Orders & execution

EMA vs SMA: Check the Calculation, Weights and Starting Value

Reproduce a moving average from your own closing-price series. Compare two explicit EMA starting rules, inspect every weight and contribution, and reconcile the result in a spreadsheet.

Author · Editor

Reviewed

Two dark teal ribbons run side by side on pale travertine, one bending more sharply and the other more smoothly. An amber sphere sits nearby, with a pale blue glass panel behind and soft leaf shadows.
Check your own series and inspect a row

The essentials

  1. SMA gives the last N prices equal weights; EMA uses a recurrence with α = 2/(N + 1). Both results retain the price unit.

  2. The EMA starting rule changes its early values. This checker offers a first-SMA seed and a first-price seed explicitly.

  3. Missing early SMA values are unavailable, not zero. Empty input rows are not silently filled or removed.

  4. Exact weights sum to one and reconstruct the selected average. Matching a platform also requires matching its data, history and conventions.

Start with comparable closed prices

You have a moving-average number on one screen and a different number in a spreadsheet. Before deciding that either formula is wrong, identify the exact series and the starting rule. A value labelled EMA 3 does not describe all the choices needed to reproduce it. This guide ends with a numerical audit: the input prices, each available average, the weights behind a selected row and a record of anything still unknown.

Use one instrument, one price definition, one unit and completed periods of equal length, ordered oldest to newest. Close can mean a bid close, ask close, last-trade close or another supplied reference. Those are different inputs. Record the provider, time zone, session boundaries and whether the series is adjusted. For an instrument with corporate-action adjustments, an adjusted historical close can differ from an unadjusted one.

Record before calculating

Why it can change the answer

Closing-price field and unit

An average of USD prices is still a USD price, not a percentage return or profit.

Period length, session and time zone

Different boundaries can select different closing observations.

Complete ordered history and missing periods

EMA depends on the starting value and the observations that follow it.

N and EMA initialization

The same N can produce different early EMA values under different seeds.

Whether the last period is closed

An updating current-period value is not the same input as a completed close.

Scroll sideways to compare all columns ↔

The checker accepts a sequence of values, not timestamps or a market feed. It cannot verify that your rows really are closed, equally spaced periods. Establish that from the source before pasting. Repeated equal prices are legitimate observations; a missing period is a different issue and must not be represented by an invented zero.

Calculate SMA and choose the EMA starting rule

SMA stands for simple moving average; EMA stands for exponential moving average. For row t, the simple moving average is SMAₜ = (pₜ₋ₙ₊₁ + … + pₜ)/N. It becomes available at row N, after N observations exist. Rows 1 through N − 1 have no value under this full-window convention. The MetaQuotes moving-average reference describes the arithmetic mean and the exponential recurrence; its separate smoothed-moving-average section should not be mistaken for an EMA initialization rule.

For this guide, α = 2/(N + 1) and β = 1 − α. After initialization, EMAₜ = αpₜ + βEMAₜ₋₁. The CME explanation gives this multiplier and allows an initial SMA or a previous close as a starting value. The TradingView EMA explanation also describes exponential updating with a smoothing factor of 2. Those method descriptions do not establish one universal seed for every platform, history length or setting.

Explicit option in this checker

First available EMA

Subsequent rows

First-SMA seed

At row N: average of prices 1…N

Apply the recurrence from row N + 1.

First-price seed

At row 1: p₁

Apply the recurrence from row 2.

Scroll sideways to compare all columns ↔

The first-price option here means the first price in the supplied series. It does not pretend that you have supplied the platform’s entire earlier history or its hidden previous EMA. Both options use the same α. Choosing a seed is a calculation convention for reconciliation, not a recommendation about which indicator to trade.

When N = 1, α = 1 and β = 0. SMA and both EMA variants equal the current price at every row. With N equal to the series length, SMA and the first-SMA EMA appear only on the final row. If the series has more than one price, the first-price EMA is available earlier because its initialization needs only one value.

Reproduce the complete five-price example

Take the invented series 100, 110, 90, 110, 100, expressed as USD prices for an unnamed teaching instrument. Each row represents a completed equal-length period in the exercise; these are not market observations. Set N = 3, so α = β = 1/2. Keep fractions or full numerical precision until the final display.

Row

Price, USD

SMA, USD

EMA: first-SMA seed, USD

EMA: first-price seed, USD

1

100

Unavailable

Unavailable

100

2

110

Unavailable

Unavailable

105

3

90

100

100

97.5

4

110

310/3 ≈ 103.333333333333333

105

103.75

5

100

100

102.5

101.875

Scroll sideways to compare all columns ↔

The first full SMA is (100 + 110 + 90)/3 = 100. At row 4, the window is 110, 90, 110, giving 310/3; at row 5, it is 90, 110, 100, giving 100. The oldest price leaves the SMA window completely when a new price enters.

For the first-SMA EMA, row 3 starts at 100. Row 4 is 0.5 × 110 + 0.5 × 100 = 105; row 5 is 0.5 × 100 + 0.5 × 105 = 102.5. For the first-price EMA, row 1 is 100; successive values are 105, 97.5, 103.75 and 101.875. The two methods have used the same prices and multiplier but different initialization.

The last first-SMA EMA minus the last first-price EMA is 102.5 − 101.875 = 0.625 USD. It is a difference between two average prices, not 0.625%, a return or a trading gain. At row 3 the seed difference is 2.5; two further updates multiply it by β twice, so 2.5 × 0.5² = 0.625. This isolates the effect of initialization without changing the data.

Explain a selected row through its weights

A useful reconciliation shows why the output has that value. For SMA, the last N prices each have weight 1/N and all older prices have weight zero. For EMA, a finite supplied history has explicit weights that include the starting value. Omitting that initial contribution would leave the weights short of one and understate the average.

For a first-SMA seed at row t ≥ N, each of the first N prices has weight β^(t − N)/N. Each later price pⱼ, with j > N, has weight αβ^(t − j). For a first-price seed, p₁ has weight β^(t − 1), while each pⱼ with j ≥ 2 has weight αβ^(t − j). These are weights for the chosen row, not for observations that have not occurred yet.

Price at row 5 inspection

SMA weight

First-SMA EMA weight

First-price EMA weight

p₁ = 100

0

1/12

1/16

p₂ = 110

0

1/12

1/16

p₃ = 90

1/3

1/12

1/8

p₄ = 110

1/3

1/4

1/4

p₅ = 100

1/3

1/2

1/2

Weight sum

1

1

1

Scroll sideways to compare all columns ↔

Multiply each price by its weight and add the contributions. The first-SMA EMA at row 5 is 100/12 + 110/12 + 90/12 + 110/4 + 100/2 = 102.5 USD. The first-price EMA is 100/16 + 110/16 + 90/8 + 110/4 + 100/2 = 101.875 USD. Weights are dimensionless; contributions and the final average use USD.

The inspector shows every observation up to the selected row, including any zero SMA weight, and the contribution totals. When the selected method is not available yet, its weights and average remain unavailable. For N = 1, the current price has weight one and all earlier prices have weight zero; there is no need to interpret an ambiguous zero-to-zero power.

Check your own series and inspect a row

Try it yourself

Check SMA, EMA and the weights behind them

Paste consecutive closing prices in one unit. Compare the averages, choose how EMA starts and inspect the contribution of each earlier price.

These are equally spaced, closed periods in their original order. The calculator cannot verify missing market periods, sessions, adjustments or whether a bar has closed. It does not recommend an indicator or trading period.

Check SMA, EMA and the weights behind them

Fictional examples

One positive number per line, for example 100 then 110 on the next line. Decimal point or comma is accepted. No header, grouping, currency symbol or CSV separators. Internal and leading empty lines are errors; one final newline is allowed.

N is an integer from 1 to the number of prices. SMA first becomes available at row N.

Use one unit for the whole series. The reference is an unnamed fictional instrument priced in USD; no market or instrument is identified. The first character must be a letter or number.

SMA seed: the first N prices are averaged at row N. First-price seed: EMA starts at the first price, with recurrence from row 2. α = 2/(N + 1) in both cases.

Input limits and precision

Up to 240 prices, each greater than zero and at most 1,000,000,000, with at most 12 decimal places. At most 80 characters per line and 20,000 in the price input. The unit label has 1–24 permitted letters, numbers, spaces or . _ - /. Exact fractions are used without intermediate rounding.

This component keeps entries in page memory. It does not send them to a server or write persistent browser storage. Sitewide analytics are separate.

Fixed fictional reference · separate from your entries

Prices 100, 110, 90, 110, 100 USD; N = 3; α = 1/2. The fixed view uses an SMA seed and inspects row 5. These are invented closing prices, not dated market observations.

5 consecutive prices · N = 3 · unit: USD.

Selected EMA: EMA seeded with the first SMA.

α · EMA update coefficient
0.5
Show exact value
Exact fraction
1/2
Exact decimal
0.5
β = 1 − α
0.5
Show exact value
Exact fraction
1/2
Exact decimal
0.5
SMA · Row 5 · USD
100
Show exact value
Exact fraction
100/1
Exact decimal
100
Selected EMA · Row 5 · USD
102.5
Show exact value
Exact fraction
205/2
Exact decimal
102.5

Last-row seed difference: 0.625 USD = EMA with SMA seed − EMA with first-price seed.

Closing prices, SMA and selected EMA
Closing prices, SMA and selected EMAHorizontal axis: consecutive row number. Vertical axis: price in USD. Price uses a dotted line and circles, SMA a solid line and squares, EMA a dashed line and triangles. The selected row is marked by a vertical guide. Exact values are in the table.
  • Closing price
  • SMA
  • Selected EMA

The chart is a visual approximation. Use the table and exact export to compare digits; line crossings are not trading recommendations.

Focus a table region and use the arrow keys to scroll horizontally.

All entered prices and both EMA initializations · USD
RowPriceSMAEMA · SMA seedEMA · first-price seed
1
100
Show exact value
Exact fraction
100/1
Exact decimal
100
Not yet availableNot yet available
100
Show exact value
Exact fraction
100/1
Exact decimal
100
2
110
Show exact value
Exact fraction
110/1
Exact decimal
110
Not yet availableNot yet available
105
Show exact value
Exact fraction
105/1
Exact decimal
105
3
90
Show exact value
Exact fraction
90/1
Exact decimal
90
100
Show exact value
Exact fraction
100/1
Exact decimal
100
100
Show exact value
Exact fraction
100/1
Exact decimal
100
97.5
Show exact value
Exact fraction
195/2
Exact decimal
97.5
4
110
Show exact value
Exact fraction
110/1
Exact decimal
110
≈ 103.333333333333333
Show exact value
Exact fraction
310/3
105
Show exact value
Exact fraction
105/1
Exact decimal
105
103.75
Show exact value
Exact fraction
415/4
Exact decimal
103.75
5
100
Show exact value
Exact fraction
100/1
Exact decimal
100
100
Show exact value
Exact fraction
100/1
Exact decimal
100
102.5
Show exact value
Exact fraction
205/2
Exact decimal
102.5
101.875
Show exact value
Exact fraction
815/8
Exact decimal
101.875
Weights and price contributions at row 5

Weights have no price unit; each contribution has the same unit as the prices. Earlier prices outside the SMA window have weight zero. Only prices available by the inspected row are included.

Weights and price contributions at row 5
Source rowPriceUSDSMA weightSMA contributionUSDSelected EMA weightSelected EMA contributionUSD
1
100
Show exact value
Exact fraction
100/1
Exact decimal
100
0
Show exact value
Exact fraction
0/1
Exact decimal
0
0
Show exact value
Exact fraction
0/1
Exact decimal
0
≈ 0.0833333333333333333
Show exact value
Exact fraction
1/12
≈ 8.33333333333333333
Show exact value
Exact fraction
25/3
2
110
Show exact value
Exact fraction
110/1
Exact decimal
110
0
Show exact value
Exact fraction
0/1
Exact decimal
0
0
Show exact value
Exact fraction
0/1
Exact decimal
0
≈ 0.0833333333333333333
Show exact value
Exact fraction
1/12
≈ 9.16666666666666667
Show exact value
Exact fraction
55/6
3
90
Show exact value
Exact fraction
90/1
Exact decimal
90
≈ 0.333333333333333333
Show exact value
Exact fraction
1/3
30
Show exact value
Exact fraction
30/1
Exact decimal
30
≈ 0.0833333333333333333
Show exact value
Exact fraction
1/12
7.5
Show exact value
Exact fraction
15/2
Exact decimal
7.5
4
110
Show exact value
Exact fraction
110/1
Exact decimal
110
≈ 0.333333333333333333
Show exact value
Exact fraction
1/3
≈ 36.6666666666666667
Show exact value
Exact fraction
110/3
0.25
Show exact value
Exact fraction
1/4
Exact decimal
0.25
27.5
Show exact value
Exact fraction
55/2
Exact decimal
27.5
5
100
Show exact value
Exact fraction
100/1
Exact decimal
100
≈ 0.333333333333333333
Show exact value
Exact fraction
1/3
≈ 33.3333333333333333
Show exact value
Exact fraction
100/3
0.5
Show exact value
Exact fraction
1/2
Exact decimal
0.5
50
Show exact value
Exact fraction
50/1
Exact decimal
50
Sum of weights · No unit
1
Show exact value
Exact fraction
1/1
Exact decimal
1
1
Show exact value
Exact fraction
1/1
Exact decimal
1
Sum of price × weight · USD
100
Show exact value
Exact fraction
100/1
Exact decimal
100
102.5
Show exact value
Exact fraction
205/2
Exact decimal
102.5

The contributions sum to the average shown for this row.

The main display uses at most 18 significant digits. ≈ means it was shortened or the decimal repeats. Exact fractions and any full terminating decimals remain available below each value and in the CSV; display values never feed the calculation.

Reference files and checking protocol

Static files describe the fixed example, not your current inputs. The input CSV is a record with a header: copy only its price values, one per line, into the form. There is no CSV importer.

Paste one price per line, oldest first, without a header. A point or comma may separate decimals, but commas must not separate observations: 100,5 is one value. Do not paste a CSV table, currency symbols, thousands separators or exponent notation. The input CSV download contains a header and the reference values; copy only its price cells into the form. This textarea is not a CSV importer.

The supported range is 1–240 positive prices, each no greater than 1,000,000,000 and with at most 12 decimal places. Each line is limited to 80 characters and the complete input to 20,000 characters. One final line break is allowed. Leading or internal blank lines are errors because a missing observation must not be silently discarded. Zero, negative values, non-finite tokens and malformed entries are rejected.

Choose integer N from 1 to the number of prices, a price-unit label of 1–24 characters, and one of the two explicit EMA seeds. The unit label starts with a letter or number, followed by letters, numbers, spaces or . _ - /; it labels the data and does not convert currencies. Calculate to see both EMA series and the SMA, with the selected EMA used in the chart and weight breakdown.

Changing prices, N, units or the seed hides the previous calculated result and its CSV until you calculate again. Selecting another inspection row only navigates the already calculated result; it does not erase it. The reference, flat and spike presets are synthetic demonstrations, not recommended settings or tested strategies.

Exact fractions are retained throughout. Repeating decimals and display-shortened values are clearly marked as approximations; the display uses 18 significant digits and does not feed rounded values back into the recurrence. Inspect the exact export when more digits matter. The full reference table and static calculation CSV remain available without JavaScript, together with the input CSV and verification protocol.

The component keeps entries in page memory and does not send them to a server or write persistent storage. Site-wide analytics are separate. Without JavaScript the interactive controls are disabled, while the complete fixed example and downloads remain readable.

Verify SMA and EMA in Excel or another spreadsheet

Put the five reference prices in B2:B6, oldest first. Set H2 to 3 for N and H3 to =2/(H2+1) for α. Use column C for SMA, D for the first-SMA EMA and E for the first-price EMA. Keep the first two cells in columns C and D empty; entering zeros would invent unavailable averages.

Cell or range

Formula or action

Expected result

C4

=SUM(B2:B4)/$H$2

100

C5

=SUM(B3:B5)/$H$2

310/3

C6

=SUM(B4:B6)/$H$2

100

D4

=C4

100

D5

=$H$3*B5+(1-$H$3)*D4

105

D6

=$H$3*B6+(1-$H$3)*D5

102.5

E2

=B2

100

E3

=$H$3*B3+(1-$H$3)*E2; fill down to E6

E6 = 101.875

F6

=D6-E6

0.625 USD

Scroll sideways to compare all columns ↔

For a different N, move the first full SMA and first-SMA seed to the row containing the Nth price, then extend the same logic. Do not merely change H2 while leaving a three-price window in the formulas. The window length, first available row and seed range must all agree with N.

SUM is written in English here; your spreadsheet may use a localized function name. Decimal separators also depend on locale. Formula references and arithmetic mean the same thing. Keep formatting separate from calculation: do not insert ROUND into every update. Ordinary spreadsheets have finite numerical precision, so their displayed last digits need not equal an arbitrary-length exact fraction.

The downloads separate exact numerators and denominators from decimal displays. Import exact fraction and long-integer fields as text to avoid automatic date conversion or lost digits. A useful check is agreement of the reference values, weight sums and weighted totals; a screenshot of a rounded chart alone cannot establish the full calculation.

Investigate a mismatch without inventing missing history

Compare from the earliest row where both calculations have a value. If the input prices match but the EMA already differs at the seed, record the initialization difference first. With the same α and the same subsequent prices, an existing difference is multiplied by β at every update. That explains gradual convergence; it does not justify claiming that an unknown starting value has been recovered.

  • Different history: the first price you pasted may be much later than the first price used by the other system. Record what earlier data or previous EMA is missing.
  • Different close: verify bid, ask, last-trade or other source definitions instead of assuming that all fields called close are equal.
  • Different periods: check time zone, trading session, resampling boundaries and whether all rows are completed periods.
  • Adjusted data: document adjustment conventions where they apply; do not mix adjusted and unadjusted histories.
  • Different calculation policy: confirm N, multiplier, initialization and intermediate rounding. A label such as EMA 3 does not settle those choices.

The backtesting guide addresses the separate problem of using information only after it becomes available. Here the narrower check is that a later price cannot change an already calculated earlier average. The calculator does not simulate orders, estimate strategy performance or verify a terminal’s historical feed.

Use the downloadable protocol to retain the source, price definition, unit, interval, session, observed period range, seed and unresolved questions. If the history or convention is unavailable, report the gap rather than adjusting numbers until two rounded outputs happen to agree.

Read the result within its limits

At row 5 of the N = 3 example, the newest price has weight 1/2 in both EMA variants, while its SMA weight is 1/3. This explains one concrete difference in weighting. EMA also keeps declining contributions from earlier history; SMA discards observations outside its current window. Those definitions alone do not identify a universally better period or a profitable crossover.

Because the weights here are non-negative and sum to one, the average lies within the range of the prices that contribute to it. A constant positive series gives that same constant once each method is available. Multiplying all prices by a positive factor multiplies every available average by the same factor; adding a constant shifts them by that constant, provided the new inputs remain in range.

A moving average smooths price levels. It is not a measure of the dispersion of price changes, which is a different task covered by the Forex volatility guide. Neither this chart nor its synthetic spike preset measures trading risk, predicts a future close or recommends an entry or exit.

The reproducible outcome is a calculation record: exact inputs and conventions, available SMA and EMA values, the selected row’s weights and a list of missing evidence. Exact arithmetic can establish what follows from those inputs. It cannot establish that the inputs match a particular platform or that the indicator has predictive value.

Frequently asked questions

Does EMA use only the last N prices?

No, except for N = 1. Here N sets α = 2/(N + 1). When N > 1, earlier observations continue to contribute after initialization with declining weights. SMA uses only its current N-price window. For N = 1, both methods use only the current price.

Why can one EMA start earlier than the SMA?

The first-price seed needs only p₁, so it is available at row 1. The first-SMA seed needs N prices and starts at row N. Earlier unavailable values are not zeros.

Which EMA starting rule is correct?

Both are explicitly defined calculations. For reconciliation, use the rule and history of the series you are checking when they are known. This guide does not claim a universal platform seed or choose a better trading indicator.

Can I remove blank rows before pasting?

Only after identifying what they mean in the source. A blank caused by a missing period is not an ordinary formatting gap. The checker rejects leading and internal blanks rather than silently compressing time or inserting zeros; one final line break is allowed.

Should I round every EMA update in Excel?

Not for comparison with this exact model. Keep intermediate calculations at the spreadsheet’s available precision and format the final display. If another system deliberately rounds each step, document that as a separate calculation convention.

Will the result exactly match my trading platform?

Only identical inputs and conventions can support that expectation. Check history, close definition, session boundaries, N, seed and rounding first. The calculator does not fetch platform data or certify a platform match.

Sources & further reading

Orders & execution
Forex backtestingSeparate the time when information becomes available from the later evaluation of a strategy.Forex volatilityDistinguish smoothing a price level from measuring dispersion in price changes.
All guides