Applied stochastic models in business and industry. Stock timing using genetic algorithms, страница 4

8>><1     if rule i gives ‘buy’ dik ¼    0:5            if rule i gives ‘do nothing’

                                                         >>:0       otherwise

For expert k; the valuation function is worthPN eki : fðekÞ ¼ ðPni¼k 1 dikÞ=nk; where nk is the number of rules used by expert k; that is nk ¼ i¼1

As an expert has only one decision to take at each date, a threshold s 2 ½0;0:5 is defined by the user so that, if fðrÞ5s ð> 1  sÞ; then the final decision is to sell or buy; in other cases, nothing is done.

For example, let e ¼ 001101 and assume that two rules advise buying and one advises doing nothing. The valuation function fðeÞ is equal to 2:5=3 ¼ 0:833: The final decision is to buy the security as long as fðeÞ51  s if, for example, s is equal to 0:25:

The threshold can be linked to the risk aversion of the expert; for low levels of s; the probability of doing nothing is high because the interval ½s;1  s is large. Consequently, the strategy is conservative and the expert does not transact frequently. Conversely, if s is near 0:5; almost all the decisions will be buy or sell. It is important to mention that a high frequency of trades is penalized by transaction costs borne by an investor each time he trades on the market.

The performance of an expert is evaluated during a learning period and compared to an optimal expert, for example an investor knowing the future prices and always taking the right decision (but other criteria can be also chosen).

The purpose of a genetic algorithm is to evolve the performance by creating several generations of experts, each one being generated from the preceding ones by genetic operators such as selection, crossover, mutation and replacement (reinsertion). The dynamic process is stopped when the homogeneity of the population becomes either very high after a fixed number of generations, or when a satisfactory level of performance is reached.

3.2.  Genetic operators

Selection. At the beginning of the process, m experts are generated at random (for example m ¼ 50Þ: They perform differently, based on their own rules (genes), evaluated by a valuation function. For instance, this function for expert k can be defined as

E kÞ ¼ 1  PTt¼0 jpt0  ptkj ðe           

T

where pt0 is the optimal performance realized by the clear-sighted expert at date t and ptk is the same criterion evaluated for the kth expert.

E allows for the ranking of experts and the selection of those who generate the best results. E can then be transformed into the fitness function: This function should be well-tailored to the optimization problem. In our software, the user can choose various optimization criteria: the return on investment, the percentage accuracy as explained above, the level of risk, the maximum consecutive loss, or indeed a combination of all these criteria.

The goal of the research is to discover an expert (a set of trading rules) who would provide the maximum return on investment within the learning and testing periods weighted by the percentage accuracy. The weighting factor is added because it was observed that many highly profitable experts were not the best in terms of percentage of optimal trades. Moreover, experts who generated significant profits in some periods also caused large losses or consecutive losing trades in other periods. Therefore, these experts have to be penalized by the fitness function.

The selection operation chooses experts from the population based on their fitness. The fitness is the value assigned to an expert by the fitness function that measures the strength of a given expert in relation to the others in the population. There are several ways of dealing with the selection of experts [5,16,18]. The most well-known selection strategy is the roulette wheel in which the probability for an expert to be selected for the next generation is proportional to the value of the fitness function. The result of the selection is a mating pool, a set of experts to be used by the crossover operation.