Unfortunately, most mechanical trading systems are based on historical data and are constructed from a more or less perfect fit with past, in the expectation that history will be repeated in the future. This expectation will not necessarily be fulfilled because market conditions change. A well thought-out and well-designed mechanical system, however, should do the job reasonably well.
Major Technical Principle It is better to design a system that gives a less-than-perfect fit but more accurately reflects normal market conditions.
Remember that you are interested in future profits, not perfect historical simulations. If special rules have to be invented to improve results, the chances are that the system will not operate successfully when extrapolated to future market conditions.
Advantages of Mechanical Systems
One of the great difficulties of putting theory into practice is that a new factor, emotion, enters the scene as soon as money is committed to the market. The following advantages therefore assume that the investor or trader will follow the buy and sell signals consistently:
• A major advantage of a mechanical system is that it automatically decides when to take action; this has the effect of removing emotion and prejudice. The news may be atrocious, but when the system moves into a positive mode, a purchase is automatically made. In a similar vein, when it appears that nothing can stop the market from going through the roof the system will override all possible emotions and biases and quietly take you out.
• Most traders and investors lose in the marketplace because they lack discipline. Mechanical trading requires only one aspect of discipline: the commitment to follow the system.
• A well-defined mechanical system will give greater consistency of profits than a system in which buying and selling decisions are left to the individual.
• A mechanical system will let profits run in the event that there is a strong uptrend, but will automatically limit losses if a whipsaw signal occurs.
• A well-designed model will enable the trader or investor to participate in the direction of every important trend.
Disadvantages of Mechanical Systems
The disadvantages of using mechanical systems are as follows:
• No system will work all the time, and there may well be long periods when it will fail to work.
• Using past data to predict the future isn’t necessarily a valid approach because the character of the market often changes.
• Most people try to get the best or optimum fit when devising a system, but experience and research tell us that a historical best fit doesn’t usually translate into the future.
• Random events can easily jeopardize a badly conceived system. A classic example occurred in Hong Kong during the 1987 crash, when the market was closed for 7 days. There would have been no opportunity to get out, even if a sell signal had been triggered. True, this was an unusual event, but it’s surprising how often special situations upset the best rules.
• Most successful mechanical systems are trend-following by nature. However, there are often extended periods during which markets are in a nontrending mode, which renders the system unprofitable.
• “Back-testing” won’t necessarily simulate what actually would have happened. It is not always possible to get an execution at the price indicated by the system because of illiquidity, failure of your broker to execute orders on time, and so forth.
Design of a Successful System
A well-designed system should try to capitalize on the advantages of the mechanical approach, but should also be designed to overcome some of the pitfalls and disadvantages already discussed. In this respect, there are eight important rules that should be followed:
• Back-test over a sufficiently long period with several markets or stocks. The more data that can be tested, the more reliable the future results are likely to be.
• Evaluate performance by extrapolating the results over an earlier period. In this case, the first step would involve the design of a system based on data for a specific time span, such as 1977 to 1985 for the bond market. The next step would be to test the results from 1985 to 1990 to see whether or not your approach would have worked in the subsequent period. In this way, rather than “flying blindly” into the future, the system is given a simulated but thorough testing using actual market data.
• Define the system precisely. This is important for two reasons. First, if the rules occasionally leave you in doubt about their correct interpretation, some degree of subjectivity will permeate the approach. Second, for every buy signal there should be a sell signal, and vice versa. If a system has been devised using an overbought crossover as a sell and an oversold crossover as a buy, it might work quite well for a time. An example is shown in Figure 34.1a. On the other hand, there could be long periods during which a countervailing signal is not generated, simply because the indicator does not move to these extremes. Failure to define the system precisely can, therefore, result in significant losses, as shown in Figure 34.1b.
FIGURE 34.1 Overbought/Oversold Crossovers
• Make sure that you have enough capital to survive the worst losing streak. When devising a system, it is always a good idea to assume the worst possible scenario and to make sure that you start off with enough capital to survive such a period. In this respect, it is worth noting that the most profitable moves usually occur after a prolonged period of whipsawing.
• Follow every signal without question. If you have confidence in your system, do not second-guess it. Otherwise, unnecessary emotion and undisciplined action will creep back into the decision-making process.
• Use a diversified portfolio. Risks are limited if you place your bets over a number of different markets. If a specific market performs far worse than it ever has in the past, the overall results will not be catastrophic.
• Trade only markets that show good trending characteristics. Chart 34.1 shows the lumber market between 1985 and 1989.
CHART 34.1 Lumber, 1985–1989
During this period the price fluctuated in a volatile, almost haphazard, fashion and clearly would not have lent itself to a mechanical trend-following system. On the other hand, the Commodity Research Board (CRB) Spot Raw Industrial Materials Index (Chart 34.2) shows an example of both a downtrending and uptrending price trend. Although it is subject to the odd confusing trading range, it has, by and large, moved in consistent trends.
CHART 34.2 CRB Spot Raw Industrials, 2007–2011
• Keep it simple. It is always possible to invent special rules to make back-testing more profitable. Overcome this temptation. Keep the rules simple, few in number, and logical. The results are more likely to be profitable in the future, when profitability counts.
Trading Range and Trending Markets
There are basically two types of market conditions: trending and trading range. A trending market, as shown in Figure 34.2, is clearly suitable for moving-average (MA) crossovers and other types of trend-following systems.
FIGURE 34.2 Trade-off Between Timeliness and Sensitivity
In this kind of situation, it is very important to define the risk since an MA is a trade-off between volatility and sensitivity. In Figure 34.2, the maximum distance between the short-term MA, shown as the dashed line, and the series, shown as the solid line, is the maximum risk. Unfortunately, the short-term MA whips around and gives several false signals. Although the risk of the individual trade defined by the crossover of this MA is small, the chances of unprofitable signals are much greater. On the other hand, a longer-term MA, shown by the X’s, offers larger maximum risk but fewer whipsaws.
MAs, as shown in Figure 34.3, are virtually useless in a trading range market since they move right through the middle of the price fluctuations and almost always result in unprofitable signals. Oscillators, on the other hand, come into their own in a trading range market. They are continually moving from overbought to oversold extremes, which trigger timely buy and sell signals. During a persistent uptrend or
downtrend, the oscillator is of relatively little use because it gives premature buy and sell signals, often taking the trader out at the beginning of a major move. The ideal automated system, therefore, should include a combination of an oscillator and a trend-following indicator.
FIGURE 34.3 MA Crossovers in Trendless Markets
The risk and reward for oscillator-type signals generated from overbought and oversold extremes are shown in diagrammatic form in Figure 34.4.
FIGURE 34.4 Relationship Between Profits and Risk Per Trade Based on Opportunities
The number of potential trading opportunities is represented on the horizontal axis and the risk on the vertical axis. There are very few times when an oscillator is extremely overbought or extremely oversold, but these are the occasions when the profit per trade is at its greatest and the risk the smallest. Moderately overbought conditions are much more plentiful, but the profits are lower and the risk higher. Taken to the final extreme, slightly overbought or oversold conditions are extremely plentiful, but the risk per trade is much higher and profits are significantly lower. Ideally, a mechanical trading system should be designed to take advantage of a situation in which profits per trade are high and risk is low. Execution of a good system, therefore, requires some degree of patience because these types of opportunities are limited.
Turning points in price trends are often preceded by a divergence in the oscillator, so it is a good idea to combine signals from extreme oscillator readings with some kind of MA crossover. This won’t result in a perfect indicator, but it might help to filter out some of the whipsaws.
Guidelines for Appraising Results
When the simulated results of a mechanical system are being reviewed, there is a natural tendency to look at the bottom line to see which system would have generated the most profits. However, top results do not always indicate the best system. The reasons for this are as follows:
• It is possible that most, or all, of the profit was generated by one signal. If so, this would place lower odds on the system’s generating good profits in the future since it would lack consistency. An example of an inconsistent system is shown in Table 34.1, which represents signals generated by a 10-day MA crossover of an oscillator that was constructed by dividing a 30-day MA by a 40-day MA (a form of moving-average convergence divergence, or MACD). The market being monitored was Hong Kong during the 1987–1988 period. The system would have gained nearly 1,200 points, compared to a buy-hold approach, which would have lost 800 points. However, this excellent gain would have actually resulted in a loss had it not been for the fact that a prescient short-sell signal occurred just before the 1987 crash.
TABLE 34.1 Hang Seng 3-Month Perpetual 30/40 Oscillator Performance, 1987—1988
• Another consideration involves the identification of the worst string of losses (the largest drawdown). After all, it is no good having a system that generates a large profit over the long term if you don’t have sufficient capital to ride out the worst period. There are two things to look for in this respect: the string of losing signals and the maximum amount lost during these adverse periods.
• A system that generates huge profits but requires a significant number of trades is less likely to be successful in the real world than is a system based on a moderate number of trades. This is true because the more trades that are executed, the greater the potential for slippage through illiquidity and so on. More transactions also require more time and involve greater commission costs.
The Best Signals Go with the Trend
In virtually every situation, the best signals invariably occur in the direction of the main trend. It is easy to pick out the direction of the primary trend in hindsight, of course, but in the real world we have to use some kind of objective approach to determine the direction of the main trend.
One idea might be to calculate a 12-month MA and to use the position of the price relative to the average as a basis for determining the primary trend. The trading system would be based on daily and weekly data and would be acted upon on the long side only when the index was above the average; short signals would be instigated when it was below.
There are two drawbacks to this approach. First, the market itself may be in a long-term trading range in which MA crossovers do not correctly identify the main trend. Second, the first bear market rally quite often occurs while the price is above its 12-month MA. In effect, the buy signal associated with that rally would be operating against the main trend. By and large, though, most markets trend, and this approach will filter out a lot of the countercyclical moves.
An alternative is to use a long-term momentum series, such as the monthly Know Sure Thing (KST), calculated along the lines discussed in Chapter 15. When the KST is rising and the price is above its 12-month MA, a bull market environment is indicated, and all trades would be made from the long side. When the KST is falling and the price is above its 12-month MA, the chances are that the primary trend is in the process of peaking; no positions would be instigated. If you already had some exposure, the topping-out action of the KST would indicate that some profits should be taken, but total liquidation of the position would probably be better achieved at the time of a negative MA crossover. A trade would be activated only when the KST and the price, vis-à-vis its MA, were in a consistent mode. For example, when the KST peaks out and the market itself falls below its 12-month MA, a bear market environment is indicated and only trades on the short side should be initiated. If you do not have access to the KST, the MACD, using an 18/20/9 combination on monthly data, is a close substitute.
A Simple Technique Combining an Oscillator with an MA
A technique that enables investors to take advantage of both trending and trading range markets is to combine an MA and an oscillator in such a way that buy signals are triggered when the oscillator has fallen to a predetermined oversold level and the price itself subsequently crosses above an MA.
The position is liquidated if the price crosses below the MA. On the other hand, if the oscillator crosses to an overbought level prior to an MA crossover, part of the position will be sold in recognition of the possibility that the market might be experiencing a trading range. The other part of the position will continue to ride until an MA sell signal is triggered.
This approach will make it possible to capitalize on the potential of a trending market, but some profits will be taken in case subsequent market action turns out to be part of a volatile trading range.
Recognizing that oscillators often diverge at important market turning points, an alternative might be to wait for it to move to an extreme for a second time before buying on an MA crossover. The same rules as previously described would be used for selling.
Marketplace Example
Now it is time to take an actual example of a system by combining these two techniques. The security I chose is a continuous contract for U.S. T-bonds, an MA, and a price oscillator, as shown in Chart 34.3. A price oscillator was calculated by dividing a short-term MA by a longer-term one. In this case, I used a one-period MA, that is, the close as the shorter average and the10-day simple MA as the longer-term one. The 10-day average is plotted in the upper panel with the oscillator underneath.
CHART 34.3 Treasury Bonds and a 1/10 Price Oscillator
Chart 34.3 shows the way the system works. It is really very simple: Buy when the price crosses above the 10-day MA (as it does in late July at point A). Then sell when it crosses below the average or when the price oscillator reaches a specific predetermined level. The oscillator reaches the designated overbought level a few days later (B). In this case, I selected the +2 and –2 percent. This means the overbought and oversold lines are the equivalent of the price being 2 percent above and below the 10-day MA. Then, in early August, the price crosses below the average and this initiates a short signal (C). The position covered at the end of the month is fairly close to the actual low as the oscillator touches its oversold zone (D). The next buy signal comes on an MA crossover in early Se
ptember (E). The oscillator never has a chance to move to the +2 percent level because the MA crossover comes first. The next short signal is a whipsaw, followed by the final buy that resulted in a small profit (F).
I optimized (optimization is the systematic search for the best indicator formula) this system by using one variable for the MA and the oscillator, and another for each of the overbought and oversold conditions. The best overall returns were given by the 26/2/–4 combination, as you can see in Table 34.2. This was not the one I finally chose, however, because I like to see identical levels for the overbought and oversold triggering points. The rationale for this arises from the fact that oscillator sensitivity to overbought and oversold conditions depends on the direction of the primary trend. In a bull market, oscillators move to higher overbought levels and rallies are generated from moderate oversold levels. If you know you are in a bull market, you could skew the triggering points to the upside, and vice versa. Unfortunately, we never learn that the primary trend has reversed until sometime later. Also, if we go with numbers skewed to a bull market environment, the system is definitely going to be under pressure when a bear market begins. It makes sense to evenly balance the overboughts and oversolds. That is why I chose the 28/2/–2 combination. I could have chosen the 26/2/–2 combo, but the profit was only slightly better. The 28-day MA generated fewer signals, and fewer signals mean fewer chances for mistakes.
Technical Analysis Explained Page 50