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 6 darts landed

Randomize

For l = 0 To 5

roulette(l) = Rnd(1#)

Next l

For i = 0 To 5

whichBin = -1

'which slice did the dart land in?

For k = 0 To 4

'6 slices but only 5 bin boundaries ?

'if dart doesn't hit slices 1-5 then it must have

hit slice 0

If roulette(i) > chromoProbBin(k) And roulette(i) <=

chromoProbBin (k + 1) Then

whichBin = k + 1

End If

Next k

If whichBin = -1 Then whichBin = 0 'dart hit slice 0

Next i

After the six darts are thrown, the selection process is completed. Each dart

represents a chromosome, and where it lands is the chromosome that will replace

it. Here is the end result:

237

Chromosome(0) is discarded and is cloned to be Chromosome(5)

Chromosome(1) stays the same

Chromosome(2) stays the same

Chromosome(3) is discarded and is cloned to be Chromosome(5)

Chromosome(4) stays the same

Chromosome(5) is discarded and is cloned to be Chromosome(2)

Chromosome Replacement Function—Using VBA Excel

'Chromosome switching function

'Pass both chromosome tables/matrices into function

'inform the function which chromosome is replaced by which

chromosome

Public Sub switchChromo(tempChromoTable As Variant,

chromoTable As Variant, destArrNum, srcArrNum)

GENETIC OPTIMIZATION, WALK FORWARD

For i = 0 To 3

Next i

tempChromoTable(destArrNum, i) = chromoTable(srcArrNum, i)

www.rasabourse.com

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

Saved successfully!

Ooh no, something went wrong!