Edgoro
Analysis · Free tool

Moving Average Calculator

Calculate the SMA, EMA and WMA of pasted closing prices: latest values, the gap from price and the last 20 values in a table.

Headline average
Order of the list
Latest EMA (10)
22.91556
Last close22.1725
SMA (10)23.13121
EMA (10)22.91556
WMA (10)22.86567

Price versus the EMA

Close isBelow
Distance from the average-3.24%
EMA change on the last bar-0.16512
Closes read30

EMA = α × close + (1 − α) × previous EMA, with α = 2 ÷ (N + 1), started from the SMA of the first N closes (ta.ema).

Last 20 values, newest first

BarCloseSMA (10)EMA (10)WMA (10)
3022.172523.1312122.9155622.86567
2922.402523.2773423.0806823.06655
2823.097623.4322523.2313923.25378
2722.680523.5057323.2611223.32798
2623.326023.6129823.3901523.49752
2523.097623.6855723.4044123.56290
2423.187023.7113923.4725923.67450
2323.653723.6537823.5360523.75937
2223.872223.5265723.5099123.73625
2123.822523.3786123.4294023.64651
2023.633823.2117823.3420423.53547
1923.951623.0777323.2772123.43437
1823.832422.9069323.1273423.24443
1723.753022.7669222.9706623.05070
1624.051922.6149922.7968122.84379
1523.355822.4232422.5179022.54767
1422.610922.3060622.3317022.35681
1322.381622.2623822.2696522.29344
1222.392622.2326922.2447722.26637
1122.154222.2128322.2119222.23368

Trading involves substantial risk of loss and is not suitable for every investor. Edgoro is a software tool, not a broker or financial adviser: nothing it produces is investment advice, and past or backtested performance does not guarantee future results.

What the moving average calculator does

A moving average smooths a price series by averaging its last N closes, so the direction of the market is easier to read than raw price. Paste closing prices from a spreadsheet, a broker export or a data download, and the calculator computes the three common types at once: the simple (SMA), exponential (EMA) and weighted (WMA) moving averages. It shows the latest value of each, how far the last close sits from the average you pick, that average's change on the last bar, and the last 20 values in a table.

The calculations match TradingView's ta.sma, ta.ema and ta.wma, so you can use the calculator to check an indicator, a spreadsheet or code you wrote.

How to use it

  1. Paste closing prices separated by commas, spaces or new lines. Dates and column headers are skipped. Use a dot as the decimal mark ("1.1650"); a list without any dot, such as "1,1650 1,1660", reads the comma as the decimal mark instead.
  2. Tell the calculator the order of the list: oldest first (most exports) or newest first (many broker statements).
  3. Set the length, the number of closes each average covers. 20, 50 and 200 are the most common.
  4. Pick the headline average. All three are always computed; the headline one drives the "price versus" rows.

The formulas

SMA = (C1 + C2 + … + CN) ÷ N

EMA = α × close + (1 − α) × previous EMA,   α = 2 ÷ (N + 1)
      first EMA = SMA of the first N closes

WMA = (N × latest close + (N − 1) × the one before + … + 1 × oldest)
      ÷ (N × (N + 1) ÷ 2)

The SMA gives every close in the window the same weight. The WMA gives the latest close N times the weight of the oldest one. The EMA weighs all past closes, with weights that shrink by a factor of (1 − α) per bar, so it reacts quickly but never completely forgets the past.

Worked example

The sample loaded in the calculator is 30 daily closes, a classic textbook series, with a length of 10:

  • The first SMA, after 10 closes, is 22.22; the last one is 23.13.
  • The EMA starts from that same 22.22 and then uses α = 2 ÷ 11 ≈ 0.1818. It ends at 22.92, down 0.17 on the last bar.
  • The last WMA is 22.87.
  • The last close, 22.17, is about 3.2% below the EMA and 4.1% below the SMA.

After the drop at the end of the list, the averages that favour recent closes sit closest to price: WMA first, then EMA, with the SMA furthest behind. That ordering is how the three averages usually line up after a sharp move.

Which average to use

  • SMA: the simplest and the one behind the widely watched 50- and 200-day levels. It reacts slowest, and an old close leaving the window moves it as much as a new one entering.
  • EMA: reacts faster for the same length, which is why crossovers such as 9/21 and the MACD (12/26) use it. See the EMA crossover strategy in Pine Script.
  • WMA: faster still for the same length, and the building block of the Hull moving average.

No type is better in general. A faster average gives earlier signals and more false ones; a slower one gives fewer, later signals. Choose with a backtest, not by eye.

Why your chart may show a slightly different EMA

The EMA depends on where it started. A chart's EMA has been running since the first bar of the chart's history, while this calculator starts it from the SMA of the first N closes you paste. The influence of the starting point fades by (1 − α) per bar: for a 20-period EMA, after 60 bars it carries less than 0.3% of its original weight. Paste at least three to four times the length and the values match to the decimals that matter. The SMA and WMA have no memory beyond N closes, so they match as soon as the same N closes are used.

Two other usual causes: the chart's last bar is still open, so its close (and every average) keeps moving until the bar ends; and different data feeds close their daily bars at different times, especially in forex.

Common mistakes

  • Reversed order. A list pasted newest first but read as oldest first gives the averages of a mirrored market. Check the order switch.
  • Mixing timeframes. Averages of daily closes and averages of hourly closes are different indicators, even with the same length.
  • Too little data for the EMA. Paste at least three times the length; the calculator warns you below that.
  • Treating a cross as a signal on its own. Price crossing an average happens often in a range. Test any rule built on it, and size every trade from its stop with the position size calculator.

Frequently asked questions

What is the difference between SMA, EMA and WMA?

The SMA weighs the last N closes equally. The WMA weighs them linearly, the latest close counting N times as much as the oldest. The EMA weighs every past close with exponentially decreasing weights, so it reacts faster than the SMA and keeps a fading memory of older prices.

Which moving average length should I use?

There is no best length. 20 is common for short-term trend, 50 for the medium term and 200 for the long-term trend on daily charts. Shorter lengths react faster but give more false signals; test the lengths on your own market and timeframe.

Why is my EMA different from the one on my chart?

The EMA remembers every past close, so it depends on its starting point. The chart's EMA started at the first bar of its history; this calculator starts from the SMA of the first N closes you paste. With at least three to four times the length in closes, the difference becomes negligible.

How many closing prices do I need?

At least N closes for an N-period average. For the EMA, paste three to four times the length so the starting value no longer matters. The calculator reads up to 10,000 values.

Does it work for stocks, forex and crypto?

Yes. A moving average only needs a series of prices, so any market and any timeframe works, as long as all the closes come from the same instrument and timeframe.

Related guides

All guides
All free tools

Let AI build the indicator behind your numbers.

Turn the rules you just calculated into a TradingView indicator, an MT5 bot or a crypto bot. Instant access, with a 7-day money-back guarantee.