Learn › Indicators
Moving Averages: SMA vs EMA, Crossovers and Trend Filters
Moving averages are the oldest and most widely used tools in technical analysis. They turn a noisy price series into a smoother line that is easier to read, and they underpin many other indicators, including MACD, Bollinger Bands and Supertrend. The price of that smoothness is lag. Understanding exactly how much a moving average lags — and how that lag affects crossover systems — is the key to using them well.
Simple moving average (SMA)
The SMA is the arithmetic mean of the last n closes. Each close in the window has equal weight, and a close drops out completely when it leaves the window. Two consequences follow:
- The SMA's average lag is about (n − 1) / 2 bars. A 20-bar SMA effectively describes where price was about 9.5 bars ago.
- When a large move drops out of the window, the SMA can change direction even if current prices have not changed — the so-called “drop-off effect”.
Exponential moving average (EMA)
The EMA updates recursively:
EMAtoday = α × Closetoday + (1 − α) × EMAyesterday, with α = 2 / (n + 1)
Recent prices get the most weight and older prices fade gradually instead of dropping out. For the same n, an EMA reacts faster than an SMA and does not suffer from the drop-off effect. Its effective lag is also roughly (n − 1) / 2 bars, but more of its weight sits on the latest bars, so it turns sooner after a change in direction. Because the EMA depends on every earlier value, it needs a warm-up period: a common rule is to load at least three to four times n bars before trusting its value.
Choosing the length
Commonly used lengths include 9 or 10 (very short-term), 20 or 21 (short-term), 50 (medium-term) and 100 or 200 (long-term). There is nothing magical about these numbers beyond the fact that many people watch them. What matters is the relationship between the length and the timeframe: a 50-period average on a five-minute chart covers just over four hours, while on a daily chart it covers about two and a half months.
Price-crossover and dual-crossover systems
The simplest moving-average systems are:
- Price crossover: long when price closes above the average, short or flat when it closes below.
- Dual crossover: long when a fast average crosses above a slow one (for example the 20 above the 50), short or flat on the reverse cross.
Both behave in a characteristic way. In a sustained trend, they catch most of the move after a delay and give back part of it before the exit signal. In a sideways market, the averages tangle, and each small swing produces a losing trade — a whipsaw. Over many market cycles, a few large winning trends typically have to pay for many small whipsaw losses, so win rates of 30–40% are normal for crossover systems and not a sign that something is broken.
How costs change the picture
Whipsaws are expensive because every round trip pays fees and spread. On short timeframes, where moves between crossovers are small, costs can exceed the average gross profit per trade. A crossover system that looks profitable on a five-minute chart before costs can be unprofitable after them, while the same logic on a one-hour or four-hour chart, with fewer and larger trades, may survive. Always backtest with realistic commissions, slippage and, for perpetual futures, funding.
Reducing whipsaws
- Trend-strength filter. Only trade crossovers when ADX is above a threshold, indicating a trending rather than ranging market.
- Higher-timeframe filter. Only take long crossovers when price is above a longer-term average on a higher timeframe, such as the 50-period EMA on a four-hour chart for a one-hour system.
- Buffer. Require price to close a small distance (for example a fraction of ATR) beyond the average before acting.
- Confirmation bars. Require the cross to hold for one or two closed bars. This removes some whipsaws but adds lag.
Each filter removes some losing trades and some winning ones. The only way to know whether the trade-off is favourable is to test it, ideally on data that was not used to choose the filter settings.
Moving averages as filters, not just signals
Many robust strategies use moving averages purely as context: a breakout or momentum strategy that only takes longs when price is above its 200-period average, for example. Used this way, the average does not need to time anything precisely; it simply keeps the strategy on the side of the prevailing trend.
Dynamic support and trailing exits
In trends, price often pulls back toward a short or medium average before continuing. Some traders use this for pullback entries, and many use an average as a trailing exit: hold a long position until price closes below the 20-period EMA. This lets trends run but gives back a meaningful amount of profit at the end of each move.
Testing honestly
Moving-average lengths are easy to optimise, and with two lengths, a filter and an exit there are thousands of combinations. If you search all of them on one period, the best combination will look excellent largely by chance. Prefer a small set of sensible lengths, check that neighbouring settings also work (a “plateau” rather than a single spike), and confirm the result on a later period or with walk-forward testing.
Key takeaways
- SMA weights the window equally; EMA weights recent prices more and turns sooner.
- All moving averages lag. Crossover systems win big in trends and lose small, often, in ranges.
- Costs decide whether short-timeframe crossover systems survive; test with realistic fees.
- Filters (ADX, higher-timeframe trend, buffers) reduce whipsaws but must be validated on unseen data.
Educational content only. This guide explains general concepts and is not investment advice or a recommendation to trade any instrument. Trading involves substantial risk of loss, and historical or simulated results do not guarantee future performance. Read the Risk Disclosure.
