Exponential Moving Average (EMA)

A moving average that weights recent closes more heavily, so it generally responds more strongly to recent price changes than a simple average.

EMA 20GOOGL · daily
EMA on a daily GOOGL chart in StockVyze

What it measures

An exponential moving average updates each bar by moving part of the way from its previous value toward the latest close, with a weight of 2 / (period + 1). Recent closes count most, and older ones fade out gradually instead of dropping out of a window.

Because each value builds on the one before, the earliest values depend on where the loaded history starts; they settle once enough bars have passed (a few times the period).

How to read it

  • More responsive than an SMA. For the same period an EMA generally reacts more strongly to recent price changes and often turns sooner after a reversal (though not always), which many swing traders prefer for pullback entries (21 and 50 are common choices on daily charts).
  • Crossovers. A fast EMA crossing a slow one (for example 12 over 26) is the basis of MACD.

Common mistakes

  • Comparing EMAs across platforms on short histories. Different amounts of loaded history give slightly different early values.
  • Assuming faster is better. A quicker average also reacts to more noise.

Use it in a scan

Price within 2% above a 21-day EMA that is higher than five bars ago:

c > ema(c, 21) and c < ema(c, 21) * 1.02 and ema(c, 21) > ema(c, 21)@5

Inputs

InputTypeDefaultRange
periodinteger202 – 300

Outputs

value

References

  • StockVyze SKIF language reference: exponential moving average