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.

16%

12%

7%

16%

15%

ChromoSlice(0)

ChromoSlice(1)

ChromoSlice(2)

ChromoSlice(3)

ChromoSlice(4)

ChromoSlice(5)

34%

FIGURE 8.3

Chromosome dartboard.

Creating Chromosome Dartboard—Using VBA Excel

236

GENETIC OPTIMIZATION, WALK FORWARD

For l = 0 To 5

Next l

chromoProb(l) = Fitness(l) / totalFitness

cumProb = cumProb + chromoProb(l)

'starting at 0 degrees in the pie/circle

'work clockwise defining the slices

'until the pie/circle is coverd by slices

chromoProbBin(l) = cumProb

'bin size = slize size

Once the dartboard is constructed, the next step is to start randomly throwing six

darts. Since blindfolded monkeys are hard to come by nowadays, the computer can

easily replicate one by using our handy RNG. So let’s proceed with the simulation

and see where the six darts land.

Dart(0) hits Slice(5)

Dart(1) hits Slice(1)

Dart(2) hits Slice(2)

Dart(3) hits Slice(5)

Dart(4) hits Slice(4)

Dart(5) hits Slice(2)

Simulating a Dart-Throwing Blindfolded Monkey

Using VBA Excel

'Generate 6 random numbers between 0 and 1

'These numbers represent the locations where

www.rasabourse.com

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

Saved successfully!

Ooh no, something went wrong!