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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

This equation involves four unknowns and multiple solutions and can be easily

solved by trial and error. We could simply set a, c, and d equal to zero and set b

equal to 20 and be done with it. Remember, this is an oversimplified problem to

demonstrate the four core concepts of GA.

■ Population

There are four variables in our equation so continuing to borrow from biology let’s

create six chromosomes consisting of four values or genes that will be substituted

into the variables a, b, c, and d. Unlike real chromosomes, these will simply

be placeholders for the four different values of the variables (genes). Figure 8.2

illustrates our six amoeba-looking genes.

So the population will consist of six chromosomes that have four different genes

that can be swapped or mutated. Why six chromosomes instead of four, you may

ask? Just be patient; we will get to that. The initial population of chromosomes will

be generated using a random number generator (RNG). Each chromosome will be

defined by its genetic value, and these are the values that will be randomized. Values

between 0 and 30 for each gene will be initially generated in a random fashion. You

will soon discover that GA relies heavily on random numbers. This is yet another

similarity with nature—randomness. Here is the initial population generated by the

VBA software and its RNG:

Genes

Generation 1: Chromosome(0) = [10,11,20,19]

Chromosome(1) = [13,08,15,20]

Chromosome(2) = [00,20,05,09]

Chromosome(3) = [07,27,05,14]

Chromosome(4) = [10,30,30,04]

Chromosome(5) = [16,05,13,28]

10

11

20

19

13

08

15

20

00

20

05

09

07

27

05

14

10

30

30

04

16

05

13

28

231

GENETIC OPTIMIZATION, WALK FORWARD

FIGURE 8.2

An illustration of our chromosomes with different genetic values.

www.rasabourse.com

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

Saved successfully!

Ooh no, something went wrong!