A Comparative Study of Moving Averages: Simple, Weighted and Exponential
By Stanley Dash
Vice President, Applied Technical Analysis
TSLabs@TradeStation.com
Features:
 Focus: Technical
 Markets: Equities, Futures, Forex
 Time Perspective: Any

Studies/Files Included:

Summary
The moving average may be the most universal of all technical analysis indicators. While it is tempting to dismiss the moving average as antiquated its staying power is testament to its utility.
Initially, the only type of moving average was a simple arithmetic average, easy to understand and quick to calculate. This made it a standout in a world of technical analysis that predated computers. With the evolution of computerized technical analysis, a variety of additional averaging formulas have entered the mainstream.
All moving averages use a historical data series and the current price in the calculation. Since the goal is to forecast future price direction, would it be more effective to give greater weight to the more recent data points in the price series? This Analysis Concepts paper attempts to address the three most common movingaverage formulas: simple, weighted and exponential.
We begin with a comparison of the calculations of a simple arithmetic average, a weighted average and an exponential average. This includes an understanding of the impact that each data point has in the calculation since that is at the logical and mathematical heart of these averages. Then, we will use EasyLanguage and TradeStation’s strategytesting tools to profile basic differences in outcomes using the calculations from each formula.
Understanding and Comparing the Calculations
A moving average is calculated by averaging price values from a specified number of bars. Specifically, there are two parameters (inputs) for a moving average formula:
 Price – a single price value from each bar to be used in calculating the average. Traditionally, the price value used is the closing price of each bar.
 Length – the specified number of bars, counting backwards from the current, or most recent, bar from which to draw the data points.
The “moving” part of a moving average is not actually in any of the formulas. As each new bar is built, the oldest data point is dropped from the series (or its impact is reduced) and the price value from the new bar is added to the series.
There are some common values for the length of a moving average but the choice is generally both subjective and relative. That is, some traders may choose a length based on their own experience or the number of bars in a day or week.Traders who use multiple moving averages will set the lengths relative to each other so that one is a shorter length and therefore more sensitive to recent price movement, and another is longer and therefore smoother.
The items above are common to all moving averages. The difference between simple, weighted and exponential averages comes from the weights, if any, that are assigned to each of the price values in the data series. This is not a minor point, either mathematically or analytically.
Simple Moving Average
A Simple Moving Average (SMA), also known as an arithmetic average, is a common average of the price values in the data series. Each price in the data series is equally weighted; that is, there are no weighting factors applied to any of the data points.
Figure 1: 20bar SMA on SPY daily. This is the indicator Mov Avg 1 Line, Length 20, as supplied in TradeStation.

Part of the appeal of the SMA is the ease with which it can be calculated. As discussed above, this was of major significance in the precomputer era. One only has to sum the closes and divide by the number of bars in the data series (or remove the oldest data point from the previous sum, add the most recent and then divide).
Figure 2: Weighting of each data point in a 10bar SMA. Note that the xaxis is labeled 0 to 9, from the most recent to the oldest bar in the series. This is in accord with EasyLanguage notation.

As you can see in Figure 2, each price in the series is equally weighted, regardless of its age. Also note that all of the data in a 10bar SMA is drawn from 10 bars only.
This is an important point: we know exactly from which bars the data in our calculation is drawn.
Weighted Moving Average
A Weighted Moving Average (WMA) assigns a weighting factor to each value in the data series according to its age. The most recent data gets the greatest weight and each price value gets a smaller weight as we count backward in the series.
Figure 3: 20bar SMA (blue) and 20bar WMA (red) on SPY daily.

The common weighting method for a WMA, and the calculation used in TradeStation’s supplied indicator, Mov Avg Weighted, as seen in Figure 3, is often referred to as “sum of the digits.” The denominator of the weighting factor is the sum of the digits of the number of bars in the series. The numerator is the bar number as counted down from Length to 1.
For the 10bar WMA, the sum of the digits (1 to 10) is 55. The most recent bar receives a weight of 10/55, the previous bar 9/55, etc.
Table 1: Comparison of the weight given to each price in the data series in a 10bar SMA and a 10bar WMA.
Data Points: Bars 












9 
8 
7 
6 
5 
4 
3 
2 
1 
0 

Price Weightings: 10Period Average












Simple Average 










Sum of the Weights 

10.0% 
10.0% 
10.0% 
10.0% 
10.0% 
10.0% 
10.0% 
10.0% 
10.0% 
10.0% 
100.0% 
Weighted Average 












1.8% 
3.6% 
5.5% 
7.3% 
9.1% 
10.9% 
12.7% 
14.5% 
16.4% 
18.2% 
100.0% 

1/55 
2/55 
3/55 
4/55 
5/55 
6/55 
7/55 
8/55 
9/55 
10/55 
55/55 
Figure 4: Weighting of each data point in a 10period WMA. Note that the xaxis is labeled 0 to 9, from the most recent to the oldest bar in the series. This is in accord with EasyLanguage notation.

In a 10bar WMA, as in the 10bar SMA, data is drawn from 10 bars only. Here, too, it is clear exactly which bars are contributing to the data in the calculations.
Exponential Moving Average
An Exponential Moving Average (EMA) also assigns a weighting factor to each value in the data series according to its age. Here, too, the most recent data gets the greatest weight and each price value gets a smaller weight as we go back in the series chronologically. The weight of each data point decreases exponentially, hence the name.
The method for arriving at the weighting factors in an EMA is based on a smoothing factor generated from the Length input. In fact, the Length input is less of a true length as in simple and weighted averages than it is a base parameter for the calculation of the smoothing factor.
The common weighting method for an EMA, and the calculation used in TradeStation’s supplied indicator, Mov Avg Exponential, is to add the difference between the previous average and the current price, multiplied by the smoothing factor, into the previous average.
This has several implications:
 Old data points never leave the average, but their impact lessens with each new bar.
 An EMA begins calculating immediately and does not need a lookback period to get started; on the first bar of calculation, the EMA is equal to the price value in the series and is not yet an average of anything.
 Consequently, the EMA is not fully smoothed until a relatively large number of bars (some multiple of the Length input) have passed^{1}.
Figure 5: 20bar SMA (blue) and 20bar WMA (red) and 20bar EMA (black) on SPY daily.

Table 2: Comparison of the weight given to each price in the data series in a 10bar EMA
Data Points: Bars 













9 
8 
7 
6 
5 
4 
3 
2 
1 
0 


Price Weightings: 10Period Average 












Exponentially Weighted Average 










Sum of the Weights 
20period Sum of the Weights for a 10bar EMA 

3.0% 
3.7% 
4.5% 
5.5% 
6.7% 
8.1% 
10.0% 
12.2% 
14.9% 
18.2% 
86.56% 
98.19% 
Notice that the sum of the weights does not equal 100%. In fact, due to the nature of the weighting factors, data for an EMA is drawn from historical bars indefinitely and not strictly from the number of bars in the Length. Clearly, the weights of older bars become infinitesimal. In this case, the most recent 10 bars are only about 87% of the data. In both a SMA and WMA, the data points from the 10 bars are 100% of the data in the calculations.
Note: In an EMA, approximately 87% of the data is taken from the number of bars in the Length of the average. Approximately 98% of the data is drawn from Length * 2 bars. That number approaches 100% at Length * 2.5 bars.
Figure 6: Weighting of each data point in a 10period EMA. Note that the xaxis is labeled 0 to 9, from the most recent to the oldest bar in the series. This is in accord with EasyLanguage notation.

Application
In the world of practical trading applications, we cannot avoid the question of which moving average is best. And as you may have surmised from the charts above and your own experience in technical analysis, there is no definitive answer to that question. Yet there are some tests that may shed light on the issue and point us in the direction of further study.
For the purpose of these types of tests, absolute profitability is not critical; rather, it is the relative performance of each strategy, the characteristics that they display and some of the fields in the TradeStation Strategy Performance Report that are the important aspects of the comparison analysis.
The simplest possible rules are used for the study of a oneline moving average strategy. Each test differs only by the type of moving average used: simple, weighted or exponential.
 Long entry = close crosses over moving average
 Short entry = close crosses under moving average
 No stops, trailing stops or targets
 Trade size = 100 shares
 Commissions = $.01 per share
Daily Data
The first comparison used SPY as the subject market, daily bars, and the 10year period ending December 2011. For all three tests, the Length input was set to 20.
This type of strategy, not sophisticated and not recommended, is often referred to as a reversal strategy, since each position is held until the next entry signal. Percent of Time in the Market is virtually 100%. Remember that we are interested in the relative performance of each test and such metrics as Total Number of Trades, Percent Profitable and holding periods.
Table 3: Performance Summary data for SMA, WMA, and EMA on daily SPY.
TradeStation Performance Summary 
SMA 
WMA 
EMA 


All Trades 

Total Net Profit 
$727.00 
($2,238.00) 
($3,780.00) 
Gross Profit 
$29,826.00 
$34,541.00 
$30,951.00 
Gross Loss 
($29,099.00) 
($36,779.00) 
($34,731.00) 
Profit Factor 
1.02 
0.94 
0.89 




Total Number of Trades 
282 
374 
314 
Percent Profitable 
31.56% 
33.42% 
30.89% 
Winning Trades 
89 
125 
97 
Losing Trades 
193 
248 
217 
Even Trades 
0 
1 
0 




Avg. Trade Net Profit 
$2.58 
($5.98) 
($12.04) 
Avg. Winning Trade 
$335.12 
$276.33 
$319.08 
Avg. Losing Trade 
($150.77) 
($148.30) 
($160.05) 
Ratio Avg. Win:Avg. Loss 
2.22 
1.86 
1.99 
Largest Winning Trade 
3,278 
2,706 
2,880 
Largest Losing Trade 
(741) 
(741) 
(741) 
Largest Winner as % of Gross Profit 
10.99% 
7.83% 
9.31% 
Largest Loser as % of Gross Loss 
2.55% 
2.01% 
2.13% 




Max. Consecutive Winning Trades 
8 
4 
4 
Max. Consecutive Losing Trades 
12 
12 
14 
Avg. Bars in Total Trades 
9.73 
7.59 
8.84 
Avg. Bars in Winning Trades 
19.06 
14.11 
18.02 
Avg. Bars in Losing Trades 
5.43 
4.31 
4.73 
Avg. Bars in Even Trades 
0 
6 
0 




Ratio Avg. Bars in Winning Trades/Avg. Bars in Losing Trades 
3.51 
3.27 
3.81 
The data in the table above was exported from TradeStation’s Strategy Performance Report into Excel to make the summary comparisons easier to read. Several rows are highlighted and the last row of data is not in the Strategy Performance Report but has been added by the author.
Total Net Profit
As noted above, these tests are not run and presented for raw profitability and none show particularly noteworthy performance.
However, it should be noted that the SMA showed the best profit of the three types of moving averages in this test. That relative performance will be important throughout the examination of other metrics.
Percent Profitable
Percent Profitable is very close across all three tests. A value in the 30% – 40% range is very common in trendfollowing strategies and it is not surprising to see these values across three such similar experiments.
Total Number of Trades
The variation in Total Number of Trades stands out. The SMA had the best profitability and the fewest number of trades: 33% fewer than the WMA and 11% fewer than the EMA. To be sure, commissions, which were included in these tests, play a part in the net result: more trades means more commissions. Yet commissions do not change the number of signals generated: the averages with weightings generated many more signals. Technical analysts often strive for “leading,” “early” and “quick” in their indicators and signals. These tests raise the questions of whether faster or earlier signals are really better signals, or whether they can be made better in a strategy.
Avg. Bars in Winning Trades
Avg. Bars in Losing Trades
Ratio
An examination of these metrics fits with the previous discussion of signal speed and signal quality. Ideally, any trendfollowing method should have long holding periods in its profitable trades and short holding periods in the losing trades. This is evident here despite the simplicity of the methods tested. Once again, the SMA has the longest holding period in winning trades although the ratio of winning to losing holding periods slightly favors EMA.
Intraday Data
The second comparison also used SPY as the subject market, but with 30minute bars, and the 5year period ending December 2011. For all three tests, the Length input was set to 20.
Table 4: Performance Summary data for SMA, WMA, and EMA on intraday SPY.
TradeStation Performance Summary 
SMA 
WMA 
EMA 


All Trades 

Total Net Profit 
$5,035.00 
($843.00) 
$5,215.00 
Gross Profit 
$69,509.00 
$76,812.00 
$68,043.00 
Gross Loss 
($64,474.00) 
($77,655.00) 
($62,828.00) 
Profit Factor 
1.08 
0.99 
1.08 




Total Number of Trades 
1,770 
2,251 
1,825 
Percent Profitable 
27.97% 
28.21% 
26.96% 
Winning Trades 
495 
635 
492 
Losing Trades 
1,273 
1,612 
1,330 
Even Trades 
2 
4 
3 




Avg. Trade Net Profit 
$2.84 
($0.37) 
$2.86 
Avg. Winning Trade 
$140.42 
$120.96 
$138.30 
Avg. Losing Trade 
($50.65) 
($48.17) 
($47.24) 
Ratio Avg. Win:Avg. Loss 
2.77 
2.51 
2.93 
Largest Winning Trade 
1,260 
894 
1,260 
Largest Losing Trade 
(402) 
(590) 
(376) 
Largest Winner as % of Gross Profit 
1.81% 
1.16% 
1.85% 
Largest Loser as % of Gross Loss 
0.62% 
0.76% 
0.60% 




Max. Consecutive Winning Trades 
5 
5 
7 
Max. Consecutive Losing Trades 
22 
19 
20 
Avg. Bars in Total Trades 
10.21 
8.24 
9.93 
Avg. Bars in Winning Trades 
22.70 
17.24 
23.28 
Avg. Bars in Losing Trades 
5.36 
4.70 
4.99 
Avg. Bars in Even Trades 
5.50 
8.25 
11.33 




Ratio Avg. Bars in Winning Trades/Avg. Bars in Losing Trades 
4.24 
3.67 
4.67 
The data in the table above was exported from TradeStation’s Strategy Performance Report into Excel to make the summary comparisons easier to read. Several rows are highlighted and the last row of data is not in the Strategy Performance Report but has been added by the author.
Total Net Profit
Again, these tests are not run and presented for raw profitability and none show particularly noteworthy performance. In this case, the WMA was clearly the worst performer and the SMA and EMA showed similar results. Here, too, that relative performance will be important throughout the examination of other metrics.
Percent Profitable
Percent Profitable is very close across all three tests, slightly lagging the 30% – 40% range that is very common in trendfollowing strategies.
Total Number of Trades
Once again, the variation in Total Number of Trades stands out. The WMA showed the worst performance of the three and had many more trades than the others, 27% more trades than the SMA.
In that case, commissions are, again, an important part of the net result. These observations prompt questioning the wisdom of seeking out faster signals without a context or without a filter for signal quality.
Avg. Bars in Winning Trades
Avg. Bars in Losing Trades
Ratio
Finally, a look at these fields is important particularly in light of other considerations of signal speed and signal quality. SMA and EMA have similarly lengthy holding periods for profitable trades and similar ratios of holding periods. WMA, the performance disappointment, has a much shorter holding period for profitable trades as well as a weaker ratio of holding periods.
A final and important observation across the Strategy Performance Report results for both the daily and 30minute studies: the Simple Moving Average had the best (or was virtually tied for the best) relative performance, fewest trades, and greatest average holding period for profitable trades. These are three fields of interest in evaluating trendfollowing tools and gaining an understanding of their characteristics.
Conclusion
As the work of technical analysis expands and the tools become ever more flexible, there is a tendency to think that complexity has intrinsic value. Old, new, simple, complex – all should face the scrutiny of lab experiments and empirical testing without prejudice. The tests discussed here, though necessarily limited, are the type of basic research often employed to enhance understanding of technical analysis principles and indicators.
Recognizing the ways in which the characteristics of the different moving average formulas may vary should prompt additional study and refinement. Although the SMA had an edge in some of the metrics examined in this study, some traders may be willing to take on more trades in pursuit of early signals; others may prefer a lagged entry in pursuit of greater certainty in the signals.
Two ideas for further study come immediately to mind based on our observations:
Work Cited
^{1} The TradeStation Platform Help has useful information on this in the topic “Loading Additional Data for Accumulative Calculations.”
Useful Reference
Darrell Jobman. The Handbook of Technical Analysis. Irwin; 1995; 115130. http://en.wikipedia.org/wiki/Exponential_average#Exponential_moving_average
To use the files provided with this issue of Analysis Concepts:
 Files with extension ".eld" – These contain EasyLanguage® documents: analysis techniques and strategies. Doubleclicking on this file will start the EasyLanguage Import Wizard. Follow the prompts to completion. The analysis techniques or strategies will automatically be placed in the correct locations for your use in TradeStation. This should be done before opening any workspaces provided.
 Files with extension ".tsw" – These are TradeStation workspaces. These may be stored in any folder where you choose to save TradeStation workspaces.
 Files with extension ".txt" – These are text versions of the EasyLanguage documents and are generally used only by advanced EasyLanguage users.
 Other supporting documents or files may also be attached to the report.
Questions or comments? Contact us at TSLabs@TradeStation.com