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.

Walk-Forward Test Procedure

1998 1999 2000 2001

2002 2003 2004 2005 2006 2007 2008

In-sample data (IS) - Optimization

Out-of-sample data (OOS) - Verification (backtest)

106

COMPLETE TRADING ALGORITHMS

FIGURE 3.4 Walk-forward testing begins with a backtest used to derive the desired parameter.

Then, it applies that parameter going forward.

Source: AmiBroker

AmiBroker’s walk-forward optimizer (WFO) derived the best parameter set from

January 1, 2006, to January 1, 2010, and then carried those parameters forward

from January 1, 2010, to January 1, 2011. In this test, the algorithm netted $35,330

for 2010. It then included 2010 and backed up to January 1, 2007, and then carried

those parameters forward through 2011. However, this time the algorithm lost a

whopping −$56,532. Keep stepping through the figure and you can see how the

system performed through the present. What’s really interesting is the shift in the

parameter sets. You would think by adding just another year to the backtest during

the periodic readjustment the parameters wouldn’t shift that much. Take a look at

Figures 3.5 and 3.6.

The first year in our OOS window is 2010. The WFO picked the parameter

set [72 day, 1.5 std. devs., 3000 stop] to apply to 2010 and the results looked

great. Notice the wide shift in the parameters for 2011 [111, 0.25, 6000]. These

parameters performed horribly, losing over $56,000. The parameters for 2012

shifted some more [143, 0.25, 3500]. These parameters didn’t do much better.

2013 also shows a dramatic shift, [45, 3, 3500], but at least the algorithm made

a little money. The parameter set stayed constant for 2014, and the algorithm

really brought it home, with almost $72,000 in profit. The end result with periodic

reoptimization beat the pants off of the static set with $45,000 in profit and a little

www.rasabourse.com

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

Saved successfully!

Ooh no, something went wrong!