Genetic optimization. Application in TradeStation environment.: Genetic Algorithms
The given publication was presented by
Vladislav Gorbunov (one of the founders of Trade Smart Research Ltd.)
in system trading conference in Moscow, Russia, 2004.
Genetic optimization. Application in TradeStation environment.
Some time ago people noticed that some processes in nature are very effectively arranged.
Algorithms in question are based on natural selection in wild nature.
It is the modeling of natural selection.
Genetic Algorithms are adaptive methods of extremum seeking.
Recently they were frequently used for solving the optimization tasks.
They are based on imitation of evolution in wild nature:
biological populations evolve during some time,
obeying the natural selection law discovered by Charles Darvin and only fittest survive.
Genetic algorithms imitate this process and they are able to solve real tasks if these ones are properly encoded.
Basic principles of GA’s were formulated by Holland (Holland, 1975) and described in many papers.
In contrast to the natural evolution GA’s model only those processes in populations that are essential for the evolution.
Which processes are essential for evolution and which are not is still an open question for the researchers.
Let’s consider basic terms used in this paper
Let’s describe each of them with reference to tasks connected with trading systems.
Gene – it is one of the system’s parameters which could be optimized. Type of moving average, averaging period or some parameter or coefficient of the digital filter, for example, etc.
Chromosome – it is group of genes (parameters) that have logical connection with each other, parameters of one type of input or one signal. This group participates in crossover as a whole, i.e. it is a set of parameters which can migrate between specimens as a whole. Thus successful combinations of genes have better chances to survive and reproduce. It is appropriate to combine connected parameters (of one signal for instance) into one chromosome.
Fitness - criterion of profit or suitability of specimen, the criterion function. It is some value that is connected with the specific trading system. By the means of fitness we report to genetic optimizer how much we are satisfied with that trading system. The greater it is – the better is the specimen. In simplest case it can be
NetProfit or ProfitFactor, as in original optimization used in TradeStation for example, but we suppose that it is not correct. Results obtained with use of such simple criterions hardly can be stable. In our case user defines himself what is “vitality” of specimen (trading system). In fact one can get trading system that will show stable results in future only due to proper choice of optimization criterion.
Population – it is group of survived till present moment best specimens selected by best fitness. Usually trading systems are built in such way that “population” consists of most “vital”, stable systems.
Crossover – it is replacement of genes to analogous ones from another specimen or replacement of chromosome to analogous from another specimen of population.
Mutation – it is random change of some genes (parameters of system).
Scheme of genetic algorithm work:
Genetic algorithm for TradeStation is quite simple for users. After initialization optimizer begins to pass sets of parameters to the system being optimized. After completion of processing of historical data system reports to optimizer the result, i.e. fitness value. On the basis of obtained results optimizer forms the current population consisting of best specimens. After that optimizer applies crossover and mutation and forms new set of parameters for testing. Then system with those parameters runs again on data in question. Then fitness is compared with already existing ones of other specimens. If last fitness is better than previous then “weak” ones are replaced. On the other hand if last computed fitness is “weaker” than already existing ones then it is deleted from population (it remains for the first run) and we search for a new specimen (change parameters of the system), and so on until the search is completed.