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.

selection and reproduction may eventually converge and produce a nondiverse

population. Mutation can randomly change a genetic element and then like a chain

reaction create different selections and reproductions.

Before we mutate the initial population, let’s review our chromosome population

as it stood after our first selection and reproduction phase:

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

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

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

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

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

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

The rate of mutation should be low because you do want a convergence to

occur. In other words, you want a solution, and a high mutation rate could

potentially spin the population off into too many different directions. But at the

same time, you don’t want your population growing stale, either, and a sufficiently

high mutation rate prevents this. In this example, a mutation rate of 10 percent

was used. With six chromosomes, there are 24 genes or numbers total, so if the

mutation rate of 10 percent is applied, then 2.4 genes will be mutated. Since we

can’t have a partial gene, the number is rounded down to two. So out of the

24 numbers above, 2 of them will be randomly selected and replaced with two

random numbers between 0 and 30 (the same range that we initially used to seed

the population).

Each gene is assigned a number between 1 and 24 in order. So chromosome (0)

will have genes labeled 1 through 4. Chromosome (1) will have genes 5 through

8, and so on. Relying on the random number generator yet again (range between

1 and 24), it generates two numbers: 7 and 24. Don’t put the random number

generator away yet; we still need to randomize two more numbers between

0 and 30 to use in our mutation. After pushing the button on the RNG, two

numbers, 22 and 15, were generated. If we map 7 and 24 across the matrix of

chromosomes, then the following highlighted genes will be mutated with the

numbers 22 and 15:

Chromosome (0): 16 1 05 2 13 3 28 4

Chromosome (1): 13 5 08 6 22 7 20 8

Chromosome (2): 00 9 30 10 30 11 04 12

Chromosome (3): 16 13 05 14 13 15 28 16

Chromosome (4): 10 17 30 18 30 19 04 20

Chromosome (5): 00 21 20 22 05 23 15 24

241

GENETIC OPTIMIZATION, WALK FORWARD

www.rasabourse.com

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

Saved successfully!

Ooh no, something went wrong!