normalized rank of one year’s net profit plottedagainst the normalized rank of next year’s net profit for all eight parameter sets. Ranks are normalizedby subtracting the average annual profit for a parameter set from the annual return.
in the portfolio of futures or stocks. When we look at ranked deviations fromaverage profit by parameter set, we find similar results. The slope for GE isslightly negative, indicating that a year with better than average performancewill be followed by a year with less than average performance. Neither test concerning GE produces results that are statistically significant. While this study iscertainly not the end of the argument, I think it does provide a clue about thebenefits of optimization.Leo Zamansky and James Goldcamp (2001) wrote an intriguing piece on thepotential benefits of optimization. The two tested channel breakout strategies whereparameters were optimized based on the past 60 and 120 days’ performance. Twostudies were run. The first would use parameters for the current period that had performed best in the prior period. The idea behind this strategy is that strings of pastperformance are likely to continue, and that as traders we want to stay with parameter sets that are performing the best. The second test selected parameter sets forthe current period that performed the worst in the prior period. The idea behind thisstrategy is that performance is likely to mean revert over time. Parameter sets thathave been “cold” and performing poorly are likely to revert and perform well in thefuture.
Optimization Results of General Electric10y = 0.077x + 4.0151R2 = 0.006
9
Rank of This Year
8765432100
2
4
6
8
10
Rank of Previous Year
FIGURE
6.4a
Optimization Results for General Electric. The rank of one year’s net profit plotted against the rank ofnext year’s net profit for all eight parameter sets.
Optimization Results of General Electric Compared to Mean10y = –0.1266x + 4.9287R2 = 0.0161
9
Rank of This Year
8765432100
2
4
6
8
10
Rank of Previous Year
FIGURE
6.4b
Optimization Results for General Electric Compared to Mean. The normalized rank of one year’s netprofit plotted against the normalized rank of next year’s net profit for all eight parameter sets. Ranks arenormalized by subtracting the average annual profit for a parameter set from the annual return.
116
CHAPTER 6 Optimizing Parameters and Filtering Trading Signals
117
While the results of the study were mixed, Zamansky and Goldcamp’sresearch did yield interesting information. In the longer performance look-back(120 days), parameter sets that were selected using the best performance of theprior period typically generated better results than the average of all parametersets. These results mirror our own studies earlier in the chapter. However, theshorter performance look-back period (60 days) found that using parameter setsthat had performed poorly did in fact enhance results.The debate on optimization will not end soon. Some traders believe it is anabsolute necessity, while others feel it is an avoidable evil. While I agree that it’simportant to optimize to test for parameter stability, the evidence above suggeststhat there is no clear answer. It does appear that some parameter sets perform better than others throughout the life of performance tests, but that optimizing parameters frequently based on “the hot hand” may not be better than sticking with theparameter set that has performed the best during a longer time frame.
FILTERING TO ENHANCE PROFITABILITYFiltering, as we defined it in Chapter 3, is the process of deciding when to overridetrade signals. The most common use of filtering is within trend-following systems,where signals are only taken when a trend filter such as the ADX is rising or abovea fixed point. Popular wisdom holds that when trend filters such as the ADX arerising, trend-following strategies will perform better than when falling. Although Ihave seen this trend filter argument time and again, I’ve never seen evidence thatusing a filter improves performance. Like other ideas in this book, we will examine whether using filters does indeed improve trading strategy performance.Similarities of Trend Filters: ADX and VHFWhile there are many ways of measuring whether a market is trending, most areremarkably similar to each other. Figure 6.5, below, is a chart of random price dataalong with two popular trend filters: a 14-day ADX and a 30-day Vertical HorizontalFilter (VHF). Note that the filters track each other very closely. In fact, many timesthey are virtually indistinguishable.These filters do a good job of identifying when a trend has already developed, but what about identifying whether trends will continue? To answer thatquestion we need to test the effectiveness of trend filters, which we will for onetrend-following strategy.Measuring the Value of FilteringTo test the effectiveness of filters, we return to the channel breakout strategy. Wetested a 40-day entry/20-day exit channel breakout on stock and futures data from
PART 1 Structural Foundations for Improving Technical Trading
118
Similarities of Trend Filters140
200
Last price
130
14 day ADX (thick)
180
14 day VHF (thin)
160
Last
120110
10080
100
ADX/VHF
140
120
6040
90
20300
270
240
210
180
150
120
90
60
30
00
80DayFIGURE
6.5
Similarities of Trend Filters. The movement of ADX and VHF are similar.
1990 through 2001. We filtered entries to take signals only when the 14-day ADXwas between x and x+5 (where x runs from 15 to 30 increments of 5). In addition,we tested another run to take signals only when the 14-day ADX was between xand x+5 and the 14-day ADX was rising. The resulting charts are depicted inFigures 6.6 through 6.9.The graphs tell two stories, depending on the type of market. For futures, wesee that the results of the channel breakout might be improved by ignoring trading signals when the 14-day ADX is less than 20. These filtered signals producedSharpe ratios that were much worse than entering trades with higher ADX values.The results are consistent whether we require the ADX to be rising or not.For stocks, however, the opposite appears to hold true. Trades entered whenthe 14-day ADX value was less than 20 generated Sharpe ratios much better thantrades entered during periods of higher ADX values. Essentially, the data aretelling us to avoid trend-following signals when futures are caught in tradingranges but to take trend-following signals when stocks are in trading ranges.Regime Switching StrategiesWe can also use trend filters to pick the appropriate strategy to fit the currentmarket regime. In these regime-switching models, we start by identifying market
CHAPTER 6 Optimizing Parameters and Filtering Trading Signals
119
Results of ADX Filter on Futures using Channel Breakout0.50
Sharpe Ratio
0.450.400.350.30
FIGURE
No filter
ADX 35+
ADX 30-35
ADX 25-30
ADX 20-25
ADX 15-20
0.20
ADX 10-15
0.25
6.6
Results of ADX Filter on Futures Using Channel Breakout. The results of a 40-day entry/20-day exit taking signals at varying 14-day ADX levels.
Results of ADX Filter on Stocks using Channel Breakout0.400.35
Sharpe Ratio
0.300.250.200.150.10
FIGURE
No filter
ADX 35+
ADX 30-35
ADX 25-30
ADX 20-25
ADX 15-20
0.00
ADX 10-15
0.05
6.7
Results of ADX Filters on Stocks Using Channel Breakout. The results of a 40-day entry/20-day exit taking signals at varying 14-day ADX levels.
PART 1 Structural Foundations for Improving Technical Trading
120
Results of Rising ADX Filter on Futures using Channel Breakout
0.50
Sharpe Ratio
0.450.400.350.300.25
FIGURE
No filter
ADX 35+
ADX 30-35
ADX 25-30
ADX 20-25
ADX 15-20
ADX 10-15
0.20
6.8
Results of Rising ADX on Stocks Using Channel Breakout. The results of a 40-day entry/20-day exit taking signals at varying 14-day rising ADX levels.
Results of Rising ADX Filter on Stocks using Channel Breakout0.30
Sharpe Ratio
0.250.200.150.10
No filter
ADX 35+
ADX 30-35
ADX 25-30
6.9
ADX 20-25
FIGURE
ADX 15-20
0.00
ADX 10-15
0.05
Results of Rising ADX on Stocks Using Channel Breakout. The results of a 40-day entry/20-day exit taking signals at varying 14-day rising ADX levels.
CHAPTER 6 Optimizing Parameters and Filtering Trading Signals
121
states based on a trend filter and apply the appropriate strategy, as seen in Figure6.10:
Regime
Trend status
Strategy
ADX<15
Mean reverting prices
RSI oscillator to take counter trend signals
15<ADX>25
Random walk, no trend,no mean reversion in prices
No trading
ADX>25
Trending prices
40-day/20-day channel breakout
FIGURE
6.10
Regime Switching Rules. Depending on the value of a 14-day ADX, we will either use a channel breakoutor RSI strategy.
We test this relationship using historical data for one futures market(Treasury bonds, Figure 6.11) and one stock (Merrill Lynch, Figure 6.12). In addition to the 40-day/20-channel breakout, we test a standard 14-day RSI system thatenters short on crosses above 65 and long on crosses below 35. For each day in thetest, we measure the day’s profit or loss for both strategies and the 14-day ADXvalue for each market. At the end of the test we aggregate the profit and loss basedon values of the ADX. If today’s ADX value is 23, then we add the day’s profit orloss of the channel breakout to the 20–25 bin for the ADX. We do the same for theRSI strategy. At the end of the test, we average the daily profit and loss by theADX bin.Both the futures market (T-bonds) and the individual stock (Merrill Lynch)have well-defined profit and loss characteristics. The channel breakout strategyappears to perform best when the 14-day ADX is very low or very high (ADX values less than 20 and greater than 30). The 14-day RSI strategy appears to performbest when the 14-day ADX is anywhere between 20 and 30. Using these tendencies, we rewrite the rules to our regime strategy (Figure 6.13).We can now create a more robust strategy using a combination of a channelbreakout and RSI strategies to take advantage of the market’s current state.Filtering Using Profitability of the Last TradeThe tests above use price data to determine whether the market is trending or nottrending and then selects an appropriate strategy to take advantage of the market’senvironment. We can also use data not associated with price to determine whento trade.One popular filter that dates back to the mid 1980s is the concept of thelast trade. Some traders theorize that winning trades are commonly followed bylosing trades, and losers by winners. In essence, the idea is that trade by trade
Daily Profit versus ADX Level on T-Bonds$1,500Channel breakoutRSI
ADX 35+
ADX 30-35
ADX 25-30
–$500
ADX 20-25
$0
ADX 15-20
$500
ADX 10-15
Average Daily Profit
$1,000
–$1,000
–$1,500
FIGURE
6.11
Daily Profit versus ADX Level on T-Bonds. A definitive pattern exists for the performance of the channelbreakout and RSI strategies. The channel breakout performs best during extreme values of the 14-dayADX. while the RSI performs best during middle values.
Daily Profit versus ADX Level on Merrill Lynch$1,500Channel breakoutRSI
ADX 35+
ADX 30-35
ADX 25-30
–$500
ADX 20-25
$0
ADX 15-20
$500
ADX 10-15
Average Daily Profit
$1,000
–$1,000
–$1,500
FIGURE
6.12
Daily Profit versus ADX Level on Merrill Lynch. Although not as pronounced as T-bonds, a similar patternexists on the two strategies applied to Merrill Lynch.122
CHAPTER 6 Optimizing Parameters and Filtering Trading Signals
Regime
Trend status
123
Strategy
ADX<20
Trend to begin soon
40-day/20-day channel breakout
20<ADX<30
Mean reversion in prices
14-day RSI strategy
ADX>30
Trending prices
40-day/20-day channel breakout
FIGURE
6.13
Refined Regime Switching Rules. Based on the results above, we tweak our regime switching tradingstrategy.
profit is mean reverting over time. Others argue that strategies tend to get “hot,”much like a shooter at a craps table, and that we should push full throttle in ourtrading when the last trade was a winner. Like most conflicting theories in thisbook, we can test performance historically to determine which, if any, of thesetwo ideas has merit.Using the 40-day entry/20-day exit channel breakout, we filter signals toonly take entries when (1) the last trade was a winner and (2) the last trade wasa loser.The results, as seen in Figure 6.14, indicate that taking channel breakouttrades after a winning trade has been closed is a losing proposition. While a standard channel breakout strategy produces profits, both futures and stocks producelosses if we only take trades after winning trades. On the flip side, taking tradesonly after losing trades is only a slight improvement to taking all channel breakout trades. In the futures market, taking signals after losing trades produces abouthalf the profits as taking all trades with slightly lower reward-to-risk measures. Onstocks, taking signals after losing trades produces only slightly lower profits withmuch higher reward-to-risk measures.Trading the Equity CurveAnother possibility is that strategy returns are positively autocorrelated. In Chapter2 we defined autocorrelation as the predictability of one period’s values on the next.There are two states of autocorrelation: positive and negative. Positive autocorrelation exists when greater than average values tend to lead to greater than average values in the next period, and vice versa. Negative autocorrelation exists when greaterthan average values lead to less than average values. If autocorrelation exists instrategy returns, we can incorporate recent performance data into our trading signals as a filter. This process of filtering trades based on past performance is oftenreferred to as “Trading the Equity Curve.”Using recent performance to filter trading signals is a new and exciting areaof quantitative trading research. Such new thinking may put traders ahead of the
PART 1 Structural Foundations for Improving Technical Trading
124
FuturesProfitAll tradesTrades after winning tradeTrades after losing trade
K-ratio
Sharpe Ratio
$5,971,279
0.12
0.41
⫺ $1,959,837$2,971,124
⫺0.180.06
⫺0.390.37
K-ratio
Sharpe Ratio
StocksProfitAll trades
$3,511,542
0.06
0.16
Trades after winning trade
⫺$5,752,819
⫺0.30
⫺0.77
Trades after losing trade
$3,373,470
0.17
0.27
FIGURE
6.14
Performance of Rules based on Last Trade. We see that taking signals after losing trades outperformstaking signals after winning trades.
curve in determining when to sit on the sidelines or when to have confidence intrading signals. This is one area of research that I will be spending much time onin the coming years.
HOW OFTEN DO MARKETS TREND?I frequently hear that the market only trends 25 percent of the time. Quantifyinghow often a market trends is very vague since the results are entirely dependent onone’s definition of a trend. If I define a trend to be 10 consecutive closes in anydirection, then most markets spend years between trends. Similarly, if I define thetrend as two consecutive closes in any direction, then markets are trending roughly 50 percent of the time. Clearly, one’s definition of trend greatly influences howoften markets do trend.According to the random walk/efficient markets hypothesis, we wouldexpect to be profitable roughly 50 percent of total trading days when we applytrend-following techniques. This 50 percent level is our benchmark hypothesis. Totest it, we will apply our 40-day/20-day channel breakout to stock and futures markets. To measure the tendency to trend, we calculate the total number of days foundin winning trades and compare that to the total number of days found in losingtrades. That is, if a trade lasts 25 days from entry to exit, those 25 days wouldeither be added to total winning days if the trade was profitable, or the 25 dayswould be added to the total losing days if the trade was unprofitable or breakeven.
CHAPTER 6 Optimizing Parameters and Filtering Trading Signals
125
Percent of Days Futures Trend80.0%
Percent of Days Trending
75.0%70.0%65.0%60.0%55.0%50.0%
40.0%
FCSHUPLSLCCJOADSPLHGCPBBPHOCDWCTHGSBKCTYLCCLJYUSLBCSFED
45.0%
Contract
FIGURE
6.15
Percent of Days Futures Trend, Eurodollars Swiss franc, and corn trend most frequently, while feeder cattle, soybeans, and unleaded gas trend the least.
Percent of Days Stocks Trend80.0%
Percent of Days Trending
75.0%70.0%65.0%60.0%55.0%50.0%45.0%
MMMDDFNMIPXOMPGAAVZKOBMYINTCHDSPXIBMDISAIGBAJNJWMTAMGNSLBMSFTRUTAAPLTXNDELLPFEMOGSUNWGEMERNDXGM
40.0%
Stock
FIGURE
6.16
Percent of Days Stock Trend. General Motors, the Nasdaq 100, and Merrill trend most frequently, whileMMM, Dupont, and Fannie Mae trend the least.
126
PART 1 Structural Foundations for Improving Technical Trading
As we see from the results in Figures 6.15 and 6.16, the percent of profitabletrading days averages much higher than our hypothesis of 50 percent. For futures,the average percent of profitable trading days is 63 percent. For stocks, the number is 61 percent. As might be expected, the highest values are recorded for markets that perform very well in the channel breakout and moving average crossovertrading simulations.Given these results, I suggest that markets trend roughly 60 percent of the time.The fact that the average falls greater than 50 percent suggests that markets do in facttrend, and we can apply trend-following strategies to exploit this inefficiency.
PART
TWO
Harnessing the Power of Quantitative Techniquesto Create a Trading Program
T
he second half of the book is designed to open the reader’s eyes to new methodsand markets never before discussed. I’ve developed new entries and exits over thepast 15 years of trading, and I encourage the reader to explore these techniques inhis or her own trading and research.I will introduce a number of markets outside the realm of stocks and futuresthat are ideally suited for applying quantitative techniques. We will look at fixedincome relative value arbitrage, commodity relative value trading, stock pairs trading, implied volatility trading, as well as stock index relative value arbitrage.Then we will explore some more simplistic strategies for trading the S&P 500—techniques computationally easy enough to trade effectively without software. Iwill also introduce a new tool for determining optimal leverage into our tradingportfolios. Finally, all the new concepts of this book will be brought together tocreate a trading system for the futures markets.
127
Copyright 2003 by Lars Kestner. Click Here for Terms of Use.
This page intentionally left blank.
CHAPTER
7
Dissecting Strategies Currently AvailableWhat Works and What Doesn’t
I
n this chapter we’ll combine all the techniques studied thus far and apply them totest and evaluate trading strategies on stocks and futures. I consider this sectionunique in that few existent texts examine performance of trading strategies on bothstock and futures markets in an apples-to-apples, side-by-side comparison. With theintroduction of single stock futures, the lines are becoming blurred between thesetwo asset classes.
TESTING STOCK AND FUTURES MARKETSEach strategy will be tested on 29 domestically traded futures markets and 34domestically traded stock and stock indices using the performance evaluation techniques described in Chapter 3.The futures markets (Figure 7.1) hail from a wide variety of sectors: foreignexchange, interest rate products, stock indices, industrial and precious metals,energy, grains, meats, and soft commodities. Stocks (Figure 7.2) were classifiedbased on sector classifications developed by Standard & Poor’s. Single stocksrepresenting the nine sectors were chosen: energy, materials, industrials, consumer discretionary, consumer staples, health care, financials, information technology, and telecommunications. In addition to single stocks, three popular stockindices are also tested. All strategy tests run from January 1, 1990, throughDecember 31, 2001.
129
Copyright 2003 by Lars Kestner. Click Here for Terms of Use.
PART 2 Harnessing the Power of Quantitative Techniques to Create a Trading Program
130
Sector
Symbol
Foreign Exchange
Market
AD
Australian Dollar
BP
British Pound
CDJY
Canadian DollarJapanese Yen
SF
Swiss Franc
Interest Rates
EDTY
EurodollarTen-Year Treasury Notes
US
Thirty-Year Treasury Bonds
Stock IndexMetals
SPGC
Standard & Poor’s 500 Stock IndexGold
HG
Copper
PL
Platinum
SICL
SilverCrude Oil
HO
Heating Oil
Grains
HUCS
Unleaded GasCornSoybeans
Meats
WFCLC
WheatFeeder CattleLive Cattle
LHPB
Live HogsPork Bellies
CCCTJO
CocoaCottonOrange Juice
KCLB
CoffeeLumber
SB
Sugar
Energy
Softs
FIGURE
7.1
Futures Markets Tested. Twenty-nine futures are tested in our performance evaluation.
CONSTRUCTING CONTINUOUS FUTURES CONTRACTSA futures contract is an agreement to buy or sell the underlying security at a specified price at a specified date in the future. If I buy one March corn contract andhold until expiration, I will be required to pay for the value of and take delivery of5000 bushels of corn housed at a warehouse in March.In reality, this does not happen often. Very few of the futures contracts traded are held to maturity. The majority are either rolled into the next contract monthor closed down prior to futures expiration. The measure of the number of futures
CHAPTER 7 Dissecting Strategies Currently Available
SectorEnergy
131
Symbol
Market
SLB
Schlumberger
XOM
Exxon Mobil
Basic Materials
AADD
AlcoaDupont
IP
International Paper
Industrials
BA
Boeing
GEMMM
General Electric3M Company
DIS
Disney
GMHD
General MotorsHome Depot
Consumer Discretionary
Consumer Staples
Healthcare
Financials
Information Technology
TelecommunicationsStock Indices
FIGURE
WMT
Wal-Mart
GKO
GiletteCoca Cola
MO
Phillip Morris
PGAMGNBMY
Procter & GambleAmgenBristol Meyers
JNJPFEAIG
Johnson & JohnsonPfizerAIG International
FNMMER
Fannie MaeMerrill Lynch
AAPLDELLIBM
Apple ComputerDell ComputerIBM
INTCMSFT
IntelMicrosoft
SUNWTXNVZ
Sun MicrosystemsTexas InstrumentsVerizon
SPXNDX
Standard & Poor’s 500Nasdaq 100
RUT
Russell 2000
7. 2
Stocks Tested. Thirty-four stocks are tested in our performance evaluation.
contracts outstanding, called the open interest, usually peaks some two to fourweeks before a contract expires.In our quantitative trading, we must create a methodology for splicingtogether futures contracts with finite lives. We will create a continuous price series
PART 2 Harnessing the Power of Quantitative Techniques to Create a Trading Program
132
by piecing together price data associated with whichever futures contract possesses the most open interest. Because futures contracts have specific limited lives, wemust roll positions from one contract to the next as expiration nears. While thereare many methods to achieve this contract-rolling procedure, I have chosen theback-adjusted method to create a consistent time series of futures prices.When contracts expire and the front-month rolls from one month to the next,gaps can occur in price action. Figure 7.3 depicts the gaps that occur when onlylooking at front-month prices. Using front-month eurodollar prices, we see howprices differ from one month to the next. It becomes impossible to resolve whichgaps are due to contract rolls and which price gaps are due to trading.For an example of the back-adjusted method let’s assume that we’re tradingOctober cotton. As futures expiration nears, we will want to stop focusing on theOctober contract and instead use the December contract as market participantsbegin to close out their October positions and initiate December positions (seeFigure 7.4). This roll can present problems when analyzing price data since theOctober and December contracts do not trade at the same price. December willtypically trade at a premium to October due to a mixture of carrying costs and storage costs. We will need to adjust our data to account for the difference in priceswhen we switch from the October to the December contract. The back-adjusted
Front-Month Eurodollar Prices99.0Contract roll
98.0Contract roll
97.0Real gap
9/5/2002
7/24/2002
6/11/2002
4/29/2002
3/14/2002
1/30/2002
12/13/2001
10/30/2001
9/14/2001
8/1/2001
96.0
DateFIGURE
7. 3
Front-month Eurodollar Prices. By looking at only front-month futures prices, we expose ourselves toprice gaps created when contracts expire.
CHAPTER 7 Dissecting Strategies Currently Available
133
Hypothetical Cotton Data - September 30Maturity
Open
High
Low
Settle
Volume
Open Interest
October
51.5
51.7
50.8
51
8,000
20,000
December
52.1
52.3
51.4
51.5
8,000
19,500
FIGURE
7. 4
Hypothetical Cotton Data. By adjusting our data by the difference between October and December settlement values, we can create a back-adjusted continuous contract.
method will calculate the difference between contracts and adjust all previous datato fill the gap between the two.On September 30, October expiration cotton settles at 51.0, while Decemberexpiration cotton settles at 51.5. Let’s assume this is the final day when the openinterest of October outnumbers the open interest in December. Starting October 1,we will use December cotton prices for our trading and research purposes. Weadjust all our previous data by adding 0.5 to all prices in order to compensate forthe difference between our last recorded prices of October and December settlements. After the adjustment, we record December contract prices until the nextcontract roll. This process continues indefinitely. The result is that we maintain arecord of most active contract prices and adjust for the difference between onecontract and the next each time a futures contract approaches maturity.Using the back-adjusted technique to adjust futures price data is not withoutflaws. As a result of continually adjusting for price gaps between contracts, our datawill no longer be an accurate representation of actual prices traded. If we rolled ourcotton contracts 10 times, and the average gap between contracts was 0.5, our firstdata points will be 5.0 higher than where prices actually traded at the time. In fact,in certain markets our adjustments can lead to negative prices, a trait that is certainly not possible in real life. Although our back-adjusted prices can be remarkablydifferent than the actual recorded prices, the relative price movement is left intact.This adjustment process is logically consistent because we are creatingstrategies to trade relative price movement. Strategies in which the absolute pricelevel is used in trading decisions will not be applicable to our back adjusted data.Although this may sound like a dramatic flaw, there are very few strategies whereactual levels are critical in generating trading signals. For example, a 40-day highis still a 40-day high, regardless of how prices have been adjusted.
NORMALIZING STOCK AND FUTURES VOLATILITYThe next issue to tackle is determining the number of futures contracts and sharesof stock to trade in order to equalize each trading signal. As we saw in Chapter 2,the dollar value volatility of one S&P 500 contract is much larger than the doll