Going for the Gold-Automatically: After Explaining in the Last Issue How Technology Can Now Build Trading Systems for You, We Will Demonstrate How This Works by Building and Detailing a Trading System for Gold Futures Using This Automated Process

Article excerpt

As computers have increased in speed and functionality, more steps of the trading process have become automated. Now, advances in software design are pushing those limits even further, so much so that even the process of building a trading system itself can be done with little human input.

Last month, we showed how these new tools operate. This month, we put them to work in the gold market.

First, we need to extract and preprocess the data necessary for our trading system from our sample market; in this case we'll use gold futures. We do this by running a special trading system in data extraction mode (see "Digging for data," right).

Before we start our automation run, we need to feed the computer some basic information setting ground rules for the automated process. We input data such as big point value, account size, minimum fluctuation value and which performance statistic we want the software to monitor. After just a couple minutes of processing time, we can see how the evolved equity curve is becoming profitable (see "Getting there," right).

After just a few minutes of run time, more than 30,760 trading systems were developed. Again, these are not individual optimizations of a few trading systems. These are entirely different systems, logically and parametrically. The AIM-GP moves blocks of evolved code around the evolutionary environment formulating new and unique trading systems.

The system produced positive performance in both training and out-of-sample testing (you can find these performance numbers on the "downloads" section of www.Futuresmag.com). The out-of-sample testing reflects the robustness of the trading system because there was no significant drop off in performance. Remember, we are not forecasting the direction of the market to some point in the future, but we're measuring how well our evolved trading system performs on both in-sample data and out-of-sample data.

Many developers limit or eliminate out-of-sample testing, and therefore their trading systems usually fall apart as they are used into the future. Also, note that our results could be improved with more runs. Indeed, simply rerunning the same test again will often result in improved performance. This is due to initialized random seeds and the random effects of evolution. One simple random mutation can make improvements.

Throughout the long haul, if our input set contributes to the general robustness of an evolved trading system and if the evolutionary algorithm converges properly, more runs will show good results than will show poor results; and a robust trading system will emerge quickly, very possibly on the first run.

As a last step, we will translate the Genetic Program generated C code into EasyLanguage and run our trading system in TradeStation. The results of the final trading system are shown in "Final run" (page 47).

INSIDE THE SYSTEM

Lets look at our example, the evolved EasyLanguage program shown in "Heart of the system" (page 46). The AIM-GP ignored 56 of the 62 inputs, making use of only six: v1[6], v1[11], v1[23], v1[25], v1[29] and v1[33].

These inputs are defined below:

  v1[6] = low > low[1] and low[1] >
low[2] and high > high[1] and high[1]
> high[2];
  v1[11] = atr11 < atr22;
  v1[23] = close < lowest (close, 4) +
rng*sdv*3;
  v1[25] = high>high[1];
  v1[29] = high>high[3];
  v1[33] = close>=close[1];

Where:

  atr11 = average(range, 8);
  atr22 = average(truerange, 20);
  rng = Highest(high, 4) -
Lowest(low, 4);
  rng3 = Highest(high, 10) -
Lowest(low, 10);
  LR = LinearRegValue(close, 10, 0);
  Sdv = StdDev((close-LR), 10)/rng3;

After a few applications of square root, addition, subtraction, multiplication and absolute value, we have our trading system.

Looking at the evolved code, we see that machine-learning code is quite different from traditional human-supplied code. …