Free email newsletter with articles on systematic trading



Article Library
What's New
About Us
Site Map





Adaptrade Software Newsletter Article


The Sweet Spot for Mean Reversion ETF Strategies

by Michael R. Bryant



In his recent book, Howard Bandy discussed what he calls the "sweet spot" for developing mean reversion trading systems.1 The idea is that the right combination of bar length, holding period, system accuracy, and other variables tends to maximize risk-adjusted returns.2 This article shows how mean reversion trading strategies that lie in that sweet spot can be developed for exchange traded funds (ETFs) using automated tools.


Using Adaptrade Builder, a strategy development tool for Windows, I'll show how stress testing methods with Monte Carlo analysis can be used as part of the development process to find robust mean reversion strategies for the S&P 500 (SPY) ETF and the Select Sector SPDR* ETFs. Project files for Builder, which include the strategy code, are provided for each example.


Landing in the Sweet Spot

The basic idea behind Dr. Bandy's sweet spot is that good trading strategies should use a short bar size and have a fairly high accuracy with a short holding period and low drawdown. The short bar size and short holding period maximize the opportunities to compound returns while the high accuracy and low drawdown make it easier to recover from losses. The latter qualities also make it easier to establish the viability of the strategy and to determine when it's no longer working because typical losing streaks for high-accuracy systems tend to be relatively short.


Based on Dr. Bandy's guidelines, the following characteristics will be used in this article to define the optimal requirements for mean reversion ETF strategies:

bulletDaily bars 20 - 30 trades per year
bulletAt least 65% winning trades
bulletAverage bars in trades of between 1 and 4


By mean reversion, I'm referring to strategies that attempt to buy below the current average price and sell at a higher price as the price reverts to the mean. The idea is to buy low and sell high, as opposed to trend-following systems, which typically try to buy high and sell higher.


Building With Monte Carlo Analysis

In my last newsletter article, I discussed the use of stress testing in evaluating trading strategies and its relationship to robustness and strategy over-fitting. I also mentioned that if it were incorporated into the build process, it would tend to lead to strategies that exhibited robustness. That's the approach that will be followed here.


Briefly, stress testing refers to evaluating how sensitive a trading strategy is to its inputs and environment. A robust strategy -- one that is not over-fit to the market -- will be relatively insensitive to changes in its input parameter values and to other changes in its environment, such as changes to the price data.


Monte Carlo analysis is the technique used to evaluate the effect of these changes. The strategy's inputs, price data, and other factors are randomly changed, and the strategy's performance is evaluated. By repeating this process many times, a distribution of results is obtained. The results from the original data represent one point on the distribution. Other points on the distribution represent the results from using slightly altered versions of the original data, which may generate results that are more or less favorable than the original data.


The so-called Monte Carlo results are the values of the performance measures (net profit, percent wins, profit factor, etc.) that are no worse than a majority (typically, 95%) of the evaluations. For example, if the Monte Carlo net profit at 95% confidence is $15,000, that means that 95% of the evaluations had a net profit at least as great as $15,000. In other words, there's a 95% chance that the net profit will be at least $15,000, or, conversely, there's a 5% chance the net profit will be less than $15,000.


When a trading strategy is developed iteratively over successive generations of modification and test, building based on the Monte Carlo results will tend to drive the strategy to one that is robust since only a robust strategy will have good Monte Carlo results. Adaptrade Builder automates this process, including evaluating the strategy results using the Monte Carlo results of stress testing.


An SPY Example

The first example is for the SPDR S&P 500 index ETF (symbol SPY). Daily bars from 1/4/1999 to 4/23/2013 were used. The date range for building was set to 1/4/1999 to 1/2/2011, with the first 80% (1/4/1999 - 8/10/2008) used for building (i.e., in-sample) and the remaining data (8/11/2008 - 1/2/2011) used for out-of-sample testing. The remaining data (1/3/2011 - 4/23/2013) were set aside for validation. All data were obtained from TradeStation 9.


The strategy logic was long-only, and 100% of equity was invested on each trade, with all profits reinvested, and $0.015 per share deducted per round-turn for trading costs.


Adaptrade Builder uses a genetic programming algorithm to evolve a population of strategies over successive generations. The key to using Builder to find strategies that meet our optimal requirements is setting the so-called build metrics, shown below in Fig. 1.


Build metrics for mean reversion trading strategies

Figure 1. The build metrics in Builder define the sweet spot for the SPY strategy.


The list of Build Objectives contains three general-purpose metrics, all of which are being maximized. These help guide the population of strategies towards ones that have a high net profit, correlation coefficient, and statistical significance, which are desirable for any strategy. The specific qualities we're looking for (i.e., the sweet spot) are defined by the Build Conditions, which include the inequality conditions for the number of trades, average bars in trades, and the percentage of wins.


Notice that the condition for the number of trades is set to a range based on the number of years of in-sample data and the goal of having between 20 and 30 trades per year. Also notice that the percentage of winning trades is set to a range of between 65% and 85%. The upper limit was added because strategies with an unusually high percentage of winning trades will generally fail to meet some other condition. Penalizing such strategies will help drive the population towards strategies that meet all conditions, as opposed to strategies that disproportionately meet one condition to the exclusion of others. The same logic was used in setting a range for the profit factor.


The other conditions -- correlation coefficient, statistical significance, profit factor, and Kelly fraction -- are not part of our specific requirements, but were added to improve overall results. The stress testing and Monte Carlo settings used for this example were selected on the Build Options screen, as shown below in Fig. 2.


Monte Carlo stress testing options for mean reversion trading strategies

Figure 2. The Monte Carlo analysis and stress testing options are selected on the Build Options tab.


As shown in the figure, 99 Monte Carlo iterations were used for each analysis. This means that 99 stress tests were performed in addition to the evaluation of the original data. The 100 data sets were analyzed using Monte Carlo analysis to extract the results at 95% confidence, where were used to evaluate the conditions shown in Fig. 1. The stress tests consisted of randomizing the prices, randomizing the strategy inputs, and randomizing the starting bar. All three randomizations were performed for each stress test.


Because each strategy was evaluated 100 times (99 stress tests plus the original data) at each generation, this approach took about 100 times as long as it would have taken had stress testing and Monte Carlo analysis not been used. For this reason, a relatively small population of only100 members was used in order to keep the solution time reasonable. The population was evolved over 10 generations, and an option was set to start over after 10 generations if the net profit in the out-of-sample period was negative.


The equity curve plot from the top strategy in the population after 20 generations (1 rebuild) is shown below in Fig. 3.


Stress test equity curves for SPY strategy

Figure 3. Equity curves for each stress test for the final SPY strategy.


Each curve in Fig. 3 represents one stress test. As can be seen, all the different equity curves generally have the same shape with positive out-of-sample results. The following are some of the Monte Carlo results at 95% confidence corresponding to Fig. 3.

Total Net Profit $56,784.50
Profit Factor 1.833
Number of Closed Trades 99
Percent Profitable 65.35%
Max Number Consecutive Wins 9
Max Number Consecutive Losses 4
Average Bars in Trades 2.01

Aside from the number of trades, which is fewer than asked for, the strategy meets the original requirements. The strategy also passes the validation test. When the end date is extended to 4/23/2013, the Monte Carlo total net profit increases to $67,015. The strategy logic also satisfies the requirement for a mean reversion strategy: it enters on a limit order and exits using an indicator condition. The limit entry means the market has to come down to the limit price, so the strategy is buying low and selling after the market goes back up.


It's important to keep in mind that these are Monte Carlo results at 95% confidence, which means that, for example, 95% of the stress test evaluations had a total net profit at least as large as $56,784. If the stress testing is turn off and the strategy is evaluated on the original data, the equity curve is as shown below in Fig. 4.


Equity curve for SPY strategy on original data

Figure 4. Equity curve for the final SPY strategy on the original data.


This equity curve corresponds to a net profit of $109,497, which is equivalent to an annual return of 5.5%. While this is only a modest return, it easily beats the buy-and-hold return of approximately 1.8% over the same period and is achieved without leverage and with a steadily increasing equity curve throughout a period that includes two bear markets.


A Select Sector SPDR Example
The second example involves building a strategy over a portfolio of ETFs consisting of the Select Sector SPDRs. These ETFs divide the S&P 500 index into nine sectors such that each stock in the S&P 500 is placed into one of the nine sectors with no overlap. The nine sectors are Consumer Discretionary (symbol XLY), Consumer Staples (XLP), Energy (XLE), Financial (XLF), Health Care (XLV), Industrial (XLI), Materials (XLB), Technology (XLK), and Utilities (XLU).


Most of the same settings were used to build this strategy as in the last example. However, because nine times as much price data were used in the build, I reduced the number of Monte Carlo iterations from 99 to 5. The other build options were the same as in Fig. 2 except for the rebuild option, which didn't come into play. For position sizing, 20% of equity was invested on each trade. Since not all markets were likely to be trading at the same time, this setting was chosen to provide adequate position sizes without resulting in leverage (i.e., over-investment).


The in-sample period for this build was 1/4/1999 to 5/28/2009 with 5/29/2009 to 1/2/2012 as the out-of-sample period and 1/3/2012 to 4/23/2013 set aside for validation. The equity curve plot from one of the top strategies in the population after 10 generations (no rebuilds) is shown below in Fig. 5.


Portfolio equity curve for Select Sector SPDR strategy

Figure 5. Equity curves for each stress test for the final Select Sector SPDR portfolio strategy.


Each equity curve in Fig. 5 represents the portfolio equity generated from back-testing on all nine markets simultaneously for one set of stress test settings (or the original data). Some summary Monte Carlo results are shown below.

Total Net Profit $191,027
Profit Factor 1.541
Number of Closed Trades 927
Percent Profitable 80.3%
Max Number Consecutive Wins 66
Max Number Consecutive Losses 9
Average Bars in Trades 7.15

Unlike the previous example, the results are not substantially different when the Monte Carlo analysis is turned off and the results are evaluated over the original data. In this case, the total net profit increases to $205,140. This strategy also passes the validation test. The equity curve for the strategy over the original data only (no stress testing), in which the validation period is included, is shown below in Fig. 6.


Equity curve for Select Sector SPDR strategy on original data

Figure 6. Equity curve for the final Select Sector SPDR portfolio strategy on the original data.


This equity curve corresponds to a net profit of $249,431, which is equivalent to an annual return of 9.5% with a worst-case drawdown of 21%. As with the previous example, the strategy logic enters long on a limit order. Most of the exits are via a target exit, with other trades exiting based on an indicator condition or on a protective stop.



Download Mean Reversion Project Files:*

SPY Example:

SPDRs Portfolio:

(right-click, Save target as... to .zip file; requires Adaptrade Builder to open.)

*For licensing reasons, project files do not include price data.

The so-called sweet spot for trading strategies recommended by Dr. Bandy seems to provide effective conditions for building mean reverting trading strategies in an automated manner using a tool like Adaptrade Builder. It was possible to find strategies that met most of the requirements for both examples: a single-market strategy for the SPY ETF market, and a strategy for a portfolio of ETFs consisting of the nine Select Sector SPDRs. Both strategies beat buy-and-hold and held up well in the validation test.


For both examples, stress testing with Monte Carlo analysis was employed to increase the chances of finding robust strategies. Compared to the portfolio example, the stress test results for the single-market (SPY) strategy were substantially more conservative (less favorable) than the results from the original data. While some of that may be due to the more rigorous stress testing as compared to the portfolio example, it suggests that the SPY strategy is less robust than the portfolio example. In general, where the Monte Carlo results diverge markedly from the results on the original data, it might be expected that the best estimate of future results would be somewhere in between, although that will depend on how conservative the stress testing and Monte Carlo analysis is.


It does seem reasonable that the portfolio strategy would be more robust than the single-market strategy since the portfolio strategy was built over nine different markets and was required to work reasonably well over a wider variety of price data. It was built over nine times as much data and has roughly nine times as many trades. The greater performance of the portfolio strategy may reflect the positive effect of diversification over the nine different sectors of the SPDRs.


Although neither strategy met the requirement for the number of trades, it may be possible to find strategies that meet all requirements if a larger population is used or more stringent rebuild requirements are employed, which would require more build time. Alternatively, it may be the case that such a strategy is unlikely to be found due to the conflicting requirements of high accuracy, trade frequency, short trade duration, and so on. The best set of build conditions is one that fully exploits the market's potential while remaining realistic.


Combining a set of useful build conditions, such as those provided by Dr. Bandy, with built-in robustness features, such as stress testing and Monte Carlo analysis, in an automated tool like Builder should provide a solid framework for developing effective trading strategies.




  1. Bandy, Howard B., Mean Reversion Trading Systems, Blue Owl Press, Inc., Sioux Falls, SD, 2013, p. 138.

  2. Bandy, Howard B., Modeling Trading System Performance, Blue Owl Press, Inc., Sioux Falls, SD, 2011, p. 154.


Mike Bryant

Adaptrade Software


This article appeared in the April 2013 issue of the Adaptrade Software newsletter.


*The S&P 500 and Select Sector SPDRs are trademarks of The McGraw-Hill Companies, Inc.




If you'd like to be informed of new developments, news, and special offers from Adaptrade Software, please join our email list. Thank you.


Join Our Email List
For Email Marketing you can trust



Copyright 2004-2015 Adaptrade Software. All rights reserved.