What is Walk Forward Analysis?

Walk forward anaylsis is the process of optimizing a trading system using a limited set of parameters, and then testing the best optimized parameter set on out-of-sample data. This is similar to how you would use your expert advisor in live trading. The principles of walk forward analysis were first described in the book The Evaluation and Optimization of Trading Strategies by Robert Pardo.

To perform a walk forward analysis in MetaTrader, first optimize the expert advisor in the Strategy Tester. Then, choose the most profitable result in the Optimization Results tab, and perform a backtest it over a time period immediately following the optimization period. The end date of the optimization period is the same as the start date of the testing period. This process is repeated over and over until a satisfactory sample size is achieved.

If the expert advisor performs well in testing, relative to the optimization results, then one can conclude that the expert advisor will likely be profitable in live trading. If, on the other hand, the expert advisor performs poorly in testing, then either the optimization parameters or the length of the testing and optimization periods will need to be adjusted. If, after many attempts, the expert advisor still does not perform well in the testing, then it can be concluded that the trading system is unprofitable.

Walk Forward Analysis

The animation to the right illustrates the walk forward analysis procedure. An optimization is performed over a longer period (the in-sample data), and then the optimized parameter set is tested over a subsequent shorter period (the out-of-sample data). The optimization and testing periods are shifted forward, and the process is repeated until a suitable sample size is acheived. [Source]

An Example of a Walk Forward Analysis

Let's provide a real-life example: We're going to do a walk forward analysis on an expert advisor, using EURUSD M30. We'll optimize this expert advisor over a period of 120 days. We've chosen the 3 or 4 most important parameters to optimize, so as not to over-optimize or "curve fit" the results. Also, fewer parameters means a quicker test.

We'll select the most profitable result, and backtest those parameters over a 30 day period immediately following the optimization period. It is recommended to use a testing period of approximately 25% of the length of the optimization period. Once we've recorded our results, we'll move the next optimization and testing period forward by 30 days.

After 12 consecutive rounds of optimization and testing, we'll have a year's worth of walk forward analysis data. We compare the average daily profit for the optimization periods to the average daily profit for the testing periods. This will give us a calculation called the walk forward efficiency ratio.

A walk forward efficiency ratio greater than 0.5 is considered a very good result. This is what we call a robust trading system. However, an expert advisor is tradeable as long as it is consistently profitable over multiple testing periods. If the walk forward efficiency ratio is negative, then that means that the expert advisor did not perform well relative to it's optimization results.

Of course, you can do a walk forward analysis manually in MetaTrader's Strategy Tester. But the process is tedious, time-consuming and prone to error. This is where the Walk Forward Analyzer software comes in. The program will automatically perform a walk forward analysis using MetaTrader's Strategy Tester over any length of time, with only a few settings provided by the user.

Copyright © 2010-13 EasyExpertForex.com