Indicator Guide / Trend
The average closing price over the last few bars. It updates on every new bar and shows the trend's direction.
A simple moving average is the average of the last few closes. On each new bar, the simple average adds the newest close and drops the oldest. Most moving averages use closing prices.
The simple average (SMA) counts every bar the same. The exponential average (EMA) gives recent bars more weight. It keeps a little weight on older bars. It turns sooner.
Close–
SMA 20–
EMA 20–
Close vs SMA–
How much each of the last 20 bars counts (newest on the right). Top: SMA, every bar 5%. Bottom: EMA, the newest bar 9.5%, older bars less.
The orange dashed line is the 20-bar simple average. The purple line is the 20-bar exponential average. The exponential average bends sooner because it weighs the newest bars more.
SMA = sum of the last 20 closes ÷ 20. EMA: the first value is the SMA. After that, new EMA = close × 2 ÷ 21 + old EMA × 19 ÷ 21. Gap = (close ÷ SMA − 1) × 100, in percent.
“Before I wrote that book, there were just two basic totally automatic trading systems to my knowledge. One was the moving average and the other was Richard Donchian’s weekly rule.”
J. Welles Wilder, interviewed by Stuart McPhee for The Trader's Journal. Reprinted in Technically Speaking (Market Technicians Association), August 2006.
Not named in our sources, In use before 1978. J. Welles Wilder wrote a book in 1978. Before it, he said, the moving average was one of just two basic, totally automatic trading systems he knew of. Moving averages are also building blocks for other indicators, including MACD and Bollinger Bands®.
Neither source names who invented the moving average.
StockCharts says trading ranges render moving averages ineffective. With no strong trend, it says crossover systems produce many whipsaws. It also says that once in a trend, moving averages will keep you in but give late signals.
On the chart below, find every close that crosses above the 20-bar simple average. For each one, count the next 10 bars. Did price fall, go sideways or keep rising? On made-up prices, this shows you how to read the crosses. It does not test them.
We have not measured this on our data yet. We plan a Library test of Stan Weinstein's 30-week average stages, with fees and held-out data.
Indicators are public ideas. The words here are ours, with credit to each source. Information, not advice.