From the February 01, 2010 issue of Futures Magazine • Subscribe!

Using DOE method in trading

Automated trading systems, especially those based on technical indicators, are all the rage. Such systems are highly dependent on settings, such as moving average periods, which are usually determined in unsystematic fashion. Some are set by tradition, such as only going long when an index is above a 200-day moving average. Others are found by brute-force backtesting, generally by what is called “single-factor design,” in which each setting is tested on its own.

All of these methods fail to capture the interconnectedness of the settings, and are not likely to find something optimal. Indeed, these methods usually sift through many attempts before finding one that generates any profit at all.

One systematic method that avoids these problems is the grid search method. However, this is not generally used, and for good reason. For the five-factor model, discussed here, computer runs covering the parameter space could run into the millions. For some types of trading systems, this might take weeks or even months for a single investigation.

The Design of Experiments (DOE) method solves all of these problems.


To implement the DOE method, first, a set of points in the parameter space is selected based on a statistical criterion — 56 points plus six additional ones for the experiment discussed here. Runs are conducted at each of those set of points and an outcome, profit/loss in this case, is recorded.

Then, a polynomial function is fit to the outcome data; the trial points are the independent variables, and the outcome is the dependent variable. This allows us to express the outcome, the profit/loss, as a simple calculation throughout the entire parameter space called a response surface. Finally, one of several types of hill-climbing methods can be applied to the response surface to find the “sweet spot” — the optimal parameter settings.

For our problem here, a single run on 20 years of historical data takes 0.25 seconds to run on a typical PC. A grid search on the entire parameter space with resolution of one decimal place would require 43 million runs, which at a quarter of a second each comes to 17.7 weeks. On the other hand, for the DOE optimization, the 62 points in the parameter space require 12.84 seconds, and the hill-climbing for the sweet spot is another 45 seconds. This 58-second investment of time is a lot more efficient than one taking 17.7 weeks.

Not only does the DOE approach make it possible to find optimal settings quickly and easily, but it finds those that take into account the relationships among the parameter settings in producing the outcome. This dramatic increase in efficiency also has another important benefit — researchers can test modifications to the structure of the trading system itself. For example, should the system employ a simple average, a moving average or an exponential moving average? A conclusion to that question can be found directly by repeating the trial runs and the hill-climbing for each method. In the case of the problem we’re discussing here, the total would be three minutes.

The polynomial model used for the problem in the paper is a cubic. The cubic response surface has a greater ability to fit observed outcomes, but it also contains a lot of terms relative to the number of factors that require many trial runs. For a problem with run times of a second or two, this isn’t difficult. For trading systems with longer run times — for example, those of an hour or so — a simpler polynomial model, such as a quadratic or an interactive (a polynomial without the power terms), can be used that requires fewer trial runs. A comprehensive grid search for one-hour trial runs is completely out of the question, but a quadratic model with 15 one-hour trial runs is feasible.


On page 96 of “Short Term Trading Strategies That Work,” Connors and Alvarez describe a trading system for the SPY:

1. The S&P 500 (SPY) is above its 200-period moving average.

2. The two-period relative strength index (RSI) of the Volatility Index (Vix) is greater than 90.

3. Today’s Vix open is greater than yesterday’s close.

4. The two-period RSI of the SPY is below 30.

5. Buy on the close.

6. Exit when the two-period RSI of the SPY closes above 65.

The motivation for this system is to use the Vix to detect a weak and oversold market. In a backtest on three-and-a-half years of data, the authors found 92 signals with an average hold under five days and a frequency of success of 79.35%.


The trading system above contains five factors:

1. Period of the SPY moving average

2. RSI setting of the Vix

3. RSI setting of the SPY

4. Exit setting of the SPY RSI

5. Period of the RSI

comments powered by Disqus