Moving Averages Explained
A moving average smooths price into a line that rises and falls with the trend. The three most common flavors are the Simple (SMA — equal weight), Exponential (EMA — more weight to recent bars), and Weighted (WMA — linear weighting). For futures traders, the 200 EMA is the single most-watched level on the chart, and the 9/21 EMA cross is the workhorse of intraday trend trading.
The four flavors you need to know
SMA (Simple Moving Average). Add up the last N closes, divide by N. Every bar counts equally. Smooth and slow.
EMA (Exponential Moving Average). A weighted average where recent bars count more than older ones. Reacts to price changes faster than SMA.
WMA (Weighted Moving Average). Linear weighting — bar N gets N weight, bar N-1 gets N-1 weight, etc. Reacts a bit faster than EMA but is less commonly used.
HMA (Hull Moving Average). A fancier construction designed to cut lag. Smooths as well as SMA but responds as fast as EMA. Popular among intraday traders.
When to use which
| Situation | Best choice | Why |
|---|---|---|
| Long-term trend filter | 200 EMA | Every institution watches it |
| Intraday trend | 9 EMA / 21 EMA | Fast-reacting, widely used |
| Swing trading baseline | 50 SMA | Slow, stable, common reference |
| Smooth trend with less lag | HMA | Modern pick if you like aggressive smoothing |
The boring answer for 90% of traders: use the EMA. It reacts fast enough for intraday work and is universally understood.
The 200 EMA — why it matters
The 200-period EMA on a daily chart is the most-watched technical level in global markets. Funds use it as a regime filter. Algos pin to it. Price often reacts to it even when nothing else on the chart would suggest it should.
Two practical uses for a day trader:
- Trend filter. If daily close is above the 200 EMA, only take longs on lower timeframes. Below, only shorts. This one rule eliminates most counter-trend losses.
- Reaction level. When price tags the 200 EMA after trending away from it, expect a reaction — a bounce, a stall, or a break that accelerates.
Moving average crossover
The classic signal: a fast MA crosses above a slow MA = buy, below = sell.
The 9/21 EMA cross is the most common intraday version. The 50/200 cross ("golden cross" / "death cross") is the headline-friendly version.
Reality check: crossover signals lag. By the time the 9 crosses the 21, the move is often 40% done. Use crossovers as trend confirmation, not entry triggers. Pair with a pullback entry rule or a structure break.
Moving averages in Pine Script (v6)
//@version=6
indicator("EMA Crossover Alerts", overlay=true)
fastLen = input.int(9, "Fast EMA")
slowLen = input.int(21, "Slow EMA")
fastEma = ta.ema(close, fastLen)
slowEma = ta.ema(close, slowLen)
plot(fastEma, color=color.yellow, linewidth=2, title="Fast EMA")
plot(slowEma, color=color.blue, linewidth=2, title="Slow EMA")
bullCross = ta.crossover(fastEma, slowEma)
bearCross = ta.crossunder(fastEma, slowEma)
plotshape(bullCross, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small)
plotshape(bearCross, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small)
if bullCross
alert("9/21 EMA bullish cross on " + syminfo.ticker, alert.freq_once_per_bar_close)
if bearCross
alert("9/21 EMA bearish cross on " + syminfo.ticker, alert.freq_once_per_bar_close)
Common mistakes
- Chasing magic numbers. 7/14, 8/17, 13/34 — they all work roughly the same. Pick a pair, stick with it.
- Using SMA for fast signals. SMA lags too much for intraday crossovers. EMA or WMA is the right tool.
- Ignoring timeframe. A 9 EMA on a 1-minute chart and a 9 EMA on a daily chart are not the same indicator. They represent wildly different amounts of time.
- Trading every crossover. In a chopping market, 9/21 will cross five times before anything happens. Use an ADX > 20 filter or skip crossovers inside compressed ranges.
How to automate moving average crossovers with CrossTrade
Convert the indicator above into a strategy() script so you get access to TradingView's built-in trade management variables, then create an alert with your CrossTrade webhook payload:
key=YOUR-SECRET-KEY;
command=place;
account=Sim101;
instrument=ES 03-26;
action={{strategy.order.action}};
qty={{strategy.order.contracts}};
order_type=market;
tif=day;
sync_strategy=true;
market_position={{strategy.market_position}};
prev_market_position={{strategy.prev_market_position}};
out_of_sync=flatten;
The sync_strategy=true flag keeps your NinjaTrader position in lockstep with TradingView's strategy state — if the strategy is flat in TradingView, NT8 flattens too.
Frequently Asked Questions
Which moving average is best for day trading?
The 9 EMA and 21 EMA on intraday timeframes are the most-used combination among futures day traders. The 200 EMA on the daily chart is the universal trend filter.
SMA vs EMA — does it really matter?
Yes, but not as much as traders think. SMA is smoother and slower; EMA is faster and more responsive. For short periods (under 20), EMA is usually the better choice. For long-term levels (50, 200), SMA and EMA behave very similarly.
What is the 'golden cross'?
The 50-day SMA crossing above the 200-day SMA. It's a widely-watched long-term bullish signal, though by the time it prints, the trend is usually well underway. The opposite — 50 below 200 — is the 'death cross.'
Can I trade just moving average crossovers?
You can, but win rates typically run 35–45% because crossovers lag. The edge comes from letting winners run — a pure crossover system relies on a few big trend trades to pay for many small whipsaw losses.