From the September 01, 2012 issue of Futures Magazine • Subscribe!

Guide to trading system development

Data collection

Our next step is to lay down the framework for the test that will collect data for further analysis. The starting hypothetical account balance is $10,000. Trade size is standardized at one $10,000 lot (one mini-lot), with a pip value of $1.

The EA has been programmed to gather the following data for each trade: Bars since entry, highest trade high, bars to highest trade high, lowest trade low, bars to lowest trade low, maximum adverse excursion (MAE) and maximum favorable excursion (MFE). The system exports this data to comma-separated value (CSV) text files. CSV files can be imported into any spreadsheet program for analysis. For the analysis presented here, Microsoft Excel was used, but the open-source (and free) OpenOffice Calc (www.openoffice.org) spreadsheet program works just the same.

MAE and MFE play an important role in our analysis. MAE is the greatest distance the market travels against the trade. MFE is the greatest distance the market travels in favor of the trade. For example, suppose the system entered the euro long at 1.5000. Between the time of entry and the automatic end-of-day exit, the market moved down to 1.4950 and up to 1.5075. The greatest distance the market moved against the long position, or MAE, is 1.5000 – 1.4950 = 0.0050, or 50 pips. The greatest distance the market moved in favor of the trade, or MFE, is 1.5075 – 1.5000 = 0.0075, or 75 pips. These two measurements can give us a basis for setting the ISL and the PT.

MT4 has a backtesting module called the Strategy Tester. We load our EA into the Strategy Tester and run the test. In addition to the data file exported by the EA, the Strategy Tester produces a backtesting report that contains all the usual test metrics (net profit, win/loss percentage, maximum drawdown, etc.) and a system equity graph. The report data will be used to compare each version of the system and will allow us to track our development progress.

We will assume that our EA already has been tested fully to ensure that its logic is correct. The system is entering and exiting trades as expected, and our data are exporting properly. Using the Strategy Tester, the EA was tested on four years (Jan. 1, 2008, to Dec. 31, 2011) of historical EUR/USD data. At the end of the test run our CSV file is complete, the spreadsheet program is launched and the data are imported.

Now we can perform our statistical analysis. The measurements we’re looking for are rather simple: The mean, the median and the standard deviation of the MAE and the MFE.

Comments
comments powered by Disqus