31.07.2021 Views

Ultimate Algorithmic Trading System

Using automated systems for trading in stock markets

Using automated systems for trading in stock markets

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

234

GENETIC OPTIMIZATION, WALK FORWARD

With this in mind you have a one-in-six chance of rolling a six or a probability of

16.6666667 percent.

P = Possible favorable outcomes / Potential outcomes

P = 1/6, or 16.6666667%

Keep in mind probabilities are the cornerstone of GA as well as trading algorithms.

Okay, now on to our selection process. Remember, we need to nudge the

computer into making the right decision. The computer will, in effect, roll the dice

to choose which chromosome will be carried into the next step for reproduction. If

this is a random event, then how do we nudge the computer’s decision? Think of a

dartboard that has six slices and the slices are the same size. Now assume you train a

monkey to throw darts while blindfolded at the dartboard. Also, it is important to

assume he always hits the dartboard. The monkey has a one-in-six chance of hitting

a particular slice. What if the slices were not the same size? Then he would have a

higher probability of hitting the larger slices. This is the concept that will be used

to nudge the computer’s selection; the more fit chromosomes will get the bigger

slices. Here again, we must let the computer decide the sizes of the slices but we

can feed it a formula that will give priority to the more fit chromosomes. The first

step is to calculate the fitness of each chromosome in terms of the size of the slice.

This is a very simple formula as well:

Chromosome[slice size] =1 ∕(1 + ABS(Chromosome[fitness] –40))

Notice how we use the ABS (absolute value) function in our formula. This function

simply removes a negative sign from the difference between a chromosome’s fitness

and our objective of 40; we don’t want to have a negative-sized slice. We subtract

40 from each chromosome’s fitness because we need to put the fitness in terms

of our objective; the closer we are the smaller the fitness value. Since we want to

allocate a bigger slice to chromosomes that are closer to our solution we divide

one by our fitness score. In doing so, we are making the size of each slice inversely

proportional to the fitness score; a lower fitness value (or closer value to 40) will

increase size. The number 1 is also added in the denominator to prevent division by

zero; computers hate division by zero. Utilizing the above formula we come up with:

Fitness 1 in terms of slice size:

Chromosome (0) = 1/(1+ 71) = 0.01389

Chromosome (1) = 1/(1+ 54) = 0.01812

Chromosome (2) = 1/(1+ 24) = 0.04000

Chromosome (3) = 1/(1+ 50) = 0.01961

Chromosome (4) = 1/(1+124) = 0.00800

Chromosome (5) = 1/(1+ 53) = 0.01852

www.rasabourse.com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!