How to Set Profit Targets and Control Losses: Statistical Analysis Can Be Used to Collect the Data Needed to Build a Proper Risk Management Framework. Here, We Show How to Apply It-And Discuss the Lessons Learned
Rosenthal, Neil, Modern Trader
In the first installment of this series, we introduced a random entry system that based its entries on a virtual coin flip (see "Guide to trading system development," September 2012). The base system was backtested across four years of euro forex data to gather trade data for statistical analysis. As we saw, the base system was unprofitable. In mathematical terms, the base system has a negative expectancy of -0.81.
Expectancy is an important metric. It is the amount you can expect to win or lose for every dollar risked. It is calculated with the following formula:
(Winning percentage x Average win) - (Losing percentage x Average loss)
That is, the system loses 81C for every dollar risked. The astute reader likely recognized this aspect of the system as a stumbling block that often trips up the beginning system trader: It is unlikely, if not impossible, that a system with a negative expectancy can be made profitable through trade management. As it turns out, this system is unprofitable regardless of any stop loss or profit target that may be added.
This does not mean the system necessarily should be discarded. It often is the case that, though the first version fails, an adjustment to some aspect of it may result in a profitable system. In this case, there is another parameter of our demonstration system that can be adjusted: The entry time.
The 8 a.m. (EST) entry was chosen arbitrarily. This may be the critical variable that can salvage our model and allow system development to proceed. Indeed, this turns out to be the case. A simple optimization of the entry time (stepping from 3 a.m., EST, the London open, through 8 a.m., EST, in one-hour increments) creates a profitable system. When backtested across the same data, an entry time of 4 a.m. produces a net profit of $2,853. Expectancy is a positive 2.75. Now we can apply trade management techniques to see if we can improve the results.
If a system is backtested across an entire historical data series, the results of such tests will indicate only how the system would have fared had it been operational during the time period covered by the historical data. The results tell us nothing about how the system will fare going forward in real time.
One way to address this limitation is walk-forward analysis and optimization, popularized within the trading community by Robert Pardo. With this approach, the historical data are broken up into smaller periods of time. The system then can be backtested and optimized against just a portion of data, called the in-sample data. After the system parameters have been optimized, it then can be tested on the portion of the data that immediately follows, or the out-of-sample data.
The out-of-sample data period usually is a percentage of the in-sample data period. The results of the out-of-sample tests are recorded. The process then is repeated by "sliding forward" the in-sample data period and then re-optimizing the parameters. The amount by which the in-sample data is slid forward is equal to the length of the initial out-of-sample data period (see "Walk-forward testing," right).
In the chart, the in-sample data period is six months and the out-of-sample data period is two months. The first optimization is run on the data from January through June. The test is run on the data from July through August. The out-of-sample results are recorded. The in-sample data period then slides forward by two months. A new optimization is run and the parameters are re-set accordingly. Another out-of-sample test is run September through October.
This walk forward through the data removes some of the limitations of basic backtesting. Profitable results from this method of testing should provide a higher level of confidence in the system when traded in real time in a live account.
Setting our stop
The next phase of development of the trading system is to add risk management in the form of the initial stop loss (ISL). …