Skip to main content
Skip to main navigation
Call TradeStation 800.808.9336
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 moving-average 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 strategy-testing tools to profile basic differences in outcomes using the calculations from each formula.
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:
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.
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.
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 pre-computer 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).
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 10-bar 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.
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.
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 10-bar 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.
Price Weightings: 10-Period Average
In a 10-bar WMA, as in the 10-bar SMA, data is drawn from 10 bars only. Here, too, it is clear exactly which bars are contributing to the data in the calculations.
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:
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.
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 one-line moving average strategy. Each test differs only by the type of moving average used: simple, weighted or exponential.
The first comparison used SPY as the subject market, daily bars, and the 10-year 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.
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.
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 is very close across all three tests. A value in the 30% – 40% range is very common in trend-following strategies and it is not surprising to see these values across three such similar experiments.
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.
An examination of these metrics fits with the previous discussion of signal speed and signal quality. Ideally, any trend-following 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.
The second comparison also used SPY as the subject market, but with 30-minute bars, and the 5-year period ending December 2011. For all three tests, the Length input was set to 20.
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 is very close across all three tests, slightly lagging the 30% – 40% range that is very common in trend-following strategies.
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.
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 30-minute 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 trend-following tools and gaining an understanding of their characteristics.
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:
Adding filters to the faster averages – Traders who favor weighted or exponential averages usually do so because of their greater sensitivity. Yet this may lead to a large number of trades and possibly false signals. Can these averages be combined with trade filters to reduce the number of bad trades while keeping the faster signal speed of WMA and EMA?
1 The TradeStation Platform Help has useful information on this in the topic “Loading Additional Data for Accumulative Calculations.”
Darrell Jobman. The Handbook of Technical Analysis. Irwin; 1995; 115-130. http://en.wikipedia.org/wiki/Exponential_average#Exponential_moving_average
To use the files provided with this issue of Analysis Concepts:
Questions or comments? Contact us at TSLabs@TradeStation.com
Call a TradeStation Specialist 800.808.9336
No offer or solicitation to buy or sell securities, securities derivative, futures products or off-exchange foreign currency (forex) transactions of any kind, or any type of trading or investment advice, recommendation or strategy, is made, given or in any manner endorsed by any TradeStation affiliate and the information made available on this Website is not an offer or solicitation of any kind in any jurisdiction where any TradeStation affiliate is not authorized to do business, including but not limited to Japan.
Past performance, whether actual or indicated by historical tests of strategies, is no guarantee of future performance or success. There is a possibility that you may sustain a loss equal to or greater than your entire investment regardless of which asset class you trade (equities, options futures or forex); therefore, you should not invest or risk money that you cannot afford to lose. Options trading is not suitable for all investors. Your account application to trade options will be considered and approved or disapproved based on all relevant factors, including your trading experience. View the document titled Characteristics and Risks of Standardized Options. Before trading any asset class, customers must read the relevant risk disclosure statements on our Other Information page. System access and trade placement and execution may be delayed or fail due to market volatility and volume, quote delays, system and software errors, Internet traffic, outages and other factors.
TradeStation Group, Inc. Affiliates: All proprietary technology in TradeStation is owned by TradeStation Technologies, Inc. Equities, equities options, and commodity futures products and services are offered by TradeStation Securities, Inc. (Member NYSE, FINRA, CME and SIPC). TradeStation Securities, Inc.’s SIPC coverage is available only for equities and equities options accounts. Forex products and services are offered by the TradeStation Forex divisions of IBFX, Inc. (Member NFA) and IBFX Australia Pty Ltd, ABN 84 142 210 179, holder of AFSL #363972.
Copyright © 2001-2016 TradeStation Group, Inc.