Foundations of Forex Trading System Design
Foundations of Forex Trading System Design This chapter examines many key system design issues. Now that you understand some basic principles of system design, you can consider more complex issues. And as you understand these issues, you can design more powerful systems.
The best forex trading system provides instant gratification and constant satisfaction.
This chapter examines many key system design issues. Now that you understand some basic principles of system design, you can consider more complex issues. And as you understand these issues, you can design more powerful systems.
We will begin by asking the question: Do markets trend? The answer to the next big question, whether you should trade with the trend or against the trend, is that you should trade with the trend. This chap-ter presents some test results to support this answer. You can then ask whether you should or should not optimize your trading system. We explore here how well you can predict future performance based on optimization of historical data.
The chapter begins the discussion on risk control issues by addressing whether the initial stop is a problem or a solution and discussing the different types of risk you may face in your trading. You should consider these issues early in your design process. We then look at the different types of data you can use for your testing and what difference, if any, they make. Finally, the chapter explains what is found as well as what is lacking in the system performance summary.
At the end of this chapter, you will be able to:
- Explain how you can diagnose trending markets.
- Know whether to use a trend-following or counter trend start
- Explain the benefits and pitfalls of optimization.
- Understand the type of risks you may encounter.
- Know how to select data for tests.
- Effectively use the performance summary of system testing results.
- Understand and explore what is not covered in the performance summary.
- Explain why system design has its limits.
Diagnosing Market Trends
You can design a profitable trading strategy if you can correctly and consistently diagnose whether a market is trending. In simple terms, the market exists in two states: trending and ranging. A market is trending if it moves steadily in one direction. If the market is going back and forth within a relatively narrow price range, then it is ranging.
Longer-term strategies are likely to succeed in trending markets, and shorter-term strategies in ranging markets. As always, the market may not make a crisp transition from trending to ranging and back again. Sometimes the market begins to range only to break out into a trend, or vice versa.
There are many different ways to determine if a market is trending. Clearly, you must make a number of trade-offs, and these trade-offs largely define your answer. For example, one well-known measure is the average directional index (ADX) developed by Welles Wilder Jr. (see bibliography for references). This is usually a built-in function in most technical analysis software programs. The ADX describes double-smoothed, absolute market momentum. A rising ADX line usually indicates trend. You have to choose the number of days to calculate the ADX; the sensitivity of the indicator decreases as the time increases. A value of 14 days is common, although 18 days works well. You must also define two reference levels to screen out false signals. An ADX value of 20 is useful as a reference level—that is to say a market is not trending unless the rising 18-day ADX is above 20. A second useful barrier level is 40, which says that when the ADX rises above 40 and then turns down, a consolidation is likely. You will find that in particularly strong trends, the “hook” from above 40 often signals just a brief consolidation phase. The trend then has a strong second “leg” toward higher highs or lower lows.
Sometimes you will find that the ADX will rise above 20 in markets that are in a broad trading range.
Another quirk is that the ADX can head lower even though prices march steadily and smoothly in either direction. In short, this is not a perfect indicator. The main difficulty with the ADX is that it has two levels of smoothing, which produces disconcerting lags between price movement and indicator response. Chapter 5 shows that the absolute level of the ADX indicator is not as useful for system design as is its trend.
An indicator that is more directly based on market momentum, and that responds more predictably than the ADX, is the range action verification index (RAVI). This strategy, which focuses on identifying ranging markets, is different from the ADX, which looks at how much of today’s price action is beyond yesterday’s price bar.
To define RAVI, we begin by selecting the 13-week simple moving average, since it represents a quarter of a year. Because we want to use daily data, we convert the 13-week SMA into the equivalent 65-day SMA of the close. This is the long moving average. The short moving average is chosen as only 10 percent of the long moving average, which is 6.5 days, or, rounding up, 7 days. Thus, we use 7-day and 65-day simple moving averages. This choice of lengths is purely arbitrary. Next, the RAVI is defined as the absolute value of the percentage difference between the 7-day SMA (7-SMA) and the 65-day SMA (65-SMA):
RAVI = Absolute value (100 x (7-SMA-65-SMA)/65-SMA)
An arbitrary reference level of 3 percent means a market is ranging if the RAVI is less than 3 percent, and trending strongly if the RAVI is greater than 3 percent. In some markets, such as Eurodollars, this is too high a hurdle. Hence, you may want to experiment with a smaller level, such as 1 percent, or use a relative measure, such as a 65-day SMA of the RAVI. You can also require that the RAVI be above 3 percent and rising for there to be a strong trend.
Note the following design features of the RAVI: (1) There is only one level of smoothing. (2) The 7-day moving average is relatively sensitive, so that the lags between price action and indicator action should be small. (3) Markets can still move more quickly than the RAVI indicates. You can verify this by looking at the currency markets. (4) Markets in a slowly drifting, choppy trend will pin the RAVI below 3 percent, indicating ranging action.
Figure 3.1 compares the 18-day ADX (bottom graph) to the RAVI (middle graph) with a horizontal line at the 3 percent RAVI level. There is a general similarity between the two indicators, with the RAVI responding more quickly than the ADX because it has only one level of smoothing versus two levels for the ADX. A double-smoothed RAVI indicator created by smoothing the RAVI with a 14-day SMA is very similar to the 18-day ADX, as shown in Figure 3.2. Thus the ADX closely describes double-smoothed momentum and can lag price movements.
We now compare the ADX and RAVI and use them both to meas-ure how often trends occur. In this example, we use continuous contracts from January 1, 1989, through June 30, 1995, a rising 18-day ADX above 20, and a rising RAVI greater than 3 percent. The ADX and RAVI are considered to be rising if today’s value is greater than the value 10 days ago. These choices of length and reference levels are arbitrary.
The calculations shown in Table 3.1 suggest that markets seem to show some form of trendiness about 20 to 40 percent of the time. Some markets, such as the 10-year T-note, have not shown very strong trends as measured by the RAVI. However, this may just be due to using a 3 percent barrier with the RAVI to measure trend strength. The “soft” markets, such as coffee and sugar, show the highest tendency to trend. Other fundamentals-driven markets, such as cotton, copper, and crude oil, also show a tendency to have strong trends, with a RAVI rating above 35 percent. The more mature markets, such as S&P-500 and U.S. bond markets, show fewer strong trends than the softs. RAVI calculations correctly tagged the prolonged sideways ranging action in gold with a low rating of 15.8.
A separate calculation showed that the average length of these trending intervals was about 15 to 18 days in most markets, with values ranging from as low as 1 to more than 30. Thus, the trending phase of these markets was long enough to allow profitable trading. These calculations show that markets have provided sufficient opportunities for trend-following systems in the “trendless nineties.”
In summary, you can use momentum-based indicators to measure ranging or trending action. The calculations show that markets have trends lasting 15 to 18 days on average. Hence, trend-following strategies are worth considering for system design. The next section examines whether you should use trend-following strategies over the long run.