Moving averages

Exponential Moving Average on a Live Gold Chart

An exponential moving average is a running average that gives the newest close the biggest say and lets older ones fade out gradually. Compared with a simple average of the same length it turns sooner, which you can see on the hourly gold candles below wherever price reverses.

Loading the live chart.

Close
–
EMA
–

Open the gold chart

What it shows

The EMA runs over the candles themselves. With a Second line type picked, another line appears over it, an average of the EMA’s own values. SMA + Bollinger Bands adds an upper and a lower band around that second line.

How Pravex works it out

  1. Work out the weight alpha = 2 ÷ (N + 1). With the default length of 9, alpha is 0.2.
  2. The first EMA value is the plain average of the first N values.
  3. After that each value is alpha × the new price + (1 − alpha) × the previous EMA. Example numbers, not a live price: a previous EMA of 100 and a new close of 110 at alpha 0.2 give 102.
  4. Old prices never drop out completely. Their share just shrinks with every candle, which is why the line reacts quicker than a simple average of the same length.

Settings

SettingDefaultWhat changing it does
Length9Sets alpha. A short length gives a large alpha and a line that follows price closely; a long one gives a small alpha and a slower line.
SourcecloseThe price that goes into each step. With hlc3 a candle that spikes and closes back in range still nudges the EMA, which the close alone would hide.
Offset0Shifts where the EMA is drawn, forward for a positive count and back for a negative one, without changing a single value.
Second line typeNoneAverages the EMA again: None, SMA, SMA + Bollinger Bands, EMA, SMMA (RMA), WMA or VWMA. An EMA of the EMA gives a slower twin line; VWMA has nothing to weight with on gold, whose candles hold no volume.
Second line length14How far back the second line reaches, in EMA values. Hidden while the type is None.
Band width in standard deviations2Matters only for SMA + Bollinger Bands, where it sets how many standard deviations of the EMA the bands are spread from the second line.

How traders read it

The EMA gives a quick read on direction. Price holding above a rising EMA says buyers have kept winning on the closes; price under a falling one says sellers have.

Because it reacts quicker, the EMA is often used for shorter-term pullbacks. In a clear gold move, price can dip back toward a medium EMA and carry on, and traders watch how the candles behave around the line.

Two EMAs of different lengths on the same chart are a common pair. The shorter one crossing the longer one is read as a shift in momentum.

When it misleads

Quicker does not mean right. The same quickness that lets the EMA turn early makes it flip on every noisy move, so in a sideways market it gives many false crossings. It still lags a sharp reversal. The first stretch of the line also depends on where the loaded history starts, since the average is seeded from the first N values and old prices fade only slowly.

Questions and answers

What is the difference between EMA and SMA?

The SMA gives every close in its window the same weight. The EMA gives the newest close the most weight and lets older ones fade, so it follows price more closely.

Is a 9 EMA fast or slow?

Fast. With alpha at 0.2 the newest close carries a fifth of the weight, so on hourly gold it bends within two or three candles of a turn. The 20 and 50 EMAs people quote for the slower trend use alphas near 0.095 and 0.039.

Why does my EMA have a second line?

That is the second line, an average of the EMA’s own values. It is off by default, so someone picked a type; set Second line type back to None to hide it.

Why does my EMA differ slightly from another chart?

The first value is seeded from a plain average of the first N closes, and old prices fade without ever leaving. Two charts that load a different amount of history start from different seeds, so their EMAs can disagree a little for a while.

Related: Simple Moving Average, Moving Average Weighted, Double EMA, Moving Average Convergence Divergence, every indicator.

Not financial advice. Read our disclaimer.

Pro charts. Zero paywalls.

Charts for gold, oil, US indices and crypto, with every tool free to use.

Open the chart

No card, no trial, no upgrade pop-ups.