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.

228

GENETIC OPTIMIZATION, WALK FORWARD

necessary, they are very simple to use, and with proper application a user can

make sure over-curve-fitting does not take place. Since I am somewhat of a newbie

to AmiBroker and in an attempt to cut down on redundancy, a good portion

of the concepts in this chapter will be illustrated with TradeStation’s tools. An

understanding of TradeStation, some EasyLanguage, and input optimization is

assumed. As you will see in the latter part of the chapter, the ideas and algorithms

will be translatable to AmiBroker and AFL.

The first part of this chapter explains the concept of a genetic algorithm, proceeds

to build one, and then shows how they can be used to optimize a trading algorithm.

The genetic algorithm development part is a little longer and requires a close

examination. Much of this discussion, including examples and processes, was taken

directly from Denny Hermawanto’s excellent paper titled, ‘‘Genetic Algorithm

for Solving Simple Mathematical Equality Problem.’’ Out of all the research used

in the writing of this chapter, Hermawanto’s description of genetic algorithms

was considered one of the easier to understand and implement. Understanding

what makes up a genetic algorithm is not necessary to use one. However, even a

slight understanding of how one works will eliminate the hesitation of using it and

eliminate its ‘‘voodoo’’ factor.

The second part of the chapter describes how a trading algorithm can be

automatically reoptimized periodically using the walk-forward optimizer (WFO) in

concert with genetic optimization. In addition to changing parameters periodically

based on algorithm performance going forward in time, the WFO also creates a

report that indicates the degree of the trading algorithm’s robustness. In other

words, what is the probability of the algorithm continuing to work?

Genetic Algorithms: What Are They?

The first question that needs to be answered is, Why use genetic algorithms (GA)

in the first place? The same question concerning walk-forward optimization (WFO)

will be answered in the second part of this chapter. TradeStation and AmiBroker

already have exhaustive search (ES) optimization engines built into their platforms.

In this chapter, the words searching and optimizing will be used interchangeably.

The ES optimization engine doesn’t use any sophistication in its search process,

just brute force. Why not just use this brute force approach if it looks at every

possible combination of variables and no stone is left unturned? It is true that this

feature is very powerful and can fulfill a good portion of a user’s optimization needs.

However, unlike genetic algorithms, there is a limit to the number of variables

(inputs) and their respective iterations that can be optimized in a sequential manner.

GA has limitations as well, but they are very large—large in the sense that a

super-large amount of data would be necessary to limit their effectiveness. The

major limitation to a brute force approach is, of course, time. Even with today’s

www.rasabourse.com

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

Saved successfully!

Ooh no, something went wrong!