The fitness function is a formula producing a single number for each population member. The program assigns a number to each member and ranks the population from least to most fit. The least fit members die off and the most fit members live on to reproduce. The program calculates the total profit of each population member and then subtracts other factors such as the drawdown. A population member with a very high profit may also have a large drawdown. Another candidate may have less profit but a lower drawdown and be rated higher in fitness than the first member.
Population members with good fitness scores continue to live. Lesser members drop off the map—just like natural evolution. Wooly mammoths are gone but elephants live on. It has worked well in the natural world and over the last few decades, with the advent of modern computer techniques, it has been applied to mechanical and mathematical creations.
See genetic programming in operation. Download the free trial version of the program.
In one area of the program it selects two population members with good fitness and therefore, the potential to be even better. As an example, the following two signals might be selected to participate in a crossover:
The MACD is greater than 0 AND the 120-period Simple Moving Average of the low is greater than the lowThe 9-period Relative Strength Index is greater than 10 AND the 9-period ADXR is greater than 25In a crossover operation one term in the first rule is exchanged for a term in the second rule. The resulting pair might then be:
The MACD is greater than 0 AND the 9-period ADXR is greater than 25The 9-period Relative Strength Index is greater than 10 AND the 120-period Simple Moving Average of the low is greater than the lowThe MACD is greater than 0 AND the 120-period Simple Moving Average of the low is greater than the low
The MACD is greater than 0 AND the 120-period Simple Moving Average of the low is greater than the close.
The change of the comparison term from the low to the closing price is subtle but may be enough to push the rule set to a higher fitness number.
The MACD is greater than 0 AND the 120-period Simple Moving Average of the low is greater than the close
The program may change it to:
The MACD is greater than 0 AND the 130-period Simple Moving Average of the low is greater than the close