Rule 6: Fully Mechanical System
Thursday, 23 April 2009
The simplest answer to why a system must be mechanical is that you cannot test a discretionary system over historical data. It is impossible to forecast what market conditions you will face in future and how you will react to those conditions. Therefore, in this book, we will restrict our¬selves to fully mechanical systems.
If you can define how you make discretionary decisions, then these rules could be formalized and tested. The process of formalization could itself provide many interesting ideas for further testing. Hence you are encouraged to move toward
mechanical systems.
You are more likely to make consistent trading decisions if you use mechanical systems. The manner in which a mechanical system will process price data is predictable, and hence assures that you will make consistent trading decisions. However, there is no assurance that these logically consistent decisions will also be consistently profitable. Nor is there any assurance that these trading decisions will be implemented without modification by the trader.
Rule 5: Risk Control, Money Management, and Portfolio Design
All traders have accounts of finite size as well as written or unwritten guidelines for expected performance over the immediate future.
These performance guidelines have a great influence over the existence and longevity of an account. For example, consider a trading system that produces a 30 percent loss over five months. The same trading system then goes on to perform extremely well. One person may close the ac-count after the 30 percent draw down. Another may go on to reap excel-lent returns. Your money management rules could cause you to close out an account too soon, or keep it open too long. Thus, money management guidelines are crucial to trading success.
Given performance expectations and finite size of the trading ac-count, it is essential to maintain good risk control, sensible money management, and good portfolio design. Risk control is the process of man-aging open trades with predefined exit orders. Money management rules determine how many contracts to trade in a given market and the amount of money to risk on particular positions. Portfolio-level issues must be considered to obtain a smoother equity curve.
As expected, the largest losing trade can be horrifying, and most real-world accounts would probably close before swallowing such huge losses. Of course, recent headlines of billion-dollar plus losses in sophisticated trading firms illustrate that trading without adequate risk control is not uncommon.
Adding a money management stop constrains the worst initial loss to predictable levels. Even with slippage, the largest loss is usually lower than trading without any stop at all. Thus, your profitability is likely to improve with improved risk control. Observe that average net profits improved from a loss of -$5,085 with no stop to a loss of -$424 using risk control. The maximum drawdown also improved with the added risk control. The lesson from this comparison is clear. There is much to gain if you use proper risk control.
You can reduce swings in equity and improve account longevity if you combine risk control with sound money management ideas. Your money management guidelines will specify how much of your equity to risk on any trade. These guidelines convert the initial stop into a specific percentage of your equity. One common rule of thumb is to risk or "bet" just 2 percent of your account equity per trade.
The 2-percent rule converts into a $1,000 initial stop for a $50,000 account. This $1,000 initial stop is often called a "hard dollar stop," ap-plied to the entire position. A position could have one or more con-tracts. Thus, if you had two contracts, you would protect the position with a stop loss order placed $500 away from the entry price.
Over trading an account is a common problem cited by analysts for many account closures. For example, if you consistently bet more than 2 percent per trade, you are over trading an account. If you do not use any initial money management stop, then the risk could be much greater than 2 percent of equity. In the worst case, you risk your entire account equity. Some extra risk, say up to 5 percent of equity, may be justified if the market presents an extraordinary market opportunity (see chapter 4). However, consistently exceeding the 2 percent limit can cause large and unforeseen swings in account equity.
As another rule of thumb, you are over trading an account if the monthly equity swings are often greater than 20 percent. Again, there may be an occasional exception due to extraordinary market conditions.
You mast also consider the benefits and problems of diversification, that is, trading many different markets in a single account. The main advantage of trading many markets is that it increases the odds of participating in major moves. The main problem is that many of the markets respond to the same or similar fundamental forces, so their price moves are highly correlated in time. Therefore, trading many correlated markets is similar to trading multiple contracts in one market.
For example, the Swiss franc (SF) and deutsche mark (DM) often move together, and trading both these markets is equivalent to trading multiple contracts in either the franc or the mark. Let us look specifically at SF and DM continuous contracts from May 26, 1989, through June 30, 1995, with a dual moving average system using a $1,500 stop and $100 for slippage and commissions. The two moving averages were 7 and 65 days. As Figure 2.9 shows, the equity curves have a correlation of 83 percent. For example, you would have made $60,619 trading one contract each of SF and DM, but your profits would have been $63,850 trading two contracts of DM and $57,388 trading two contracts of SF.
Note one important difference between the two cases. Since the two markets may have negative correlation from time to time, the draw-down for both SF and DM together may be in between trading two con¬tracts of just DM or SF. For example, the draw down for SF and DM in this case was -$10,186 versus -$22,375 for two DM contracts and -$9,950 for two SF contracts. Hence, the benefits of trading correlated markets are relatively small. Thus, it may be better to trade uncorrelated or weakly correlated markets in the same portfolio.
The benefits of adding usually unrelated markets to a portfolio can be illustrated by an example of trading the Swiss franc (SF), cotton (CT) and 10-year Treasury note (TY) in a single account, using the same dual moving average system as above. The paper profits from trading three SF contracts add up to $86,801 versus $85,683 for SF plus TY and CT. The equity curve for the two combination is shown in Figure 2.10. The smoothness of the two curves can be compared by using linear regression analysis to calculate the standard error (SE) of the daily equity.
Rule 3: Robust Trading Rules
Robust trading rules can handle a variety of market conditions. The performance of such systems is not sensitive to small changes in parameter values. Usually, these rules are profitable over multiperiod testing, as well as over many different markets. Robust rules avoid curve fitting, and are likely to work in the future.
An example of a system with delayed long entries illustrates the use of non robust parameters. The entry rule is as follows: if the crossover between 3- and 12-day simple moving averages (SMAs) occurred x days ago, and the low is greater than the parabolic, then buy tomorrow at the today's high + 1 point on a buy stop. A $1,500 initial stop was used and $100 was charged for slippage and commissions.
The results above are for an IMM (International Monetary Market) Japanese yen futures continuous contract, from August 2, 1976 through June 30, 1995. The dollar profits are sensitive to the number of days of delay, and can vary widely due to small changes in parameter val¬ues. It also does not seem reasonable to wait 12 days after a crossover for such short-term moving averages. Hence, the flattening out of the curve after a 9-day delay is of little practical relevance. The delay parameter is not robust because a small change in the value of this parameter can make system performance vary widely with markets and time frames.
The market was in a narrow trading range during February and March, and then broke out above the $18.00 per barrel price level. The market moved up quickly, reaching the $20 level by May. A volatile consolidation period ensued through June, before prices broke down to¬ward the $17 per barrel level by July.
The following trading rules were derived simply by visual inspection of the price chart in an attempt to develop a curve fitted system that picked up specific patterns in this contract.
- Rule 1: Buy tomorrow at highest 50-day high + 5 points on a buy stop (breakout rule).
- Rule 2: Sell tomorrow at low -2 x (h-1) - 5 points on a sell stop (downside range-expansion rule).
- Rule 3: If this is the twenty-first day in the trade, then exit short trades on the close (time-based exit rule).
- Rule 4: If Rule 3 is triggered, then buy two contracts on the close (countertrend entry rule).
- Rule 5: If short, then sell tomorrow at the highest high of last 3 days +1 point limit (sell rallies rule).
Labels: IMM, International Monetary Market, Robust trading rules, SMAs, trading range
Rule 2: A Small Number of Rules

Consider two well known trend following systems
The common dual moving average system has just two rules. One says to buy the up¬side crossover, and the other says to sell the downside crossover. Similarly, the popular 20-bar breakout system has at least four rules, two each for entries and exits. You can show with testing software that these systems are profitable over many markets across multi year time frames.
You can contrast this approach with an expert system based trading system that may have hundreds of rules. For example, one commercially available system apparently has more than 400 rules. However, it turns out that only one rule is the actual trigger for the trades. The deterministic systems differ from neural-net-based systems that may have an unknown number of rules.
The statistical theory of design of experiments says that even complex processes are controllable using five to seven "main" variables. It is rare for a process to depend on more than ten main variables, and it is quite difficult to reliably control a process that depends on 20 or more variables. It is also rare to find processes that depend on the interactions of four or more variables. Thus, the effect of higher-order interactions is usually insignificant. The goal is to keep the overall number of rules and variables as small as possible.
There are many hazards in designing trading systems with a large number of rules. First, the relative importance of rules decreases as the number of rules increases. Second, the degrees of freedom decrease as the number of rules or variables increases. This means larger amounts of test data are needed to get valid results as the number of rules or variables increases.
A third problem is the danger of curve-fitting the data in the test sample. For example, given a data set, a simple linear regression with just
Principles of Trading System Design
two variables may fit the data adequately. As the number of variables in the regression increases to, say, seven, the line fits the data more closely. Therefore, we can pick up nuances in the data when we curve-fit our trading system, only to pick up patterns that may never repeat in the future. The total degrees of freedom decrease by two for the simple linear regression, but will decrease by seven for the polynomial regression.
Rule 1: Positive Expectation
A trading system that has a positive expectation is likely to be profitable in the future. The expectation here refers to the dollar profit of the average trade, including all available winning and losing trades. The data may be derived from actual trading or system testing. Some analysts call this your mathematical edge, or simply your "edge" in the markets.
The terms "average trade" and "expectation" represent the same object, so they are freely interchanged in the following discussion. Expectation can be written in many different ways. The following formulations are identical:
Expectation($) = Average Trade($), Expectation($) = Net profit($)/(Tbtal number of trades),
Expectation($) = [(Pwin) x (Average win($))] - (1 - Pwin) x (Average loss($))].
The expectation, measured in dollars, is the profit of the average trade. The net profit, measured in dollars, is the gross profit minus the gross loss over the entire test period.
Pwin is the fraction of winning trades, or the probability of winning. The probability of losing trades is given by (1-Pwin).
The average win is the average dollar profit of all winning trades. Similarly, the average loss is the average dollar loss of all losing trades.
The expectation must be positive because, on balance, we want the trading system to be profitable. If the expectation is negative, this is a losing system, and money management or risk control cannot overcome its inherent limitations.
Assume that you are using system test results to estimate your average trade. Note that your estimate of the expectation is limited by the available data. If you test your system on another data set, you will get a different estimate of the average trade. If you test your system on
different subsets of the same data set, you will find that each subset gives a different result for the average trade.
Thus, the expectation of a trading system is not a "hard and fixed" constant. Rather, the expectation changes over time, markets, and data sets. Hence, you should use as long a time period as possible to calculate your expectation.
Since the expectation is not constant, you should stipulate a mini-mum acceptable value for the average trade. For example, the minimum value should cover your trading costs and provide a "risk premium" to make it attractive. Hence, a value such as $250 for the expectation could be used as a threshold for accepting a system. In general, the larger the value of the average trade, the easier it is to tolerate its fluctuations.
Note that the expectation does not provide any measure of the variability of returns. The standard deviation of the profits of all trades is a good measure of system variability, system volatility, or system risk. Thus, the expectation does not fully quantify the amount of risk (read volatility) that must be absorbed to benefit from its profitability.
The expectation is also related to your risk of ruin. You can use statistical theory to calculate the probability that your starting capital will diminish to some small value. These calculations require assumptions about the probability of winning, the payoff ratio, and the bet size.
The payoff ratio can be defined as the ratio of the average winning trades to the average losing trades. As your payoff ratio increases, and your Pwin increases, your risk of ruin decreases.
The risk of ruin is also governed by bet size, that is, percentage of capital risked on every trade.
The smaller your bet size, the lower the risk of ruin.
In summary, it is essential that your system have a positive expectation, that is, a profitable average trade.
The value of the average trade is not fixed, but changes over time. Hence, you can specify a threshold value, such as $250, before you will accept a trading system. The expectation is also important because it affects your risk of ruin. Avoid trading systems that have a negative expectation when tested over a long time.
Six Cardinal Rules
Once you identify your strongly held trading beliefs, you can switch to the task of building a trading system around those beliefs. The six rules listed below are important considerations in trading system design. You should consider this list a starting point for your own trading system design. You may add other rules based on your experiences and preferences.
- The trading system must have a positive expectation, so that it is "likely to be profitable."
- The trading system must use a small number of rules, perhaps ten rules or less.
- The trading system must have robust parameter values, usable over many different time periods and markets.
- The trading system must permit trading multiple contracts, if possible.
- The trading system must use risk control, money management, and portfolio design.
- The trading system must be fully mechanical.
trading system. Even as the system reflects your trading beliefs, it must satisfy other rules to be workable. For example, if you want to day-trade, then your short-term, day-trading system must also follow the six rules.You can easily modify this list. For example, rule 3 suggests that the system must be valid on many markets. You may modify this rule to say the system must work on related markets. For example, you may have a system that trades the currency markets.
This system should "work" on all currency markets, such as the Japanese yen, German mark, British pound, and Swiss franc.
However, you will not mandate that the system must also work on the grain markets, such as wheat and soybeans. In general, such market-specific systems are more vulnerable to design fail¬ures. Hence, you should be careful when you relax the scope of any of the six cardinal rules.
Another way to modify the rules is to look at rule 6, which says that the system must be fully
mechanical. For example, you may wish to put in a volatility-based rule that allows you to override the signals. Be as specific as possible in defining the conditions that will permit you to deviate from the system. You can likely test these exceptional situations on past market data, and then directly include the exception rules in your mechanical system design.In summary, these rules should help you develop sound trading systems. You can add more rules, or modify the existing ones, to build a consistent framework for system design. The following sections discuss these rules in greater detail.
What Are Your Trading Beliefs?
You can trade only what you believe; therefore, your beliefs about price action must be at the core of your trading system. This will allow the trading system to reflect your personality, and you are more likely to succeed with such a system over the long run. If you hold many beliefs about price action, you can develop many systems, each reflecting one particular belief. As we will see later, trading multiple systems is one form of diversification that can reduce fluctuations in account equity.
For example, you can include beliefs about breakout systems, moving-average methods, or volatility systems.
Your trading beliefs are also in¬fluenced by what you do. For example, you may be a market marker, with a very short term trading horizon. Or, you may be a proprietary trader for a big bank, trading currencies.
You may wish to keep an eye on economic data as one ingredient in your decision process. As a former floor trader, you may like to read the commitment of traders report. Perhaps you were once a buyer of coffee beans for a major manufacturer, and you like to look at crop yield data as you trade coffee. The range of possible beliefs is as varied as individual traders.
You must ensure that your beliefs are consistent. For example, if you like fast action, you probably will not use weekly data, nor hold positions as long as necessary. Nor are you likely to use fundamental data in your analysis. Hence, a need for fast action is more consistent with day trading, and using cycles, patterns, and oscillators with intra day data.
Similarly, if you like a trend-following approach, you are more likely to use daily and weekly data, hold positions for more than five days, trade a variable number of contracts, and trade a diversified port¬folio. If you hold multiple beliefs, ensure that they are a consistent set and develop models that fit those beliefs. A set of consistent beliefs that can be used to build trading systems is listed below as an example.
- I like to trade with the trend (5 to 50 days).
- I like to trade with a system.
- I like to hold positions as long as necessary (1 to 100 days).
- I like to trade a variable number of shares or contracts.
- I like to use stop orders to control my risk