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.

The new population after selection is:

Chromosome(0) =[16,05,13,28] =93–40 = 53

Chromosome(1) =[13,08,15,20] =94–40 = 54

Chromosome(2) =[00,20,05,09] =64–40 = 24

Chromosome(3) =[16,05,13,28] =93–40 = 53

Chromosome(4) =[10,30,30,04] =164–40 = 124

Chromosome(5) =[00,20,05,09] =64–40 = 24

The somewhat fit chromosome (3) was discarded and the worst chromosome

(4) was carried over. The fifth worst chromosome (0) was discarded and cloned by

the third best chromosome (5). Chromosome (3) was cloned with the third best

chromosome (5). Chromosome (5) was then discarded and cloned with the best

chromosome (2). The formula tried its best to nudge the computer into making the

right decision, but due to the random component the worst candidate was kept. The

other chromosomes were somewhat upgraded.

■ Reproduction

238

GENETIC OPTIMIZATION, WALK FORWARD

Now that we have our parent pool, we can start the reproduction process. Some

of the parents are from the original population and some are clones, and that is

okay. The next step is to pick the parents that will produce offspring. The computer

will allow you to input the cross rate (partner matching probability), and in this

example, 40 percent was used. The computer will randomly generate six numbers

between 0 and 100, and every time a number less than or equal to 40 is generated,

it designates a crossing of two parents. In this example, the computer generated a

random number for each chromosome. Out of the six random numbers, only two

were less than or equal to 40. The random numbers were generated sequentially,

and random number (2) and random number (4) met our criteria and were less than

or equal to 40. With this information, the computer chose chromosome (2) and

chromosome (4) to cross/reproduce.

Crossing Chromosomes/Finding Moms and Pops—Using

VBA Excel

'Determine which chromosomes will cross

'using a .4 or 40% cross rate

crossRate = 0.4

For i = 0 To 5

crossArr(i) = 0

Randomize

www.rasabourse.com

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

Saved successfully!

Ooh no, something went wrong!