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.

TradeStation’s and AmiBroker’s genetic optimization tool is a very important

tool in the development of robust trading algorithms. Hopefully, this first part has

demystified genetic algorithms and provided sufficient evidence that it can help a

trader develop a better mousetrap—one that catches the mouse more often than not.

■ Walk-Forward Optimizer: Is It Worth the Extra

Work and Time?

The idea of periodic reoptimization of a trading system’s parameters is the one

concept that divides the algorithmic trading community more so than any other. You

are either pro or con; there is very little middle ground. Walk-forward optimization

(WFO) has been around since the beginning of trading algorithms but until lately it

has been extremely difficult to implement. TradeStation has done a wonderful job

in providing the TS walk-forward optimizer. It does all the work for you.

Before describing the potential benefits of WFO, the concept and process needs

to be explained. In a nutshell, it is a technique in which a system’s parameters

are optimized on a segment of historical data (in-sample), then tested and verified

by using those parameters on a walk-forward basis (out-of-sample). Results from

in-sample testing will usually be very good due to the benefit of hindsight. It’s the

results from testing on unseen data that provides a true reflection of a system’s

validity. This process is done periodically in hopes the trading algorithm will be

using the most optimal parameters available at any given time.

WFO Example 1

Another example will definitely help explain the concept. Take a Turtle-like system

that buys at the highest high of the past 40 days and sells at the lowest low of the

past 40 days. Throughout history, there have been times when a longer (greater

than 40-day) breakout or a shorter (less than 40-day) worked better. The magic

questions are, of course, when to change the length of the breakouts, and by how

much? These questions are easily answered with the use of a time machine.

Assume a trader trades this Turtle-like system for two years and it is somewhat

profitable. Being an inquisitive trader he asks, ‘‘Was a 40-day break the best option?’’

An optimization run is set up and the 40-day parameter is optimized over the past

two years of data, and lo and behold, the trader finds out that a 30-day breakout

produced twice as much profit with much less drawdown. With this knowledge, he

changes the trading algorithm to utilize a 30-day breakout in place of the 40-day.

Another two profitable years go by, and he again asks the same question. This

time, the best parameter turned out be the exact one he had implemented; 30

turned out to be the optimal parameter. He then carries the parameter forward

another two years, but this time he suffers a large loss and a severe drawdown.

249

GENETIC OPTIMIZATION, WALK FORWARD

www.rasabourse.com

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

Saved successfully!

Ooh no, something went wrong!