Why smooth price at all
Raw price is noisy. A moving average replaces each bar with an average of the last N bars, which filters out some of the noise and shows the direction more clearly. The price is the cost: every moving average lags, and the longer the window, the more it lags.
Simple moving average (SMA)
The SMA adds the last N closes and divides by N. Every bar in the window has the same weight, and a bar drops out abruptly when it leaves the window. That can cause small jumps in the line when a large old bar exits.
Exponential moving average (EMA)
The EMA gives more weight to recent closes, with the weights falling off exponentially. It is computed recursively, using a smoothing factor based on the period:
Old data never fully disappears; it just counts for less and less. Because the EMA reacts faster than an SMA of the same length, it is popular for short-term trading and is the building block of MACD.
Weighted moving average (WMA)
The WMA also favours recent bars, but with straight-line weights. In an N-bar window the newest close is multiplied by N, the one before by N minus 1, and so on down to 1, and the total is divided by the sum of the weights.
Unlike the EMA, a WMA has a hard cutoff: bars outside the window carry no weight at all.
| Type | Weighting | Reaction speed |
|---|---|---|
| SMA | Equal across the window | Slowest of the three |
| WMA | Linear, newest highest, hard cutoff | Faster than SMA |
| EMA | Exponential decay, no cutoff | Faster than SMA |
Common period choices
There is no correct length. Shorter averages such as 9 or 20 are common for intraday charts; 50, 100 and 200 are common on daily charts and are widely watched by other participants, which is part of why traders pay attention to them. Test a length on the market and timeframe you actually trade rather than adopting one by habit.
Crossovers
A crossover happens when a faster average crosses a slower one, for example a 50-period crossing above a 200-period, often called a golden cross, or below it, a death cross. Crossovers are simple to define and easy to automate, which also means they are well known and lag by construction. They work best discussed together with how they behave in ranges, where repeated crossings are common. For a dedicated look at crossover pairs and how to study them, see movingaveragecrossover.com.
Choosing between the types
A useful way to decide is to ask what failure you can live with. If you hate being late, a faster average such as a short EMA reacts sooner but will be pushed around by single large bars. If you hate whipsaws, an SMA or a longer window will hold its line through noise but will turn after the move has already begun. Some traders plot two lengths of the same type, and others use the average only as a slope filter: rising means look for longs, falling means look for shorts, flat means stand aside.
The distance between price and the average is also informative. When price stretches far from a moving average, traders often describe the market as extended, and watch for either a pullback toward the line or a pause. How far is far depends on volatility, which is one reason moving averages are often read alongside ATR.
Limitations
- All of them lag; faster settings trade lag for more false signals.
- In sideways markets price whips across the line repeatedly.
- Choosing the length after looking at the chart tends to fit the past, not the future.
SMA, EMA and WMA are all included with NinjaTrader 8, and the same indicator window lets you plot several averages on one chart with different colours. NinjaTrader Guru explains how to add them and keep your settings in a chart template.
To go beyond the stock averages with additional NinjaTrader 8 tools, Browse the NinjaTrader software listing at Affordable Indicators, or ask questions in the Discord community.
Quick answers
- Which is better, SMA or EMA?
- Neither is better in general. The EMA reacts faster and the SMA is smoother. The right one depends on how much lag you can tolerate on your market and timeframe.
- How is the EMA multiplier calculated?
- The smoothing factor is 2 divided by the period plus one. For a 20-period EMA that is 2 / 21.
- What is a golden cross?
- A bullish crossover in which a shorter average, commonly the 50-period, crosses above a longer one, commonly the 200-period. A death cross is the reverse.
Keep reading
Educational only, not financial advice. Futures trading involves substantial risk of loss.