Genetic Programming in Stock analysis

Genetic Programming is somewhat similar to Genetic Algorithms.

In GA we bred individuals representing values while in GP we bred trees representing small computer programs, circuits or expressions.

In both methods we use genetic operators like cross operator and we get two random individuals – parents and we produce offspring. The silent assumption is that a child of parents with better fitness is better then a child of parents with lower fitness.

Evaluating offspring in GA is based on using values represented by this individuals. Evaluating offspring in GP is based on execution of program represented by given tree, simulating circuit, or evaluating expressions.

The best know authority of GP is John Koza.

GP in stock market analysis can be used in symbolic regression. We can try to find a formula for predicting the future value of an indicator using this same or other indicator values.

At first we have to define a set of functions, for example:

returning values of indicators at given days:

FX(0) – today fx indicator value
FX(-n) – value of fx n days ago

DJ (1) – tomorrow Dow Jones value
DJ (-m) – Dow Jones value m days ago

diff(DJ, -10, -5) – difference of DJ indicator in 5 days ago and 10 days ago

some mathematical functions


some logical functions

Run our program and see what happen.

Leave a Reply

Your email address will not be published. Required fields are marked *