1,232 Pages • 458,682 Words • PDF • 25.5 MB
+ trading+ Systems+ methods
Uploaded at 2021-08-19 04:28
Report DMCA
PREVIEW PDF
Trading Systems and Methods
Founded in 1807, John Wiley & Sons is the oldest independent publishing company in the United States. With offices in North America, Europe, Australia and Asia, Wiley is globally committed to developing and marketing print and electronic products and services for our customers’ professional and personal knowledge and understanding. The Wiley Finance series contains books written specifically for finance and investment professionals as well as sophisticated individual investors and their financial advisors. Book topics range from portfolio management to e-commerce, risk management, financial engineering, valuation and financial instrument analysis, as well as much more. For a list of available titles, visit our Web site at www.WileyFinance.com.
Trading Systems and Methods Fifth Edition
PERRY J. KAUFMAN
John Wiley & Sons, Inc.
Cover image: Nikada/iStockphoto Cover design: John Wiley & Sons, Inc. Copyright © 2005, 2013 by Perry J. Kaufman. All rights reserved. Published by John Wiley & Sons, Inc., Hoboken, New Jersey. Published simultaneously in Canada. No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning, or otherwise, except as permitted under Section 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, Inc., 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600, or on the Web at www.copyright.com. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at http://www.wiley.com/go/permissions. Limit of Liability/Disclaimer of Warranty: While the publisher and author have used their best efforts in preparing this book, they make no representations or warranties with respect to the accuracy or completeness of the contents of this book and specifically disclaim any implied warranties of merchantability or fitness for a particular purpose. No warranty may be created or extended by sales representatives or written sales materials. The advice and strategies contained herein may not be suitable for your situation. You should consult with a professional where appropriate. Neither the publisher nor author shall be liable for any loss of profit or any other commercial damages, including but not limited to special, incidental, consequential, or other damages. For general information on our other products and services or for technical support, please contact our Customer Care Department within the United States at (800) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002. Charts created using TradeStation. ©TradeStation Technologies, Inc. 2001–2012. All rights reserved. No investment or trading advice, recommendation or opinions is being given or intended. Wiley publishes in a variety of print and electronic formats and by print-on-demand. Some material included with standard print versions of this book may not be included in e-books or in print-on-demand. If this book refers to media such as a CD or DVD that is not included in the version you purchased, you may download this material at http://booksupport.wiley.com. For more information about Wiley products, visit www.wiley.com. Library of Congress Cataloging-in-Publication Data: Kaufman, Perry J. Trading systems and methods / Perry J. Kaufman. — 5th ed. p. cm. Rev. ed. of: New trading systems and methods. 4th ed. c2005. Includes bibliographical references and index. ISBN 978-1-118-04356-1 (cloth) — 978-1-118-22224-9 (ebk) — 978-1-118-26092-0 (ebk)— 978-1-118-23603-1 (ebk) 1. Commodity exchanges—Statistical methods. 2. Technical analysis (Investment analysis) I. Kaufman, Perry J. New trading systems and methods. II. Title. HG6046.K34 2013 332.64′4–dc23 2012030903 Printed in the United States of America. 10 9 8 7 6 5 4 3 2 1
To Barbara
Contents Preface to the Fifth Edition CHAPTER 1
CHAPTER 2
xv
Introduction
1
The Expanding Role of Technical Analysis Convergence of Trading Styles in Stocks and Futures A Line in the Sand between Fundamentals and Technical Analysis Professional and Amateur Random Walk Deciding on a Trading Style Measuring Noise Maturing Markets and Globalization Background Material Research Guidelines Objectives of This Book Profile of a Trading System A Word about the Notation Used in This Book And Finally . . .
1
4 5 6 8 10 14 16 18 19 20 23 23
Basic Concepts and Calculations
25
About Data and Averaging On Average Price Distribution Moments of the Distribution: Variance, Skewness, and Kurtosis Standardizing Risk and Return The Index Standard Measurements of Performance Probability Supply and Demand
26 30 33
2
37 48 54 58 59 66
vii
viii
CHAPTER 3
CHAPTER 4
CHAPTER 5
CHAPTER 6
CONTENTS
Charting
79
Finding Consistent Patterns What Causes the Major Price Moves and Trends? The Bar Chart and Its Interpretation by Charles Dow Chart Formations Trendlines One-Day Patterns Continuation Patterns Basic Concepts in Chart Trading Accumulation and Distribution—Bottoms and Tops Episodic Patterns Price Objectives for Bar Charting Implied Strategies in Candlestick Charts Practical Use of the Bar Chart Evolution in Price Patterns
80
83 92 94 102 113 117 118 132 133 139 144 148
Charting Systems and Techniques
151
Dunnigan and the Thrust Method Nofri’s Congestion-Phase System Outside Days with an Outside Close Inside Days Pivot Points Action and Reaction Channel Breakout Moving Channels Commodity Channel Index Wyckoff ’s Combined Techniques Complex Patterns A Study of Charting Patterns Bulkowski’s Chart Pattern Rankings
152 155 157 158 158 159 167 170 171 172 173 176 178
Event-Driven Trends
181
Swing Trading Constructing a Swing Chart Using a Swing Filter Point-and-Figure Charting The N-Day Breakout
182 184 195 222
Regression Analysis
235
Components of a Time Series Characteristics of the Price Data
235 236
82
ix
Contents
CHAPTER 7
CHAPTER 8
CHAPTER 9
Linear Regression Linear Correlation Nonlinear Approximations for Two Variables Transforming Nonlinear to Linear Evaluation of Two-Variable Techniques Multivariate Approximations ARIMA Basic Trading Signals Using a Linear Regression Model Measuring Market Strength
238 248 252 256 257 259 267
Time-Based Trend Calculations
279
Forecasting and Following Price Change over Time The Moving Average Geometric Moving Average Accumulative Average Reset Accumulative Average Drop-Off Effect Exponential Smoothing Plotting Lags and Leads
279 284 284 292 293 293 293 293 307
Trend Systems
309
Why Trend Systems Work Basic Buy and Sell Signals Bands and Channels Applications of a Single Trend Comparison of Major Trend Systems Techniques Using Two Trendlines Multiple Trends and Common Sense Comprehensive Studies Selecting the Right Trend Method and Speed Moving Average Sequences: Signal Progression Early Exits from a Trend Moving Average Projected Crossovers
309 314 320 330 336 350 356 359
Momentum and Oscillators
369
Momentum Divergence Index Oscillators
370 384 385
273 276
359 363 366 366
x
CONTENTS
Double-Smoothed Momentum Velocity and Acceleration Hybrid Momentum Techniques Momentum Divergence Some Final Comments on Momentum
404 412 416 418 426
CHAPTER 10 Seasonality and Calendar Patterns
427
A Consistent Factor The Seasonal Pattern Popular Methods for Calculating Seasonality Seasonal Filters Seasonality and the Stock Market Common Sense and Seasonality
CHAPTER 11 Cycle Analysis Cycle Basics Uncovering the Cycle Maximum Entropy Cycle Channel Index Short Cycle Indicator Phasing
CHAPTER 12 Volume, Open Interest, and Breadth A Special Case for Futures Volume Variations from the Normal Patterns Standard Interpretation Volume Indicators Breadth Indicators Interpreting Volume and Breadth Systematically An Integrated Probability Model Intraday Volume Patterns Filtering Low Volume Market Facilitation Index
CHAPTER 13 Spreads and Arbitrage Dynamics of Futures Intramarket Spreads Carrying Charges Spreads in Stocks Spread and Arbitrage Relationships Risk Reduction in Spreads
428 429 430 456 478 483
485 485 494 514 520 521 523
527 527 529 531 535 546 554 558 559 562 564
565 566 567 569 570 571
xi
Contents
Arbitrage The Carry Trade Changing Spread Relationships Intermarket Spreads
CHAPTER 14 Behavioral Techniques Measuring the News Event Trading Commitment of Traders Report Opinion and Contrary Opinion Fibonacci and Human Behavior Elliott’s Wave Principle Price Target Constructions Using the Fibonacci Ratio Fischer’s Golden Section Compass System W. D. Gann—Time and Space Financial Astrology
CHAPTER 15 Pattern Recognition Projecting Daily Highs and Lows Time of Day Opening Gaps Weekday, Weekend, and Reversal Patterns Computer-Based Pattern Recognition Artificial Intelligence Methods
CHAPTER 16 Day Trading Impact of Transaction Costs Key Elements of Day Trading Trading Using Price Patterns Intraday Breakout Systems Intraday Volume Patterns Intraday Price Shocks
CHAPTER 17 Adaptive Techniques Adaptive Trend Calculations Adaptive Variations Other Adaptive Momentum Calculations Adaptive Intraday Breakout System An Adaptive Process Considering Adaptive Methods
572 596 600 602
617 618 623 635 641 648 651 660 662 666 671
685 687 689 699 711 732 735
737 738 744 753 759 774 775
779 779 788 793 796 797 798
xii
CONTENTS
CHAPTER 18 Price Distribution Systems Measuring Distribution Use of Price Distributions and Patterns to Anticipate Moves Distribution of Prices Steidlmayer’s Market Profile Using Daily Distributions to Identify Support and Resistance
CHAPTER 19 Multiple Time Frames Tuning Two Time Frames to Work Together Elder’s Triple-Screen Trading System Robert Krausz’s Multiple Time Frames Martin Pring’s KST System
CHAPTER 20 Advanced Techniques Measuring Volatility Using Volatility for Trading Trade Selection Using Volatility Liquidity Trends and Price Noise Trends and Interest Rate Carry Expert Systems Fuzzy Logic Fractals, Chaos, and Entropy Neural Networks Genetic Algorithms Replication of Hedge Funds
CHAPTER 21 System Testing Expectations Identifying the Parameters Selecting the Test Data Testing Integrity Searching for the Best Result Visualizing and Interpreting Test Results Large-Scale Testing Refining the Strategy Rules Arriving at Valid Test Results Comparing the Results of Two Systems Profiting from the Worst Results
801 801 805 811 822 830
833 833 835 838 842
845 845 856 861 867 868 871 871 875 880 886 895 902
905 907 908 910 916 919 922 932 937 938 946 950
xiii
Contents
Retesting for Changing Parameters Testing across a Wide Range of Markets Price Shocks Anatomy of an Optimization Summarizing Robustness
CHAPTER 22 Practical Considerations Use and Abuse of the Computer Extreme Events Gambling Techniques—The Theory of Runs Selective Trading System Trade-Offs Trading Limits and Disconnected Markets Silver and NASDAQ—Too Good to Be True Similarity of Systematic Trading Signals
CHAPTER 23 Risk Control Mistaking Luck for Skill Risk Aversion Liquidity Measuring Return and Risk Leverage Leverage Based on Exposure Individual Trade Risk Kaufman on Stops and Profit-Taking Ranking of Markets for Selection Probability of Success and Ruin Entering a Position Compounding a Position Equity Trends Investing and Reinvesting: Optimal f Comparing Expected and Actual Results
CHAPTER 24 Diversification and Portfolio Allocation Diversification Changing Correlations Types of Portfolio Models Classic Portfolio Allocation Calculations Finding Optimal Portfolio Allocation Using Excel’s Solver Kaufman’s Genetic Algorithm Solution to Portfolio Allocation (GASP) Volatility Stabilization
951 954 970 972 976
983 984 992 1000 1011 1012 1018 1020 1021
1027 1027 1028 1033 1034 1046 1049 1050 1059 1062 1072 1076 1080 1085 1088 1092
1099 1100 1105 1105 1107 1109 1114 1142
xiv
CONTENTS
APPENDIX 1 Statistical Tables
1147
APPENDIX 2 Matrix Solution to Linear Equations and Markov Chains
1151
APPENDIX 3 Trigonometric Regression for Finding Cycles
1161
Bibliography
1175
About the Companion Website
1191
Index
1193
Preface to the Fifth Edition
I
n the past eight years, since the last edition, our industry has continued to change. The extraordinary bull market of the late 1990s, followed by the bursting of the tech bubble in 2000 seemed to be events that could never be overshadowed, but the subprime collapse in 2007 proved us wrong. We learned what risk was all about, when money was pulled from every possible investment at the same time. In many cases, the investments that were liquidated had no other relationship than having profits that were needed to cover losses elsewhere. The principles of diversification held true, but we saw the worstcase scenario, where everything moved in the same way at the same time. It was an event with a very low probability, but not zero. During the years that have followed, we would expect much more focus on risk management, rather than risk measurement. Understanding how to reduce risk before the fact is much more productive than identifying it afterward. Some hedge funds, following in the steps of Long-Term Capital Management, have chosen to see this as a rare event, not likely to be repeated. The rationale for this is that, in order to reduce the chances of large risk, you must also reduce returns. They see investors as preferring the small chance of a large loss to the less acceptable assurance of lower profits. I won’t try to judge the merits of this decision. On the other hand, we should all understand the best choices for controlling risk. With that in mind, many of the changes in this edition address risk control, from the individual trade level, to the strategy rules, to the portfolio.
COHERENCE One of the improvements in this edition is the added coherence from one section to another and from one chapter to another. There will be references, both forward and backward, showing similarities between many techniques. By incorporating those references, some of the duplication has been removed. Considerable effort was made to use the same notation throughout the book, in hope that it will make the formulas easier to understand. You will also find that there is a greater attempt to make this material flow from section to section as a continuous learning process.
xv
xvi
PREFACE TO THE FIFTH EDITION
MORE STRATEGIES, MORE PROGRAMS AND SPREADSHEETS Each year brings new ideas, and many articles and books have shed light on new techniques or better ways to approach an old problem. Wherever possible, those ideas have been added here, with references to the original material. There is more cross-pollination with the securities industry, and you will find more terms now used by both futures and stock traders. Examples make learning easier, and this edition has many more examples, along with more programs and spreadsheets that will help you take whichever ideas are appealing and try them on your own. Wherever possible, the spreadsheet code uses “offset” to allow the calculation periods to be changed. These examples continue to use TradeStation and Excel, which remain the most popular tools. While there are many other choices, code from these two sources can be easily converted to other programs.
UPDATED CHARTS Along with more examples, many of the old examples and charts have been brought up to date. While there may be an historic interest in market patterns during the 1970s and 1980s, the recent 10 years provide dramatic price movements and seem more relevant. We would all agree that it’s good for a strategy to have been profitable in the 1980s, but more important that it succeeded during the past 5 or 10 years. In many cases, the old patterns are still unique and should not be ignored, but every book has its limits.
SEARCHING FOR ROBUSTNESS The goal of a system developer and/or a trader is to find or create a trading method that will work in many different situations, hopefully across many different markets, and keep working for as long as possible. A solution that is robust satisfies those objectives. Because if its importance, there are comments throughout the book addressing the robustness of various methods and ways to enhance that quality. Chapter 21, System Testing, addresses this directly, but it is not the only place. Robustness is an easy concept to understand, but a robust strategy has a return and risk profile that is not as attractive as one that has been fitted to the data. Success with fewer rules over more markets and data yields robustness, but at the price of lower returns and higher risk. It is necessary to understand and embrace the natural risk of a strategy and market in order to succeed in the long term. If you try to engineer all of the risk out of a trade, it will only surface somewhere else when it is least welcome.
Preface to the Fifth Edition
xvii
COMPANION WEBSITE The companion website has been greatly expanded with both TradeStation programs (Version 9) and Excel 2010 spreadsheets. It is expected that MetaStock code will be added in the near future. There is also a list of contents at the back of this book. Whenever a website program relates to a section of the book, there is an icon in the margin to remind you of its availability. Hopefully, this will make the development and verification of new ideas more convenient.
WITH APPRECIATION This book draws on the hard work and creativity of hundreds of traders, financial specialists, engineers, and many others who are passionate about the markets. They continue to redefine the state-of-the-art and provide all of us with both profitable techniques and valuable tools. A long overdue thanks to Janette Perez of TradeStation for her generous help. My gratitude to Pamela van Giessen and Emilie Herman of John Wiley & Sons, who continue to provide immeasurable help and encouragement. And to my wife, Barbara, whose everlasting support is only enhanced by rolling her eyes whenever I say that this is my last book, ever. As a final note, I would like to thank all the previous readers who sent messages about typographical errors, omissions, and just simple errors. They have all been corrected. It makes this edition that much better. PERRY J. KAUFMAN Freeport, Grand Bahama November 2012
CHAPTER 1
Introduction
It is not the strongest of the species that survive, nor the most intelligent, but the ones most responsive to change. —Charles Darwin
L
et’s start by redefining the term technical analysis. Technical analysis is the systematic evaluation of price, volume, breadth, and open interest, for the purpose of price forecasting. A systematic approach may simply use a bar chart and a ruler, or it may use all the calculation power available. Technical analysis may include any quantitative analysis as well as all forms of pattern recognition. Its objective is to decide, in advance, where prices will go over some time period, whether 1 hour, 1 day, or 5 years. Technical analysis must have clear and complete rules. Technical analysis is no longer just the study of chart patterns or the identification of trends. It encompasses intramarket analysis, complex indicators, mean reversion, and the evaluation of test results. It can use a simple moving average or a neural network to forecast price moves. This book serves as a reference guide for all of these techniques, puts them in some order, and explains the functional similarities and differences for the purpose of trading. It includes some aspects of portfolio construction and multilevel risk control, which are integral parts of successful trading.
THE EXPANDING ROLE OF TECHNICAL ANALYSIS Quantitative methods for evaluating price movement and making trading decisions have become a dominant part of market analysis. Those who do not use methods such as overbought and oversold indicators are most likely to watch them along the bottom of their screen. The major financial networks are always pointing out price trends and double bottoms, and are quick to say that a price move up or down was done on low volume to show 1
2
TRADING SYSTEMS AND METHODS
that it might be unreliable. The 200-day moving average seems to be the benchmark for trend direction. These comments show the simplicity and the acceptance of technical analysis. Events beginning in 2002 cast doubt on the integrity of the research produced by major financial houses that have a conflict between financing/underwriting and retail brokerage. The collapse of Enron has caused us to question the earnings, debt, qualityof-business, and other company data released to the public by large and small firms. It is not surprising that more quantitative trading methods have been adopted by research firms. When decisions are made with clear rules and calculations that can be audited, those analysts recommending buys and sells are safe from scrutiny. Extensive quantitative trading exists around the world. Interest rate arbitrage is a major source of revenue for banks. Location arbitrage is the process that keeps the price of gold and other precious metals the same all over the globe. Program trading keeps the price of the overall stock market from diverging from S&P futures and SPY (the SPDR ETF) prices. Recently these fully automated systems have been called algorithmic trading. If you don’t think of arbitrage as technical trading, then consider market neutral strategies, where long and short positions are taken in related markets (pairs trading) in order to profit from one stock rising or falling faster than the other. If you change your time horizon from hours and days to milliseconds, you have high frequency trading. You might prefer to take advantage of the seasonality in the airline industry or try your hand trading soybeans. Both have clear seasonal patterns as well as years when other factors (such as a disruption in energy supply) overwhelm the seasonal factors. Trading seasonal patterns falls under technical analysis. Technology that allows you to scan and sort thousands of stocks, looking for key attributes—such as high momentum, a recent breakout, or other indicator values—is also technical analysis on a broader scale. High frequency trading, arbitrage that lasts only milliseconds, has become a profit center for large financial institutions, but involves placing computer equipment as close to the source of the exchange price transmission as possible—a contentious issue. High frequency trading is credited for adding liquidity by increasing volume in equities trading, but has also been blamed (perhaps unfairly) for spectacular, highly volatility price moves. Most impressive is the increase in managed funds that use technical and quantitative analysis. Many billions of investment dollars are traded using trend-following systems, short-term timing, mean reversion, and countless other techniques. It is thought that well over half of all managed money uses algorithmic trading. Technical analysis allows you to backtest and estimate the expected risk, two great advantages to the fund manager. The use of technical analysis has infiltrated even the most guarded fundamental fortresses.
CONVERGENCE OF TRADING STYLES IN STOCKS AND FUTURES The development of technical analysis has taken a different path for stocks and futures. This seems natural because the two markets cater to investors with different time frames
Introduction
3
and different commercial interests. At the same time, the markets place very different financial demands on the investor. The original users of the futures markets were grain elevators and grain processors, representing the supply side and the demand side. The elevators are the grain wholesalers who bought from the farmers and sold to the processors. The futures markets represented the fair price, and grain elevators sold their inventory on the Chicago Board of Trade in order to lock in a price (hopefully a profit). The processors, typically bread manufacturers or meat packers, used the futures markets to lock in a low price for their material cost and as a substitute for holding inventory. Both producer (the sell side) and processor (the buy side) only planned to hold the position for a few weeks or a few months, until they either delivered their product to market or purchased physical inventory for production. There was no long-term investment, simply a hedge against risk. Futures contracts, similar to stock options, expire every two or three months and can be held for about one year; therefore, it is nearly impossible to “invest” in futures. One other critical difference between futures and stocks is the leverage available in futures. When a processor buys one contract of wheat, that processor puts up a good faith deposit of about 5% of the value of the contract. If wheat is selling for $10.00 a bushel and a standard contract is for 5,000 bushels, the contract value is $50,000. The processor need only deposit $2500 with the broker. The processor is essentially buying with leverage of 20:1. In the 1970s, the futures trader paid an outrageous round-turn commission of $50 per contract. This is about 0.3 of 1 percent, far less than the stock market cost of 1%, but one of the highest commission ratios in the futures industry. Now, years after negotiated commissions have become part of the system, the fee is closer to $8, or 0.05 of one percent. Commission costs are so low that they are not a consideration when trading futures. To be fair, the cost of trading equities has also dropped in the same way, but favors those trading larger positions. How do the high leverage and low commissions affect trading in futures? Low costs allow short holding periods. Floor traders don’t invest—they look to scalp the market or capture a fast, volatile price move. In the derivatives markets, fast is 1 to 3 days, and slow is anything longer than 30 days. Although speculation has always had a place in the stock market, the investor, rather than the trader, has been the major force. The stock market is an investment in America. The growth of the economy parallels the growth and efficiency of industry. Of course, commissions and tax regulations played a large part in shaping the long-term view of the investor. When commission costs were 1% for each buy and sell order, it was not possible to be a short-term trader. That role was reserved for the market maker on the floor of the stock exchange. It is difficult to be a trader of any sort when you pare 2% from each of your trades. Even now, some mutual funds charge high fees or penalties for liquidating a position before six months or one year. In addition, favorable tax treatment strongly encouraged holding positions for at least six months to satisfy the long-term capital gain rule. The uptick rule for selling discouraged speculating on the decline of stock prices, and while it is not in effect at this time, politicians are inclined to reinstate it in the belief
4
TRADING SYSTEMS AND METHODS
that it will reduce market volatility. Even now, short sales are not allowed in most retirement funds. To get around these rules, exchange-traded funds (ETFs) such as SPY and QQQ allow buying and short selling with no expiration date and low cost. The main differences between trading ETFs and futures is that futures allow leverage, trade in larger size, expire at fixed intervals, and are guaranteed by a major institution, such as the Chicago Mercantile Exchange. Because of the low cost in stocks and the new trading vehicles in the form of ETFs, stock traders now look to the methods used by futures traders to identify trends and mean-reverting opportunities faster and use tighter risk controls.
A LINE IN THE SAND BETWEEN FUNDAMENTALS AND TECHNICAL ANALYSIS The market is driven by fundamentals. These are often employment, GDP, inflation, consumer confidence, supply and demand, or geopolitical factors—all of which create expectations of price movement. But it is just too difficult to trade using those facts, and economists have never been very accurate. Economic reports are not usually timely, and individual companies are not forthcoming about problems. We have had too many cases where the data we use to make fundamental decisions about individual companies have been unreliable. We can add that to the conflict of interest inherent in the government’s calculation of the Consumer Price Index, because an increase in the CPI requires that all those receiving Social Security checks get a cost-of-living increase. Technical analysis, when used to determine the long-term direction of prices, attempts to objectively evaluate these complex fundamentals. It is no different from the economists who use regression, seasonal, and cyclic analysis to forecast the economy. The technical trader can use those tools as well as chart trendlines, pattern recognition, and probability distributions. Perhaps the economists are doing the same thing. It is well known that the Federal Reserve monitors trading and prices in order to decide how to time their interest rate changes and, when necessary, their currency intervention. All monetary authorities know that when their currency is rising too fast, you don’t try to stop it. If the public wants to buy the Japanese yen, the Central Bank doesn’t have enough clout to stop it unless it first waits for the move to be exhausted. It must use its resources carefully, and it uses market know-how and price analysis to time its actions. The primary advantages of a technical approach are that it is objective and completely well-defined. The accuracy of the data is certain. One of the first great advocates of price analysis, Charles Dow, said: The market reflects all the jobber knows about the condition of the textile trade; all the banker knows about the money market; all that the best-informed president knows of his own business, together with his knowledge of all other businesses; it sees the general condition of transportation in a way that the president of no single railroad can ever see; it is better informed on crops than the farmer or even
Introduction
5
the Department of Agriculture. In fact, the market reduces to a bloodless verdict all knowledge bearing on finance, both domestic and foreign. Much of the price movement reflected in any market is anticipatory; it results from the expectations of the effects of macroeconomic developments or the outcome of good corporate management and new products. Markets, however, are subject to change without notice. For example, the government may block the merger of two companies, or approve or reject a new drug. A hurricane bound for the Philippines will send sugar prices higher, but if the storm turns off course, prices reverse. Anticipation of employment reports, housing starts, or corn production reports causes highly publicized professional estimates, which may correctly or incorrectly move prices before the actual report is released. Markets then react to the accuracy of the estimates rather than to the economic data itself. By the time the public is ready to act, the news is already reflected in the price.
PROFESSIONAL AND AMATEUR Beginning technical traders may find a system or technique that seems extremely simple and convenient to follow, one that appears to have been overlooked by the professionals. Most often there is a simple reason why that method is not used. As you learn more about trading, you find that execution is difficult, or the risk is much higher than originally expected, or that the system has too many losses in a row. Trading is a business, not one to be taken casually. As Richard Wyckoff said, “Most men make money in their own business and lose it in some other fellow’s.” Plan to invest your time before your money, so that when you begin trading, you have more realistic expectations. That does not mean that simple systems don’t work, but that each has a return and risk profile that is typical of that style and difficult to change. One purpose of this book is to present many different trading methods, each with its own risk and reward profile, so that each trader understands the true cost of trading. To compete with a professional speculator you must be more accurate in anticipating the next move. This can be done by • Recognizing recurring patterns in price movement and determining the most likely results of such patterns. • Identifying the “trend” of the market by isolating the basic direction of prices over a selected time interval. The bar chart, discussed in Chapter 3, is the simplest representation of the market. These patterns are the same as those recognized by Jesse Livermore, in the early 1900s, on the ticker tape. Because they are interpretive, more precise methods such as pointand-figure charting are also used, which add a level of exactness to charting. Point-andfigure charts are popular because they offer specific trading rules and show formations similar to both bar charting and ticker-tape trading.
6
TRADING SYSTEMS AND METHODS
Mathematical modeling, using traditional regression or statistical analysis, has become a popular technique for anticipating price direction. Most modeling methods are modifications of developments in econometrics and basic probability and statistical theory. They are precise because they are based entirely on numerical data; however, they need trading rules to make them operational. The proper assessment of the price trend is critical to most trading systems. Countertrend trading, which takes a position opposite to the trend direction, is just as dependent on knowing the trend as a trend-following technique. Large sections of this book are devoted to the various ways to identify the trend, although it would be an injustice to leave the reader with the idea that a “price trend” is a universally accepted concept. There have been many studies published claiming that price trends do not exist. The most authoritative papers on this topic are collected in Cootner, The Random Character of Stock Market Prices; very readable discussions can be found in the Financial Analysts Journal, an excellent resource. Personal money management has an enormous number of tools, many of which can be found in Excel and other spreadsheet software. These include linear regression and correlation analysis. There is also inexpensive software to perform spectral analysis and apply advanced statistical techniques. There is an Excel add-in, Solver, that can easily be adapted to portfolio allocation. Trading systems development software, such as TradeStation and MetaStock, have provided platforms and greatly reduced the effort needed to program your ideas. Professionals maintain the advantage of having all of their time to concentrate on the investment problems; however, nonprofessionals are no longer at a disadvantage.
RANDOM WALK It has been the position of many advocates of fundamental and economic analysis that there is no sequential correlation in the direction of price movement from one day to the next; that is, prices have no memory of what came before—this has been named the random walk theory. Prices will seek a level that will balance the supply-demand factors, but that level will be reached either instantaneously, or in an unpredictable manner, as prices move in response to the latest available information or news release. If the random walk theory is correct, the many well-defined trading methods based on mathematics and pattern recognition will fail. The problem is not a simple one, but one that should be resolved by each system developer because it will influence the type of systematic approaches that best suits them. There are two arguments against random movement in prices. The first argument is simply the success of many algorithmic trading strategies. There is definitive documentation of performance for systematized arbitrage programs, hedge funds, and derivatives funds, showing success for upwards of 20 or 30 years. This is not to say that all technical programs are successful—far from it. But neither
Introduction
7
are fundamental methods. You still need a sound strategy, whether discretionary or systematic, in order to be profitable. Not everyone can create and implement such a strategy. The second argument against the random walk is that prices move on anticipation. One can argue academically that all participants (the “market”) know exactly where prices should move following the release of news. However practical or unlikely this is, it is not as important as market movement based on anticipation of further movement. For example, if the Fed lowered rates twice this year and the economy has not yet responded, would you expect it to lower rates again? Of course you would. Therefore, as soon as the Fed announces a rate cut you would speculate on the next rate cut. When most traders hold the same expectations, prices move quickly to that level. Prices then react to further news relative to expectations. Is this price movement that conforms to the random walk theory? No. But the actual pattern of price movement can appear similar to random movement. Excluding anticipation, the apparent random movement of prices is dependent on both the time interval and the frequency of data observed. When a long time span is used, from 1 to 20 years, and the data averaged to enhance the smoothing process, the trending characteristics appear more clearly, along with seasonal and cyclic variations. Technical methods, such as moving averages, are often used to isolate these price characteristics. Averaging daily or weekly data to create monthly or quarterly prices smooth out irregular short-term movements, resulting in higher correlations between successive prices. With less frequent data, it is easier to see a trend. In general, the use of daily data shows more noise (random movement) than weekly or monthly data. In the long run, prices seek a level of equilibrium. For stocks, equilibrium is where the return on investment (appreciation of share value plus dividends), balanced with the risk of the investment, puts it on an equal footing with the returns of a risk-free investment, such as Treasury notes. In futures, equilibrium is the balance between supply and demand. Prices do not move in a symmetric pattern, and they do not have a normal distribution: two additional facts that argue against random walk. The asymmetry of the index markets, in particular those built on traditional stocks, is easy to understand because the public consists overwhelmingly of buyers. But it is also the nature of price movement to show unique patterns when prices move farther from their normal value during periods of stress, or exceptional supply and demand imbalance. When looking at price movement in terms of “runs”—hours or days when prices continue in the same direction for an unusually long sequence—we find that price data has a fat tail, representing much longer runs than can be explained by a normal distribution. The existence of a fat tail also means that some other part of the distribution must differ from the norm because the extra data in the tail must come from somewhere else. Throughout this book, we refer to these differences in price patterns as the reason why certain trading methods work. Price movement is driven by people, and people can buy and sell for nonrandom reasons, even when viewed in large numbers. For example, an investment fund will enter the
8
TRADING SYSTEMS AND METHODS
market without regard to timing, based on their monthly additions or redemptions. This in turn moves prices and creates opportunities that allow traders to profit. The long-term trends that reflect economic policy, normally identified by quarterly data, can be of great interest to longer-term position traders. It is the short-term price movements caused by anticipation (rather than actual events), extreme volatility, prices that are seen as far from value, countertrend systems that rely on prices reversing direction, and those that attempt to capture trends of less duration that are the primary focus of this book.
DECIDING ON A TRADING STYLE It may seem backwards to talk about a trading style in advance of reading all the material, but many traders have already decided that they want to day trade or hold long-term positions because it suits their disposition, their belief of what moves prices, or their time schedule. With that in mind, short-term and long-term traders will focus on different strategies and markets, while portfolio structure and risk control will be much the same for either approach. To understand how markets and different trading styles work together, consider a daily chart of any market, an individual stock, a short-term interest rate futures contract, or the S&P 500 index. There are periods of trending and sideways patterns. However, if you change that chart from daily to weekly, or daily to monthly, the long-term trend emerges. It is much easier to see the trend when you use fewer data points over a longer time interval. The presentation of the chart smoothes the appearance of the data (see Figures 1.1 and 1.2). Now go in the other direction, using 20-minute bars instead of a daily chart. The trend is more difficult to see. What appeared to be a smooth period leading up to the peak
FIGURE 1.1 Crude oil daily chart with July 2008 in the center.
Introduction
9
FIGURE 1.2 Crude oil weekly chart with July 2008 to the right of center.
in July 2008 (Figure 1.3), now looks very erratic. As the bars become shorter, the price noise appears to increase. Selecting a price frequency that complements your trading strategy is often ignored by traders. If you are a long-term, macrotrend follower, then you want the price series that shows more trends, which are improved by monthly, weekly, or daily charts, although monthly is generally too low frequency for traders. Short-term traders focus on mean reversion or fast directional price moves, and that strategy is enhanced using higherfrequency data, such as hourly or 15-minute bars.
FIGURE 1.3 Crude oil 20-minute chart with July 2008 in the center.
10
TRADING SYSTEMS AND METHODS
MEASURING NOISE The need to select the data frequency that best suits the strategy can be verified by measuring price noise. Noise is the erratic movement that surrounds the underlying direction of prices at any time. High noise can be compared to a drunken sailor’s walk, while low noise is a straight line from the starting to the ending point. There are a number of ways to measure noise, including price density, efficiency ratio (also called fractal efficiency), and fractal dimension. It is important that these measurements remove volatility because noise should not be confused with volatility. In Figure 1.4 a short, hypothetical period of price movement gives an example of noise measured by the efficiency ratio (ER). ER is calculated by dividing the net move (the change for point A to point B) by the sum of the individual moves during that period, each taken as positive numbers. E ciency ratio = Effi
Net change n in price ( a as a positive number e ) Sum of o individual price change n s(as ( positive numbers)
or ER Rt =
Pt
Pt − n
∑ t t− n Pi i t
Pi −1
where n is the calculation period. Figure 1.5 illustrates the relative level of noise that might comprise a price move of the same net change. The straight line indicates no noise, the smaller changes that move above and below the straight line would be medium noise, and the large swing are high noise. However, in this example it is not possible to distinguish the level of noise from volatility, yet they are not the same. In Figure 1.6, the net change in price is from 440 to 490 480
B
470
7
5
460
1
3
2
450
6
4
net move
440 A 430 1
2
3
4
5
6
7
8
FIGURE 1.4 Basic measurement of noise using the efficiency ratio (also called fractal efficiency).
11
Introduction
Levels of Noise
550 530 510 Price
490 470
None
450
Medium
430
High
410 390 370
1
2
3
4
5
6
7
8
FIGURE 1.5 Three different price patterns all begin and end at the same point. The straight line shows no noise, the smaller variations are medium noise, and the larger swings are high noise.
475 in one case and from 440 to 750 in the other, yet the sum of the individual component changes are similar, 595 and 554. The efficiency ratio is 0.06 for the first and 0.56 for the second, showing that the first is very noisy while the second has relatively low noise (see Table 1.1). Remember that a ratio near 1 shows a strong trend, and a ratio near 0 only noise. If prices are moving up quickly, then even large swings may not be considered a serious interference with the trend.
Other Measurements of Noise The previous example of noise used the efficiency ratio; however, price density and fractal dimension may also be used. Intuitively, price density can be seen as the extent to Same Volatility, more gain = less noise 800 750 700
Price
650 600
More noise
550
Less noise
500 450 400 350
1
2
3
4
5
6
7
8
FIGURE 1.6 By changing the net price move, we can distinguish between noise and volatility. If the sum of the individual price changes are the same, but the net move is larger, then the noise is less.
12
TRADING SYSTEMS AND METHODS
TABLE 1.1 These price changes, reflecting the patterns in Figure 1.6, show that larger individual price changes do not correspond to higher noise if the net change over the entire period is much larger. Day
High noise
1 2 3 4 5 6 7 8 Net change Noise
Low noise
440 510 390 470 410 530 430 475 35
Diff high
Diff low
70 120 80 60 120 100 45 595 0.06
109 78 40 21 159 61 86 554 0.56
440 549 627 587 566 725 664 750 310
which prices fill a box. If we take a 10-day period of price movement charted with highs and lows, and draw a box touching the highest high and lowest low, then the density is how much of that box is filled. This is measured as
∑ i t−n+1 ( Highhi i t
Price Density =
Max a ( n - day high i )
Lowi )
Min ( n - day low)
Fractal dimension cannot be measured exactly but can be estimated over n days using the following steps: 1. Max = highest high over n days 2. Min = lowest low over n days 3. Range = max – min 2 4. dx =
5. L =
⎛ 1⎞ ⎝ n⎠ i =t
2
∑ i = t − n +1
6. FD = 1 +
dx 2 +
pi − pi −1 Rang a e
ln( L ) + ln(2) ln(2 × n )
There is a strong relationship between fractal dimension and the efficiency ratio (fractal efficiency), and there is a similarity in the construction of price density and fractal dimension. In step 5 the term inside the square root sign accumulates the change in price relative to the range over the calculation period. Of the three methods of measuring noise, the efficiency ratio seems to be the clearest, and that will be used in the following analyses.
13
Introduction
Impact on Trading To determine the significance of the efficiency ratio, a 20-day average noise was calculated for a wide range of futures and world equity index markets for January 2000 through March 2012. A corresponding 40-day moving average trend-following strategy was applied to the same markets (a complete discussion of trend systems can be found in Chapter 8). The trend system used the most basic rules, going long when the trendline turned up and short when it turned down. It was always in the market and there were no costs applied. The results of both the noise and corresponding trend results are scattered in Figure 1.7. Trend results are shown as a profit factor, gross profits divided by gross losses. Higher factors relate to better risk-adjusted returns. A simple regression line was drawn through the scatter diagram to emphasize the relationship. Figure 1.7 shows a pattern from the bottom left to the top right of the chart. Profit factors under 1.0 are net losses, those above 1.0 are gains. The noise is greatest on the left (at 0.204) and lowest on the right (about 0.266). The results can be interpreted as follows: Low noise is good for trend following and high noise is not. That interpretation can be taken further as high noise favors mean-reverting strategies. Tests over different time periods, such as the 1990s, will show much stronger trend than recently, and can shift returns higher, but the relationship of noise to success will remain the same. A closer look at the results shows that the markets in the top right are short-term interest rates, which are closely tied to Central Bank policy. The next trendiest markets
3.7 3.2
Profit Factor
2.7
2.2 AvgNoise
1.7
Linear (AvgNoise)
1.2 0.7 0.2 0.2
0.21
0.22
0.23
0.24
0.25
0.26
0.27
Efficiency Ratio (Noise)
FIGURE 1.7 A scatter of the average 40-day noise and the information ratio based on a simple 40-day trend system, over 12 years from 2000.
14
TRADING SYSTEMS AND METHODS
are the longer maturity rates, then USD crossrates, energy markets, and metals. At the far lower left on the chart are the equity index markets. Equity index markets have the greatest noise and the worse trend-following performance of all sectors. This concept will be extremely important when deciding on a trading style. Long-term traders, those interested in macrotrends, should combine low frequency data and longterm trends. Short-term traders should use high frequency data and favor mean-reverting strategies. Of course there are many exceptions to this approach, and opportunities are everywhere. This relationship of price noise, market patterns, and data frequency is intended to put a framework around the most common decisions made when developing trading strategies.
MATURING MARKETS AND GLOBALIZATION The level of noise in each market can tell us about the maturity of that market and the nature of traders actively using it. The U.S. equity markets are where companies go to finance their operations. Typical U.S. workers participate in the equity markets indirectly through their retirement programs, and many are actively involved in making the decisions in the allocation of those funds. The most conservative choose money markets or guaranteed government debt obligations; others allocate a portion to the overall market using S&P ETFs, and still others choose specific sectors or even individual stocks to allocate part of their resources. Other countries are not as involved in their equity markets, even though movement of the equity index in these countries reflects the health of their economy. With less involvement, there is less liquidity and participation is limited to a narrow, less homogeneous group of investors or traders. However, most world markets are becoming more active, even if that liquidity comes from globalization, where traders from one country buy and sell shares in another country. If we look at the history of price noise as reflected in the North American equity index markets, there is a steady increase in noise over the past 20 years (see Figure 1.8). This corresponds to the increase in volume of those markets, reflected in the S&P cash index, SPX, shown in Figure 1.9. This increase in volume, corresponding to the maturity of the market, is not restricted to the United States or Europe, but a general phenomenon affecting all markets. Figure 1.10 shows the pattern in 5-year intervals grouped by geographic region: greater Asia, Australia and New Zealand, Eastern Europe, Europe (including the U.K.), Latin America, North America, and South America. The left scale is the average noise of all markets in that group. The overall picture is that the markets in all regions are maturing and that this maturity can come swiftly, as shown in Eastern Europe. There is an interesting exception in Latin America (represented only by Mexico) where the noise value has increased, representing less liquidity. This would not happen if the group was diversified and is the result of decreasing confidence in the economy, hence less liquidity. The European region shows a move up in the past five years. Unlike in the United States, European
15
Introduction
North America 0.400 0.350 0.300 0.250 0.200 0.150 0.100 0.050 0.000 1990–1994
1995–1999
2000–2004
2005–2009
FIGURE 1.8 By measuring the market noise of North American equity index markets during 5-year intervals, we can see the increase in noise over the past 20 years. 1400000
SPX Volume
1200000 1000000 800000 600000 400000 200000
10 20
09
3/ 8/
08
20 3/
8/
07
20 3/
8/
06
20 3/
8/
05
20
20
3/ 8/
04
3/ 8/
03
20 3/
8/
02
20 3/
8/
01
20 3/
8/
00
20
20
3/ 8/
99
3/ 8/
19 3/
3/ 8/
8/
19
98
FIGURE 1.9 Volume traded of the S&P 500 index components for the most recent 10 years.
Market Usage by Region 0.600 0.500 0.400
1990–1994
0.300
1995–1999
0.200
2000–2004
0.100
2005–2009
0.000
Asia
Australia NZ
Eastern Europe
Europe
Latin America
North America
South America
FIGURE 1.10 Relative change in maturity of world markets by region.
16
Japan Topix
Japan Nikkei 225
Hong Kong Hang Seng
Singapore Straits Times
Taiwan TWSE
S. Korea Kospi
Philippine Comp
India Nifty
India Sensexx
India Bombay 100
Indonesia Jakarta Comp
China Shenzhen B
Bangladesh Dhaka Index
China Shenzhen A
China Shenzhen Comp
China Shanghai Comp
Pakistan Karachi
Malaysia Kuala Lumpurr
Pakistan KSE100
Sri Lanka Colombo
0.450 0.430 0.410 0.390 0.370 0.350 0.330 0.310 0.290 0.270 0.250
Vietnam Ho Chi Minh
TRADING SYSTEMS AND METHODS
FIGURE 1.11 Ranking of Asian Equity Index Markets, 2005–2010.
investors are not as committed to the equity markets, and the economic crisis of the past few years has resulted in more investors exiting those markets than in the United States. Asia is the most important area of world development at this time. China, which holds most of the U.S. debt, has given a great deal of economic freedom to its people, but limited access to the equity markets for outside investors. Figure 1.11, which is ranked from higher to lower noise values (less maturity to more maturity) from left to right, shows the relative development of the Asian equity markets. It is not surprising that Japan is the most developed, followed by Hong Kong, Singapore, South Korea, and Taiwan. These represent the most open economies in Asia. At the other end are Sri Lanka, Vietnam, Pakistan, and Malaysia, countries without access to global investors. India’s Sensex shows greater participation than the China Shanghai Composite, but both are toward the center of the ranking. Those countries that allow greater access to traders in the futures will move toward the right in the ranking. For now, the Shanghai Composite shows an average value of about 0.37, while the North American markets are at 0.25.
BACKGROUND MATERIAL The contents of this book assume an understanding of the stock market and futures markets, such as the S&P 500 and Treasury notes. These futures markets have a great impact on stock patterns and trade 24 hours a day. The rules and mechanics of those markets are not explained here unless they directly relate to a trading strategy. Ideally the reader should have read one or more of the available trading guides and should understand the workings of a buy or sell order and the contract specifications of futures. Experience in actual trading would be helpful. A professional trader, a broker, or a purchasing agent will already possess all the qualifications necessary, as will any businessperson
Introduction
17
who understands how prices reflect earnings and the need to accumulate inventory at the lowest price. Individuals who manage their own stock portfolio or watch one of the financial news networks are also qualified. It also helps if you enjoy playing competitive games and you like to win. There are excellent books available to both the beginning and advanced trader. The ones that stand out as valuable sources of general information are Jack Schwager’s twovolume set, Schwager on Futures, which includes one volume on fundamental analysis and one on technical analysis. John Murphy’s Technical Analysis of the Futures Markets, second edition, and Intermarket Technical Analysis are highly recommended. There are excellent books on more specific topics. Of these you should consider reading John Bollinger’s Bollinger on Bollinger Bands and Martin Pring’s Pring on Market Momentum. Two other more comprehensive books worth considering are Peter Bernstein’s The Portable MBA in Investment and The Encyclopedia of Technical Market Indicators by Robert W. Colby and Thomas A. Meyers; the latter offers an intelligent description of the calculation and trading performance of many market indicators that could be used by traders. Comparing the results of different indicators side by side can give you valuable insight into the practical differences in these techniques. More recently, Thomas Bulkowski’s Encyclopedia of Chart Patterns is a well-organized, clear review and analysis of all chart patterns. The basic reference book for general contract information has always been the Commodity Trading Manual, but each yearr Futures magazine publishes a Reference Guide that gives the trading hours, contract size, and other specifications of the primary futures and options markets traded around the world. All of this information is also available on the Internet. For reviewing the basics there is Jeffrey B. Little and Lucien Rhodes, Understanding Wall Street, third edition, and Todd Lofton’s Getting Started in Futures, fourth edition. The introductory material is not repeated here. A good understanding of the most popular charting method requires reading the classic by Robert D. Edwards and John Magee (and now W. H. C. Bassetti), Technical Analysis of Stock Trends, eighth edition (originally published by John Magee), a comprehensive study of bar charting. For a constant flow of both classic and new techniques, the magazines The Technical Analyst (a U.K. publication), Technical Analysis of Stocks & Commodities, Futures, and Active Traderr have numerous articles on trading systems and methods. A basic understanding of market phenomena and relationships, often requiring some math skill, can be found in the Financial Analysts Journal. On general market lore and to provide motivation when trading is not going as well as expected, the one book that stands out is Edwin Lefevre, Reminiscences of a Stock Operator (originally published by Doran, reprinted by John Wiley & Sons in 1994). Richard D. Wyckoff mixes humor and philosophy in most of his books, but Wall Street Ventures and Adventures through Forty Years may be of general interest. Jack Schwager’s Market Wizards is now considered a classic. There are a number of associations and user groups that can be very helpful to traders at all levels. The Market Technician’s Association (MTA), found at www.MTA.org, offers a Certified Market Technician credential, and the Association for Investment
18
TRADING SYSTEMS AND METHODS
Management Research (AIMR) offers the Charter Financial Analyst (CFA) credential. For those with higher math skills, the International Association of Financial Engineers (IAFE) offers excellent resources, and the TradeStation users groups, found in larger cities and on the Internet, can be a means for solving a difficult problem. Readers will also find Sunny Harris’s TradeStation Made Easy! a valuable resource. As for this book, a reader with a good background in high school mathematics can follow everything but the more complex parts. An elementary course in statistics is ideal, but knowledge of the type of probability found in Edward Thorp’s Beat the Dealerr is adequate. Fortunately, computer spreadsheet programs, such as Excel, allow anyone to use statistical techniques immediately, and most of the formulas in this book are presented in such a way that they can be easily adapted to spreadsheets. Even better, if you have a computer with trading software, such as TradeStation Technologies’ TradeStation Platform, MetaStock, or any number of other products, you are well equipped to continue. If you have a live data feed, such as Bloomberg or CQG, you will also have access to technical studies that you will find very helpful. Bloomberg is also an excellent source of data.
RESEARCH GUIDELINES Before starting, there are eight guidelines that may help make the task of developing a trading system easier. 1. Know what you want to do before you start. Base your trading on a sound
premise. It could be an observation of how prices move in response to government policy, a theory about how prices react to economic reports, or simply a pattern that shows up at the same time each day or each month. This is the underlying premise of your method. It cannot be discovered by testing everything on a computer. It comes from the experience of observing price movement, reminiscent of Jesse Livermore. If that’s not possible, then select ideas from credible books or articles. 2. State your idea or premise in its simplest form. The more complex it is, the
more difficult it will be to evaluate the answer. More complex methods do not usually work as well as simple ones. Remember Occam’s razor. 3. Do not assume anything. Many projects fail on basic assumptions that were incor-
rect. It takes practice to avoid making assumptions and to be critical of certain elements that you believe to be true. Prove everything to your own satisfaction. 4. Try the simplest and most important parts first. Some of the rules in your trad-
ing program will be more important than others. Try those first. It’s best to understand how each rule or technique contributes to the final system. Then build slowly and carefully to prove the value of each element of the system. The ability to readily understand the operation of each part of your system is called a transparent solution, rather than a fully integrated orr complex x one. Transparent solutions are very desirable.
Introduction
19
5. Watch for errors of omission. It may seem odd to look for items that are not there,
but you must continually review your work, asking yourself if you have included all the necessary costs and accounted for all the risk. Simply because all the questions were answered correctly does not mean that all the right questions were asked. 6. Question the good results. There is a tendency to look for errors when results
are extremely bad, but to accept the results that are very good. Exceptionally good results are just as likely to be caused by errors in rules, formulas, or data. They need to be checked as carefully as extremely bad results. “Surprisingly good” results are often wrong. 7. Do not take shortcuts. It is sometimes convenient to use the work of others to
speed up the research. Check their work carefully; do not use it if it cannot be verified. Check your spreadsheet formulas manually. One error can ruin all of your hard work. 8. Start at the end. Define your goal and work backward to find only the necessary
input. In this way, you only work with information relevant to the results; otherwise, you may expend a lot of unnecessary effort.
OBJECTIVES OF THIS BOOK This book is intended to give you a complete understanding of the tools and techniques needed to develop or choose a trading program that has a good chance of being successful. Execution skill and market psychology are not considered—only the strategies, the methods for testing those strategies, and the means for controlling the risk. This is a goal of significant magnitude. Not everything can be covered in a single book; therefore, some guidelines were needed to control the material included here. Every technique in this book qualifies as systematic; that is, each has clear rules. Most of them can be automated. We begin with basic concepts and definitions, such as how much data to use, how to create an index, some statistics and probability, and other tools that are used throughout the book. The next several chapters cover the techniques that are most important to trading, such as the trend and momentum. All chapters are organized by common grouping so that you can compare variations of the same basic method. Although charting is an extremely popular technique, it is included only to the degree that it can be compared with other systematic methods, or when various patterns can be used in a computerized program (such as identifying a key reversal day). There has been no attempt to provide a comprehensive text on charting; however, various formations may offer very realistic profit objectives or provide reliable entry filters. Neither stock options nor options on futures are included in this book. Although there are strategies that combine outright trading of stocks or futures with options, the subject is too large and too specialized to be included here. There are already many good books on options strategies.
20
TRADING SYSTEMS AND METHODS
This book does not attempt to prove that one system is better than another, because it is not possible to know what will happen in the future or how each reader will cleverly apply these techniques. Instead the book evaluates the conditions under which certain methods are likely to do better and situations that will be harmful to specific approaches. By grouping similar systems and techniques together, and by presenting many of the results in a uniform way, you should be able to compare the differences and study the results. Seeing how analysts have modified existing ideas can help you decide how to proceed and give you an understanding of why you might choose one path over another. With a more complete picture, common sense should prevail over computing power.
PROFILE OF A TRADING SYSTEM There are quite a few steps to be considered when developing a trading program. Some of these are simply choices in style, while others are essential to the success of the results. They have been listed here and are discussed briefly as items to bear in mind as you continue the process of creating or choosing a trading system.
Changing Markets and System Longevity Markets are not static. They evolve as does everything else. During the past 10 years, changes have been predominately in technology, participation, globalization, and the cost of doing business. Technology includes communications, trading equipment (primarily computers and handheld devices), electronic exchanges, and order entry. These innovations have accelerated the trading process, provided faster access to quotes, and instantaneous order entry for computerized strategies. Electronic markets have changed the nature of the order flow and made information about buyers and sellers more accessible. They have accelerated the price discovery process and changed the way prices react to news, and they have facilitated high frequency trading. Increased participation that followed the historic bull market of the 1990s—aided by the proliferation of financial news networks, better communications, and faster computers— did not suffer during the economic crisis that began in 2008. More participation has changed the level of noise in individual stocks and futures, but it is most obvious in the index markets. Noise results from a large, constant flow of orders placed for unrelated reasons. Globalization is mostly the result of the reliability of advances in communications. Not only can we see the same news at the same time everywhere in the world, but we can pass information quickly electronically. Equally important, we do not think about the reliability of our communications equipment. We expect our telephones and Internet connections, mostly wireless, to work without question. When we trade, we are willing to bet on it. The dramatic reduction in commission cost has been a major influence on trading, opening up opportunities for the fast trader. Negotiated commissions have served the
Introduction
21
God of Competition. For institutions, stock transactions can be done at a fraction of a cent per share, and for the general public, anyone can get $10 per order. This not only facilitates fast trading but encourages greater participation. Everyone wins. The challenge for the trader is to find a system that will adapt to future changes, whatever they are. Most changes are not sudden, but are gradually reflected in price patterns (alternating with an occasional price shock). The steady change in the percentage of institutional volume compared to individual trader orders will slowly alter price patterns. The increase in overall participation affects the level of market noise and may also affect volatility and risk. The increase in trading choices—ETFs, mutual funds, stocks, futures, options—causes a complex interdependence of markets. Index arbitrage and the trading of sector ETFs force the component stocks to move in the same direction regardless of their individual fundamentals. The creation of your own successful trading program may be of the utmost simplicity or include strategies that adapt to an uncertain future. It is both challenging and rewarding to create a program with longevity.
The Choice of Data System decisions are limited by the data used in the analysis. Although price and volume for the specific stock or futures market may be the definitive criteria, there is a multitude of other valid statistical information that might also be used. Some of this data is easily included, such as price data from companies in the same sector or industrial group, or the current yield curve relationship. Other statistical data, including the wide range of U.S. economic data and weekly energy inventories, may add a level of robustness to the results but are less convenient to obtain and less timely.
Diversification Not all traders are interested in diversification, which tends to reduce returns at the same time that it limits risk. Concentrating all of your resources on a single market that you understand may produce a specialized approach and much better results than using a more generalized technique over more markets. Diversification may be gained by trading two or more unique strategies applied to the same market, instead of one strategy used on a broad set of markets.
Trade Selection Although a trading system produces signals regularly, it is not necessary to enter all of them. Selecting one over another can be done by a method of filtering. This can be a confirmation from another technique or system, a limitation on the amount of risk that can be accepted on any one trade, the use of outside information, or the current volume. Many of these additional rules add a touch of reality to an automated process. You may find, however, that too many filters result in overfitting or no trading.
22
TRADING SYSTEMS AND METHODS
Testing A mistake in testing may cause you to trade a losing strategy or discard a profitable one. Backtesting is the only option available to confirm or validate your ideas. Testing is misguided when it is used to “discover” a successful trading method by massive scanning of combinations of techniques. The purpose of testing is to validate an idea and show robustness—that the method works over a wide range of situations in a similar manner. It can also provide a good indication of expectations, both returns and risk. A robust solution, one that works on many stocks or across similar markets, will never appear as good as an optimized result of a single stock. But using the same system for all stocks in the same sector will give you a more realistic assessment of expectations and a much better chance of success.
Risk Control Trading survival is based on risk control. Most analysts believe that nearly any system can be profitable with proper risk management. This also means that any system can lead to ruin without risk controls. Risk must be addressed at all levels. It begins with the individual trade, but must also reflect all trades in a common sector, the risk of the single system portfolio, and finally the risk of a portfolio of systems. Trade risk can be controlled using a stop-loss but can effectively be managed by volatility. Futures traders must also pay attention to leverage. Risk management does not need to be complex, but it has many tiers.
Transaction Costs A system that performs well on paper may be dismal when actually traded. Part of a trading program is knowing how to enter and exit the market, as well as having realistic expectations about the transaction costs, both commissions and slippage. Shortterm, fast trading systems are most sensitive to transaction costs because the expected profit on each trade is small. Directional trading strategies, those that buy as prices are rising and sell when they are falling, have larger slippage than mean reversion techniques. There is equal damage in overstating costs as there is in underestimating them. By burdening a system with unrealistic fees, tests may show a loss instead of a profit, causing you to reject a successful trading method.
Performance Monitoring and Feedback A system is not done when you begin trading; it is only entering into a new phase. Actual trading results must be carefully monitored and compared with expectations in order to know if the system is performing properly. It is very likely that actual execution slippage
23
Introduction
will cause you to make some changes to the system rules or to the size of the position traded. Performance monitoring provides the essential feedback needed to be successful. Even a well-designed and well-tested program may start out badly, but proper monitoring can put it on track.
A WORD ABOUT THE NOTATION USED IN THIS BOOK In order to make the contents of this book more useful for trading, some of the traditional mathematical formulas are also shown as a single line in Microsoft’s Excel notation, as well as TradeStation’s EasyLanguage. EasyLanguage can be understood by anyone who has experience with a programming language. This edition has greatly expanded the number of complete spreadsheets and programs. These are available on the Companion Website. This should be more convenient for the reader and allow updating where necessary. In addition, some of the more complex mathematical examples and some of the older trading systems have been removed from the text but made available on the Companion Website to readers who have a sense of history or would like to have a deeper understanding of the process There are also more complex systems and indicators that appear in both Excel and EasyLanguage, but mostly in the latter. Although these programs have been entered and tested on TradeStation, there are occasional errors introduced during final editing. Recent market activity may also produce combinations of price movement that did not occur during testing. Readers are advised to check over the code and test it thoroughly before using it. Computer software used to develop trading strategies may vary in the notation needed to express the simplest statistical functions. For the standard deviation, Excel uses stdev while EasyLanguage uses stddev. One program expects the mean to be avg while another requires average. Please check each formula and solution for notation consistent with your needs.
AND FINALLY . . . Throughout this book the principle of unnecessary plurality, better known as Occam’s razor, will be stressed. The principle states that, given more than one explanation or solution, the simplest one is the preferred. When developing or choosing a trading strategy, it is normally the case that adding complexity for the sake of a few extra basis points increases the potential problems and risk more than it increases returns. Pluralitas non est ponenda sine necessitate. William of Ockham (ca 1285–1349)
24
TRADING SYSTEMS AND METHODS
It is not the purpose of this book to test every system and draw a conclusion as to which methods are best. That conclusion is not even possible. There are countless ways to generate trading signals, and markets change over time. The goal here is to provide the tools and the understanding to help aspiring and experienced traders develop systematic ways to trade that satisfy their inherent risk preference and their investment objectives. It is unlikely that any two traders will develop the same system, but the greater their knowledge, the more likely it will be profitable.
CHAPTER 2
Basic Concepts and Calculations
Economics is not an exact science: it consists merely of Laws of Probability. The most prudent investor, therefore, is one who pursues only a general course of action which is “normally” right and who avoids acts and policies which are “normally” wrong. —L . L . B. Angas
N
ew technology gives us a sense of security. There is data from everywhere in the world at our fingertips, programs that perform sophisticated calculations instantly, and access to anyone at any time. As Isaac Asimov foretold, there will come a time when we will no longer know how to do the calculation for long division because miniature, voice-activated computers will be everywhere. We might not even need to be able to add; it will all be done for us. We will just assume that the answer is correct, because computers don’t make mistakes. In a small way this is happening now. Not everyone checks their spreadsheet calculations by hand to be certain they are correct before going further. Nor does everyone print the intermediate results of computer calculations to verify their accuracy. Computers don’t make mistakes, but people do. With computer software and trading platforms making price analysis easier and more sophisticated, we no longer think of the steps involved in a moving average or linear regression. A few years ago, we looked at the correlation between investments only when absolutely necessary because they were too complicated and time-consuming to calculate. It would even be difficult to know if you had made a mistake without having someone else repeat the same calculations. Now we face a different problem: If the computer does it all, we lose our understanding of why a moving average trendline differs from a linear regression. Without looking at the data, we don’t see an erroneous outlier or that the stock wasn’t adjusted for splits. By not reviewing each hypothetical trade, we miss seeing that the slippage can turn a profit into a loss. 25
26
TRADING SYSTEMS AND METHODS
To avoid losing the edge needed to create a profitable trading strategy, the basic tools of the trade are explained in this chapter. Those of you already familiar with these methods may skip over it; others need to be confident that they can perform these calculations manually even while they use a spreadsheet.
Helpful Software In Excel, many of the functions, such as the standard deviation, are readily accessible at any time. The more advanced statistical functions require that you install the Add-Ins, which also come free with Excel. These include histograms, regression analysis, F-test, F t-test, z-test, Fourier analysis, and various smoothing techniques. To install these add-ins in Excel 2010, go to File/Options/Add-Ins and select the Analysis Toolpak. You will also want the Solver Add-in. Once installed, which takes only a few seconds, these functions can be accessed in the Data menu at the top of the screen. You should find the Data Analysis and Solver options at the far right on the menu bar. There are other very useful and user-friendly statistical programs, available at a wide range of sophistication and price. One of the best values is Pro-Stat by Poly Software (polysoftware.com). The examples in this chapter will use both Excel and Pro-Stat.
ABOUT DATA AND AVERAGING The Law of Averages We begin at the beginning, with the law of averages, a greatly misunderstood and misquoted principle. In trading, the law of averages is most often referred to when an abnormally long series of losses is expected to be offset by an equal and opposite run of profits. It is equally wrong to expect a market that is currently overvalued or overbought to next become undervalued or oversold. That is not what is meant by the law of averages. Over a large sample, the bulk of events will be scattered close to the average in such a way that the typical values overwhelm the abnormal events and cause them to be insignificant. This principle is illustrated in Figure 2.1, where the number of average items is extremely large, and the addition of a small abnormal grouping to one side of an average group of near-normal data does not affect the balance. It is the same as being the only passenger on a jumbo jet. Your weight is insignificant to the operation of the airplane and not noticed when you move about the cabin. A long run of profits, losses, or an unusually sustained price movement is simply a rare, abnormal event that will be offset over time by the overwhelming large number of normal events. Further discussion of this and how it affects trading can be found in “Gambling Techniques—The Theory of Runs,” Chapter 22.
27
Basic Concepts and Calculations
Center
Normal r
Unusual
FIGURE 2.1 The Law of Averages. The normal cases overwhelm the unusual ones. It is not necessary for the extreme cases to alternate— one higher, the next lower—to create a balance.
In-Sample and Out-of-Sample Data Proper test procedures call for separating data into in-sample and out-of-sample sets. This will be discussed in Chapter 21, System Testing. For now, consider the most important points. All testing is overfitting the data, yet there is no way to find out if an idea or system works without testing it. By setting aside data that you have not seen to use for validation, you have a better chance that your idea will work before putting money on it. There are many ways to select in-sample data. For example, if you have 20 years of price history, you might choose to use the first 10 years for testing and reserve the second 10 years for validation. But then markets change over time; they become more volatile and may be more or less trending. It might be best to use alternating periods of in-sample and out-of-sample data, in 2-year intervals, provided that you never look at the data during the out-of-sample periods. Alternating these periods may create a problem for continuous, long-term trends, but that will be resolved in Chapter 21. The most important factor when reserving out-of-sample data is that you get only one chance to use it. Once you have done your best to create the rules for a trading program, you then run that program through the unseen data. If the results are successful then you can trade the system, but if it fails, then you are also done. You cannot look at the reasons why it failed and change the trading method to perform better. You would have introduced feedback, and your out-of-sample data is considered contaminated. The second try will always be better, but it is now overfitted.
How Much Data Is Enough? Statisticians will say, “More is better.” The more data you test, the more reliable your results. Technical analysis is fortunate to be based on a perfect set of data. Each price that is
28
TRADING SYSTEMS AND METHODS
recorded by the exchange, whether it’s IBM at the close of trading in New York on May 5, or the price of Eurodollar interest rates at 10:05 in Chicago, is a confirmed, precise value. Remember that, when you use in-sample and out-of-sample data for development, you need more data. You will only get half the combinations and patterns when 50% of the data has been withheld. Economic Data Most other statistical data are not as timely, not as precise, and not as reliable as the price and volume of stocks, futures, ETFs, and other exchange-traded products. Economic data, such as the Producer Price Index or Housing Starts, are released as monthly averages, and can be seasonally adjusted. A monthly average represents a broad range of numbers. In the case of the PPI, some producers may have paid less than the average of the prior month and some more, but the average was +0.02. The lack of a range of values, or a standard deviation of the component values, reduces the usefulness of the information. This statistical data is often revised in the following month; sometimes those revisions can be quite large. When working with the Department of Energy (DOE) weekly data releases, you will need to know the history of the exact numbers released as well as the revisions, if you are going to design a trading method that reacts to those reports. You may find that it is much easier to find the revised data, which is not what you really need. If you use economic data, you must be aware of when that data is released. The United States is very precise and prompt but other countries can be months or years late in releasing data. If the input to your program is monthly data and comes from the CRB Yearbook, be sure that you check when that data was actually available. Sample Error When an average is used, it is necessary to have enough data to make that average accurate. Because much statistical data is gathered by sampling, particular care is given to accumulating a sufficient amount of representative data. This holds true with prices as well. Averaging a few prices, or analyzing small market moves, will show more erratic results. It is difficult to draw an accurate picture from a very small sample. When using small, incomplete, or representative sets of data, the approximate error, or accuracy, of the sample can be found using the standard deviation. A large standard deviation indicates an extremely scattered set of points, which in turn makes the average less representative of the data. This process is called the testing of significance. Accuracy increases as the number of items becomes larger, and the measurement of sample errorr becomes proportionately smaller Sample error =
1 1 1 = or Number of of items m sampled N sqrt ( N )
Therefore, using only one item has a sample error of 100%; with four items, the error is 50%. The size of the error is important to the reliability of any trading system. If a system has had only four trades, whether profits or losses, it is very difficult to draw any
Basic Concepts and Calculations
29
reliable conclusions about future performance. There must be sufficient trades to assure a comfortably small error factor. To reduce the error to 5%, there must be 400 trades. This presents a dilemma for a very slow trend-following method that may only generate two or three trades each year. To compensate for this, the identical method can be applied across many markets and the number of trades used collectively (more about this in Chapter 21). Representative Data The amount of data is a good estimate of its usefulness; however, the data should represent at least one bull market, one bear market, and some sideways periods. More than one of each is even better. If you were to use 10 years of daily S&P Index values from 1990 to 2000, or 25 years of 10-year Treasury notes through 2010, you would only see a bull market. A trading strategy would be profitable whenever it was a buyer, if you held the position long enough. Unless you included a variety of other price patterns, you would not be able to create a strategy that would survive a downturn in the market. Your results would be unrealistic. Data That Is No Longer Useful There are clear cases when a stock or futures market has undergone a structural change and the current data is different from historic data. The evolution of General Electric from a manufacturer of light bulbs to a massive financial institution represents a structural change. Its transformation back to a manufacturing company, announced in 2010, may be another structural change. A company that began in the United States, such as McDonald’s, but expanded to have large international exposure, also shows a structural change in its price patterns. In foreign exchange, we have seen the individual European currencies first tied together by agreement, then finally merged into a single unit, the euro. Is it important to include historic data in your testing when that data represents a different company profile or a different geopolitical situation? Ideally, your strategy is robust if it can adapt to these changing profiles and show consistently profitable returns over a long test period. The statisticians have that point in their favor—longer really is better. These companies and markets will continue to evolve, and your program will need to continue to adapt. As a very fast trader, you may think about limiting your testing to much shorter periods. If you trade once each day, then in 5 years you would generate 1,250 trades; in 10 years, 2,500 trades. If your trading strategy is profitable over 2,500 trades, then you’ve satisfied the issue of the sampling error. However, you may not have included data that is representative of different types of markets and a variety of price patterns. Even with a large number of trades, tests spanning many years will be needed to show robustness. Safety First It is important to remember that the accuracy of your testing depends on both the amount of data used and the number of trades generated by the system. If your estimates of loss are not reliable, you put your investment at risk.
30
TRADING SYSTEMS AND METHODS
ON AVERAGE In working with numbers, it is often necessary to use representative values. The range of values or the average may be substituted to change a single price into a general characteristic in order to solve a problem. The average (arithmetic mean) of many values can be a preferable substitute for any one value. For example, the average retail price of one pound of coffee in the Northeast is more meaningful to a cost-of-living calculation than the price at any one store. However, not all data can be combined or averaged and still have meaning. The average of all prices taken on the same day would not say anything about an individual market that was part of the average. Averaging the prices of unrelated items, such as a box of breakfast cereal, the hourly cost of automobile repair, and the price of the German DAX index would produce a number of questionable value. The average of a group of numbers must have some useful meaning. The average can be misleading in other ways. Consider coffee, which rose from $0.40 to $2.00 per pound in one year. The average price of this product may appear to be $1.20; however, this would not account for the time that coffee was sold at various price levels. Table 2.1 divides the coffee price into four equal intervals, then shows that the time spent at these levels was uniformly opposite to the price rise. That is, prices remained at lower levels longer and at higher levels for shorter time periods, which is very normal price behavior. When the time spent at each price level is included, it can be seen that the average price should be lower than $1.20. One way to calculate this, knowing the specific number of days in each interval, is by using a weighted average of the price W=
a1 d1 + a2 d2 + a3 d3 + a4 d4 d1 + d2 + d3 + d4
and its respective interval W=
6000 + 8000 + 8400 + 7200 280
W = 105.71
TABLE 2.1 Prices Go From
40 80 120 160
To
80 120 160 200
Weighting an Average Average During Interval
a1 a2 a3 a4
= = = =
60 100 140 180
Total Days for Interval
d1 d2 d3 d4
= = = =
100 80 60 40
Weighted
1/a
6000 8000 8400 7200
0.01666 0.01000 0.00714 0.00555
31
Basic Concepts and Calculations
This result can vary based on the number of time intervals used; however, it gives a better idea of the correct average price. There are two other averages for which time is an important element—the geometric mean and the harmonic mean.
Geometric Mean The geometric mean represents a growth function in which a price change from 50 to 100 is as important as a change from 100 to 200. If there are n prices, a1, a2, a3, . . . , an, then the geometric mean is the nth root of the product of the prices G ( a1 × a2 × a3 × ... × an )1/ n or product(a1,a2,a3,...,an)1/n
To solve this mathematically, rather than using a spreadsheet, the equation above can be changed to either of two forms: ln (G ) =
ln(a1 ) + l ((a a2 ) + ... + ln(an ) n
ln (G ) =
ln(a1 × a2 × a3 × n
or × an )
The two solutions are equivalent. The term ln is the natural log, or log base e. (Note that there is some software where the function log actually is ln.) Using the price levels in Table 2.1, ln (G ) =
l (120) + ln(160) ln(200) ln(40) + ln(80) + ln(120) 5
Disregarding the time intervals, and substituting into the first equation: ln ( G ) =
3.689 + 4.382 + 4.787 + 5.075 + 5.298 5
Then: ln(G) = 4.6462 G = 104.19 While the arithmetic mean, which is time-weighted, gave the value of 105.71, the geometric mean shows the average as 104.19. The geometric mean has advantages in application to economics and prices. A classic example compares a tenfold rise in price from 100 to 1000 to a fall to one tenth from
32
TRADING SYSTEMS AND METHODS
100 to 10. An arithmetic mean of the two values 10 and 1000 is 505, while the geometric mean gives G = (10 × 1000)1/ 2 = 100 and shows the relative distribution of prices as a function of comparable growth. Due to this property, the geometric mean is the best choice when averaging ratios that can be either fractions or percentages.
Quadratic Mean The quadratic mean is most often used for estimation of error. It is calculated as: Q=
∑a
2
N
The quadratic mean is the square root of the mean of the square of the items (rootmean-square). It is most well known as the basis for the standard deviation. This will be discussed later in this chapter in the section “Moments of the Distribution: Variance, Skewness, and Kurtosis.”
Harmonic Mean The harmonic mean is another time-weighted average, but not biased toward higher or lower values as in the geometric mean. A simple example is to consider the average speed of a car that travels 4 miles at 20 mph, then 4 miles at 30 mph. An arithmetic mean would give 25 mph, without considering that 12 minutes were spent at 20 mph and 8 minutes at 30 mph. The weighted average would give W=
(12 × 20) + (8 × 30) = 24 12 + 8
The harmonic mean is 1 1 1 + ++ 1 a1 a2 an = H n which can also be expressed as n ⎛ 1⎞ H = n / ∑⎜ ⎟ i=1 ⎝ a i ⎠
For two or three values, the simpler form can be used: H2 =
2ab a+b
H3 =
3 abc ab + ac + bc
33
Basic Concepts and Calculations
This allows the solution pattern to be seen. For the 20 and 30 mph rates of speed, the solution is 2 × 20 × 30 H2 = = 24 20 + 30 which is the same answer as the weighted average. Considering the original set of numbers again, the basic form of harmonic mean can be applied: 1 1 1 1 1 + + + + 1 40 80 120 160 200 = H 5 H = 87.59 =
0.5708 = 0.01142 5
We might apply the harmonic mean to price swings, where the first swing moved 20 points over 12 days and the second swing moved 30 points over 8 days.
PRICE DISTRIBUTION The measurement of distribution is very important because it tells you generally what to expect. We cannot know what tomorrow’s S&P trading range will be, but if the current price is 1200, then we have a high level of confidence that it will fall between 900 and 1500 this year, but less confidence that it will fall between 1100 and 1300. We have much less confidence that it will fall between 1150 and 1250, and we have virtually no chance of picking the exact range. The following measurements of distribution allow you to put a probability, or confidence level, on the chance of an event occurring. In all of the statistics that follow, we will use a limited number of prices or—in some cases—individual trading profits and losses as the sample data. We want to measure the characteristics of our sample, finding the shape of the distribution, deciding how results of a smaller sample compare to a larger one, or how similar two samples are to each other. All of these measures will show that the smaller samples are less reliable, yet they can be still be used if you understand the size of the error or the difference in the shape of the distribution compared to the expected distribution of a larger sample.
Frequency Distributions The frequency distribution (also called a histogram) is simple yet can give a good picture of the characteristics of the data. Theoretically, we expect commodity prices to spend more time at low price levels and only brief periods at high prices. That pattern is shown in Figure 2.2 for wheat during the past 25 years. The most frequent occurrences are at the price where the supply and demand are balanced, called equilibrium. When
34
TRADING SYSTEMS AND METHODS
Wheat Price (cents/bushel)
250
200
150
100
50
12/1/2009
12/1/2008
12/1/2007
12/1/2006
12/1/2005
12/1/2004
12/1/2003
12/1/2002
12/1/2001
12/1/2000
12/1/1999
12/1/1998
12/1/1997
12/1/1996
12/1/1995
12/1/1994
12/1/1993
12/1/1992
12/1/1991
12/1/1990
12/1/1989
12/1/1988
12/1/1987
12/1/1986
12/1/1985
FIGURE 2.2 Wheat prices, 1985–2010.
there is a shortage of supply, or an unexpected demand, prices rise for a short time until either the demand is satisfied (which could happen if prices are too high), or supply increases to meet demand. There is usually a small tail to the left where prices occasionally trade for less than the cost of production, or at a discounted rate during periods of high supply. To calculate a frequency distribution with 20 bins, we find the highest and lowest prices to be charted, and divide the difference by 19 to get the size of one bin. Beginning with the lowest price, add the bin size to get the second value, add the bin size to the second value to get the third value, and so on. When completed, you will have 20 bins that begin at the lowest price and end at the highest price. You then can count the number of prices that fall into each bin, a nearly impossible task, or you can use a spreadsheet to do it. In Excel, you go to Data/Data Analysis/Histogram and enter the range of bins (which you need to set up in advance) and the data to be analyzed, then select a blank place on the spreadsheet for the output results (to the right of the bins is good) and click OK. The frequency distribution will be shown instantly. You can then plot the results seen in Figure 2.3. The frequency distribution shows that the most common price fell between $3.50 and $4.00 per bushel but the most active range was from $2.50 to $5.00. The tail to the right extends to just under $10/bushel and clearly demonstrates the fat tail in the price distribution. If this was a normal distribution, there would be no entries past $6. The absence of price data below $2.50 is due to the cost of production. Below that price farmers would refuse to sell at a loss; however, the U.S. government has a price support program that guarantees a minimum return for farmers. The wheat frequency distribution can also be viewed net of inflation or changes in the U.S. dollar. This will be seen at the end of this chapter.
35
0 95 10 0 00
90
85
80
75
70
0 65
60
55
50
45
40
35
30
25
20
15
10
80 70 60 50 40 30 20 10 0
Frequency of Price Occurring in Bin
Basic Concepts and Calculations
Wheat Price (in cents/bushel)
FIGURE 2.3 Wheat frequency distribution showing a tail to the right.
1250 1150 1050 950 850 750 650
1/ 3/ 20 07 2/ 3/ 20 3/ 07 3/ 20 07 4/ 3/ 20 07 5/ 3/ 20 07 6/ 3/ 20 07 7/ 3/ 20 07 8/ 3/ 20 07 9/ 3/ 20 07 10 /3 /2 00 11 7 /3 /2 00 12 7 /3 /2 00 7
Wheat Price (cents/bushel)
Short-Term Distributions The same frequency distributions occur even when we look at shorter time intervals, although the pattern is more erratic as the time interval gets very small. If we take wheat prices for the calendar year 2007 (Figure 2.4) we see a steady move up during midyear, followed by a wide-ranging sideways pattern at higher level; however, the frequency distribution in Figure 2.5 shows a pattern similar to the long-term distribution, with the most common value at a low level and a fat tail to the right. If we had picked the few months just before prices peaked in September 2007, the chart might have shown the peak price further to the right and the fat tail on the left. For commodities, this represents a period of price instability, and expectations that prices will fall. It should be expected that the distribution of prices for a physical commodity, such as agricultural products, metals, and energy will be skewed toward the left (more occurrences at lower prices) and have a long tail at higher prices toward the right of the chart. This is because prices remain at relatively higher levels for only short periods of time while there is an imbalance in supply and demand. In the stock market, history has shown that stocks will not sustain exceptionally high price/earnings (P/E) ratios indefinitely; however, the period of adjustment can be drawn out over many years, unlike an
FIGURE 2.4 Wheat daily prices, 2007.
36
TRADING SYSTEMS AND METHODS
Frequency of Occurence
Wheat Distribution 2007 100 90 80 70 60 50 40 30 20 10 0
600 650 700 750 800 850 900 950 1000105011001150120012501300
FIGURE 2.5 Frequency distribution of wheat prices, intervals of $0.50, during 2007.
agricultural product that begins again each year. When observing shorter price periods, patterns that do not fit the standard distribution may be considered in transition. Readers who would like to pursue this topic should read Chapter 18, especially the sections “Distribution of Prices” and “Steidlmayer’s Market Profile.” The measures of central tendency discussed in the previous section are used to describe the shape and extremes of price movement shown in the frequency distribution. The general relationship between the three principal means when the distribution is not perfectly symmetric is Arithmetic mean > Geometric mean > Harmonic mean
Median and Mode Two other measurements, the median and the mode, are often used to define distribution. The median, or “middle item,” is helpful for establishing the “center” of the data; when the data is sorted, it is the value in the middle. The median has the advantage of discounting extreme values, which might distort the arithmetic mean. Its disadvantage is that you must sort all of the data in order to locate the middle point. The median is preferred over the mean except when using a very small number of items. The mode is the most commonly occurring value. In Figure 2.5, the mode is the highest bar in the frequency distribution, at bin 800. In a normally distributed price series, the mode, mean, and median all occur at the same value; however, as the data becomes skewed, these values will move farther apart. The general relationship is: Mean > Median > Mode A normal distribution is commonly called a bell curve, and values fall equally on both sides of the mean. For much of the work done with price and performance data,
Basic Concepts and Calculations
37
the distributions tend to be skewed to the right (toward higher prices or higher trading profits), and appear to flatten or cut off on the left (lower prices or trading losses). If you were to chart a distribution of trading profits and losses based on a trend system with a fixed stop-loss, you would get profits that could range from zero to very large values, while the losses would be theoretically limited to the size of the stop-loss. Skewed distributions will be important when we measure probabilities later in this chapter. There are no “normal” distributions in a trading environment.
Characteristics of the Principal Averages Each averaging method has its unique meaning and usefulness. The following summary points out their principal characteristics: The arithmetic mean is affected by each data element equally, but it has a tendency to emphasize extreme values more than other methods. It is easily calculated and is subject to algebraic manipulation. The geometric mean gives less weight to extreme variations than the arithmetic mean and is most important when using data representing ratios or rates of change. It cannot be used for negative numbers but is also subject to algebraic manipulation. The harmonic mean is most applicable to time changes and, along with the geometric mean, has been used in economics for price analysis. It is more difficult to calculate; therefore, it is less popular than either of the other averages, although it is also capable of algebraic manipulation. The mode is the most common value and is only determined by the frequency distribution. It is the location of greatest concentration and indicates a typical value for a reasonably large sample. With an unsorted set of data, such as prices, the mode is timeconsuming to locate and is not capable of algebraic manipulation. The median is the middle value, and is most useful when the center of an incomplete set is needed. It is not affected by extreme variations and is simple to find; however, it requires sorting the data, which causes the calculation to be slow. Although it has some arithmetic properties, it is not readily adaptable to computational methods.
MOMENTS OF THE DISTRIBUTION: VARIANCE, SKEWNESS, AND KURTOSIS The moments of the distribution describe the shape of the data points, which is the way they cluster around the mean. There are four moments: mean, variance, skew, and kurtosis, each describing a different aspect of the shape of the distribution. Simply put, the mean is the center or average value, the variance is the distance of the individual points from the mean, the skew is the way the distribution leans to the left or right relative to the mean, and the kurtosis is the peakedness of the clustering. We have already discussed the mean, so we will start with the 2nd moment.
38
TRADING SYSTEMS AND METHODS
In the following calculations, we will use the bar notation, P , to indicate the average of a list of n prices. The capital P refers to all prices and the small p to individual prices. P=
∑
n i =1
pi
n
The mean deviation (MD) is a basic method for measuring distribution and may be calculated about any measure of central location, such as the arithmetic mean.
∑ MD =
n
pi − P
i =1
n
Then MD is the average of the differences between each price and the arithmetic mean of those prices, or some other measure of central location, with all differences treated as positive numbers. This formula will be seen often throughout the book.
Variance (2nd Moment) Variance (Var), which is very similar to mean deviation, the best estimation of dispersion, will be used as the basis for many other calculations. It is
∑ Var a =
n
P )2
( pi
i=1
n −1
Notice that the variance is the square of the standard deviation, var = s2 = σ2, one of the most commonly used statistics. In Excel, the variance is the function var(list) and in TradeStation’s EasyLanguage it is variance(series,n). The standard deviation (s), most often shown as σ (sigma), is a special form of measuring average deviation from the mean, which uses the root-mean-square
σ=
∑
n
( pi − P )2
i =1
n
where the differences between the individual prices and the mean are squared to emphasize the significance of extreme values, and then the total value is scaled back using the square root function. This popular measure, used throughout this book, is the Excel function Stdevp and the TradeStation function StdDev(price,n), for n prices. The standard deviation is the most popular way of measuring the dispersion of data. The value of 1 standard deviation about the mean represents a clustering of about 68% of the data, 2 standard deviations from the mean include 95.5% of all data, and 3 standard deviations encompass 99.7%, nearly all the data. While it is not possible to guarantee that all data will be included, you can use 3.5 standard deviations to include 100% of the data in a normal distribution. These values represent the groupings of a perfectly normal set of data, shown in Figure 2.6.
39
Basic Concepts and Calculations
1σ
1σ
68.26%
Mean
FIGURE 2.6 Normal distribution showing the percentage area included within one standard deviation about the arithmetic mean.
Skewness (3rd moment) Most price data, however, are not normally distributed. For physical commodities, such as gold, grains, energy, and even interest rates (expressed at yields), prices tend to spend more time at low levels and much less time at extreme highs. While gold peaked at $800 per ounce for one day in January 1980, it remained between $250 and $400 per ounce for most of the next 20 years. If we had taken the average at $325 then is would be impossible for the price distribution to be symmetric. If 1 standard deviation is $140, then a normal distribution would show a high likelihood of prices dropping to $185, an unlikely scenario. This asymmetry is most obvious in agricultural markets, where a shortage of soybeans or coffee in one year will drive prices much higher, but a normal crop the following year will return those prices to previous levels. The relationship of price versus time, where markets spend more time at lower levels, can be measured as skewness—the amount of distortion from a symmetric distribution, which makes the curve appear to be short on the left and extended to the right (higher prices). The extended side is called the tail, and a longer tail to the right is called positive skewness. Negative skewness has the tail extending toward the left. This can be seen in Figure 2.7. In a perfectly normal distribution, the mean, median, and mode all coincide. As prices become positively skewed, typical of a period of higher prices, the mean will show the greatest change, the mode will show the least, and the median will fall in between. The difference between the mean and the mode, adjusted for dispersion using the standard deviation of the distribution, gives a good measure of skewness. (Skewness) S K =
Mean − Mode Standa a ard deviatio t n
40
TRADING SYSTEMS AND METHODS
Normal (symmetric) distribution
Positive skewness
Negative skewness
Low prices
High prices Arithmetic mean average
FIGURE 2.7 Skewness. Nearly all price distributions are positively skewed, showing a longer tail to the right, at higher prices.
The distance between the mean and the mode, in a moderately skewed distribution, turns out to be three times the difference between the mean and the median; the relationship can also be written as: ( Skewness) S K =
3 × ( Mean − Median ) Standard r deviation
To show the similarity between the 2nd and 3rd moments (variance and skewness) the more common computational formula is
∑ (p = n
SK
i =1
i
−P
( n − 1)σ 3
)
3
where n is the number of prices in the distribution, and σ is the standard deviation of the prices. The functions for skew can be found in Excel and TradeStation. Transformations The skewness of a data series can sometimes be corrected using a transformation. Price data may be skewed in a specific pattern. For example, if there are 3 occurrences at twice the price, and 1/9 of the occurrences at 3 times the price, the original data can be transformed into a normal distribution by taking the square root of each data item. The characteristics of price data often show a logarithmic, power, or square-root relationship.
41
Basic Concepts and Calculations
To calculate the probability level of a distribution based on the skewed distribution of price, we can convert the normal probability to the exponential probability equivalent, PE, using 1 ⎞ X log10 ⎛ ⎝1− P⎠ PE = log10 e where
X = the average of all prices P = the normal probability log10e = .434294482
While the normal probability, P, understates the probability of occurrence in a price distribution, the exponential distribution, PE, will overstate the probability. Whenever possible, it is better to use the exact calculation; however, when calculating risk, it might be best to err on the side of slightly higher than expected risk. Skewness in Distributions at Different Relative Price Levels Because the lower price levels of most commodities are determined by production costs, price distributions show a clear tendency to resist moving below these thresholds. This contributes to the positive skewness in those markets. Considering only the short term, when prices are at unusually high levels, they can be volatile and unstable, causing a negative skewness that can be interpreted as being top heavy. Somewhere between the very high and very low price levels, we may find a frequency distribution that looks normal. Figure 2.8 shows the change in the distribution of prices over, for example, 20days as prices move sharply higher. The mean shows the center of the distributions as they change from positive to negative skewness. This pattern indicates that a normal
FIGURE 2.8 Changing distribution at different price levels. A, B, and C are increasing mean values of three shorter-term distributions and show the distribution changing from positive to negative skewness.
42
TRADING SYSTEMS AND METHODS
distribution is not appropriate for all price analysis, and that a log, exponential, or power distribution would only apply best to long-term analysis.
Kurtosis (4th Moment) One last measurement, kurtosis, is needed to describe the shape of a price distribution. Kurtosis is the peakedness or flatness of a distribution as shown in Figure 2.9. This measurement is good for an unbiased assessment of whether prices are trending or moving sideways. If you see prices moving steadily higher, then the distribution will be flatter and cover a wider range. This is call negative kurtosis. If prices are rangebound, then the frequency will show clustering around the mean and we have positive kurtosis. Steidlmayer’s Market Profile, discussed in Chapter 18, uses the concept of kurtosis, with the frequency distribution accumulated dynamically using real-time price changes. Following the same form as the 3rd moment, skewness, kurtosis can be calculated as
∑ (p K= n
i =1
i
−P
( n − 1) σ 4
)
4
Positive kurtosis
Normal distribution
Negative kurtosis
Arithmetic mean (average)
FIGURE 2.9 Kurtosis. A positive kurtosis is when the peak of the distribution is greater than normal, typical of a sideways market. A negative kurtosis, shown as a flatter distribution, occurs when the market is trending.
43
Basic Concepts and Calculations
An alternative calculation for kurtosis is K=
where
(
n(
)(
) )(
4
⎛ pi − P ⎞ 3( n − 1)2 ⎜ ⎟ − ∑ ) ⎝ σ ⎠ ( n − 2)( n − 3)
n = the number of prices in the distribution pi = the individual prices P = the average of n prices σ = the standard deviation of prices
Most often the excess kurtosis is used, which makes it easier to see abnormal distributions. Excess kurtosis, KE = K – 3 because the normal value of the kurtosis is 3. Kurtosis is also useful when reviewing system tests. If you find the kurtosis of the daily returns, they should be somewhat better than normal if the system is profitable; however, if the kurtosis is above 7 or 8, then it begins to look as though the trading method is overfitted. A high kurtosis means that there are an overwhelming number of profitable trades of similar size, which is not likely to happen in real trading. Any high value of kurtosis should make you immediately suspicious.
Choosing between Frequency Distribution and Standard Deviation Frequency distributions are important because the standard deviation doesn’t work for skewed distributions, which is most common for most price data. For example, if we look back at the histogram for wheat, the average price over the past 25 years was $3.62 and the standard deviation of those prices was $1.16, then 1 standard deviation to the left of the mean is $2.46, a bin which has no data. On the right side, 3.5 standard deviations, which should contain 100% of the data, is $7.68, far below the actual high price. Then using the standard deviation can fail on both ends of the distribution for highly skewed data, while the frequency distribution gives a very clear and useful picture. If we wanted to know the price at the 10% and 90% probability levels based on the frequency distribution, we would sort all the data from low to high. If there were 300 monthly data points, then the 10% level would be in position 30 and the 90% level in position 271. The median price would be at position 151. This is shown in Figure 2.10. When there is a long tail to the right, both the frequency distribution and the standard deviation imply that large moves are to be expected. When the distribution is very symmetric, then we are not as concerned. For those markets that have had extreme moves, neither method will tell you the size of the extreme move that could occur. There is no doubt that, given enough time, we will see profits and losses that are larger than we have seen in the past, perhaps much larger. Autocorrelation Serial correlation or autocorrelation means that there is persistence in the data; that is, future data can be predicted (to some degree) from past data. Such a quality could indicate
44
TRADING SYSTEMS AND METHODS
10% 10%
FIGURE 2.10 Measuring 10% from each end of the frequency distribution. The dense clustering at low prices will make the lower zone look narrow, while high prices with less frequent data will appear to have a wide zone.
the existence of trends. A simple way of finding autocorrelation is to put the data into column A of a spreadsheet, then copy it to column B while shifting the data down by 1 row. Then find the correlation of column A and column B. Additional correlations can be calculated shifting column B down 2, 3, or 4 rows, which might show the existence of a cycle. A formal way of finding autocorrelation is by using the Durbin-Watson test, which gives the d-statistic. This approach measures the change in the errors (e), the difference between N data points and their average value. et = rt − d=
∑
∑
t
r
t − N +1 i
N
t t − N +1
∑
( ei − ei−1 )2 t
2 t − N +1 i
e
The value of d always falls between 0 and 4. There is no autocorrelation if d=2. If d is substantially less than 2 there is positive autocorrelation; however, if it is below 1, then there is more similarity in the errors than is reasonable. The farther d is above 2 the more negative autocorrelation appears in the error terms. A positive autocorrelation, or serial correlation, means that a positive error factor has a good chance of following another positive error factor.
Probability of Achieving a Return To be uncertain is to be uncomfortable, but to be certain is to be ridiculous. —Chinese proverb
45
Basic Concepts and Calculations
If we see the normal distribution (Figure 2.6) as the annual returns for the stock market over the past 50 years, then the mean is about 8%, and one standard deviation is 16%. In any one year, we can expect the returns to be 8%; however, there is a 32% chance that it will be either greater than 24% (the mean plus one standard deviation) or less than –8% (the mean minus one standard deviation). If you would like to know the probability of a return of 20% or greater, you must first rescale the values, Probability of reaching object j ive =
Obj bjective − Mea an Standard r deviation
If your objective is 20%, we calculate Probability =
20% − 8% = 0.75 16%
Table A1.1, Appendix 1 gives the probability for normal curves. Looking up the standard deviation of 0.75 gives 27.34%, a grouping of 54.68% of the data. That leaves one half of the remaining data, or 22.66%, above the target of 20%. Calculating the Probability Automatically It is inconvenient to look up the probability values in a table when you are working with a spreadsheet or computer program, yet the probabilities are easier to understand than standard deviation values. You can calculate the area under the curve that corresponds to a particular z value (the standard deviation), using the following approximation.1 Let z ′ = z , the absolute value of z. Then
(
r = 1 + z ′ × c1 + z ′ × ( c3 + z ′ × ( c5 + z ′ × c6 ) Where
))
c1 = 0.049867347 c2 = 0.0211410061 c3 = 0.032776263 c4 = 0.0000380036 c5 = 0.0000488906 c6 = 0.000005383
Then the probability, P, that the returns will equal or exceed the expected return is P = 0.5 × e[ln( r ) × ( −16)]
1
Stephen J. Brown and Mark P. Kritzman, Quantitative Methods for Financial Analysis, 2nd ed. (Dow Jones-Irwin, 1990), 238–241.
46
TRADING SYSTEMS AND METHODS
Using the example where the standard deviation z = 0.75, we perform the calculation r = 1 + 0.75 × (0.049867347 + 0.75 × [0.0211410061 + 0.75 × (0.0032776232 + 0.75 × [0.0000380036 + 0.75 × (0.0000488906 + 0.75 × [0.000005383])])]) r = 1.0507 Substituting the value of r into the equation for P, we get P = 0.5 × e[ln(1.0507 ) × ( −16)] = 0.226627 Then there is a 22.7% probability that a value will exceed 0.75 standard deviations (that is, fall on one end of the distribution outside the value of 0.75). The chance of a value falling inside the band formed by ±0.75 standard deviations is 1 – (2 × 0.2266) = 0.5468, or 54.68%. That is the same value found in Table A1.1, Appendix 1. For those using Excel, the answer can be found with the function normdist(p,mean, stdev,cumulative), where p is the current price or value mean is the mean of the series of p’s stdev is the standard deviation of the series of p’s, and cumulative is “true” if you want the z value. Then the result of normdist(35,20,5,true) is 0.99865, or a 99.8% probability, and if cumulative is “false” then the result is 0.000866.
Standard Error Throughout the development and testing of a trading system, we want to know if the results we are seeing are as expected. The answer will always depend on the size of the data sample and the amount of variance that is typical of the data during this period. One descriptive measure of error, called the standard errorr (SE E), uses the variance, which gives the estimation of error based on the distribution of the data using multiple data samples. It is a test that determines how the sample means differ from the actual mean of all the data. It addresses the uniformity of the data. SE =
Var a n
where Var = the variance of the sample means n = the number of data points in the sample means Sample means refers to the data being sampled a number of times, each with n data points, and the means of these samples are used to find the variance. In most cases, we would use a single data series and calculate the variance as shown earlier in this chapter.
47
Basic Concepts and Calculations
tt-Statistic and Degrees of Freedom When fewer prices or trades are used in a distribution, we can expect the shape of the curve to be more variable. For example, it may be spread out so that the peak of thedistribution will be lower and the tails will be higher. A way of measuring how close the sample distribution of a smaller set is to the normal distribution (of a large sample of data) is to use the t-statistic (also called the student’s t-test, developed by W. S. Gossett). The t-test is calculated according to its degrees of freedom (df), f which is n – 1, where n is the sample size, the number of prices used in the distribution. t=
Average a of price change n s × n Standard r deviation of price change n s
The more data in the sample, the more reliable the results. We can get a broad view of the shape of the distribution by looking at a few values of t in Table 2.2, which gives the values of t corresponding to the upper tail areas of 0.10, 0.05, 0.025, 0.01, and 0.005. The table shows that as the sample size n increases, the values of t approach those of the standard normal values of the tail areas. The values of t that are needed to be significant can be found in Appendix 1, Table A1.2, “t-Distribution.” The column headed “0.10” gives the 90% confidence level, “0.05” is 95%, and “0.005” is 99.5%. For example, if we had 20 prices in our sample, and wanted the probability of the upper tail to be 0.025, then the value of t would need to be 2.086. For smaller samples, the value of t would be larger in order to have the same confidence. When testing a trading system, degrees of freedom can be the number of trades produced by the strategy. When you have few trades, the results may not represent what you will get using a longer trading history. When testing a strategy, you will find a similar relationship between the number of trades and the number of parameters, or variables, used in the strategy. The more variables used, the more trades are needed to create expectations with an acceptable confidence level. 2-Sample t-Test t You may want to compare two periods of data to decide whether the price patterns have changed significantly. Some analysts use this to eliminate inconsistent data, but the char-
TABLE 2.2 Values of t Corresponding to the Upper Tail Probability of 0.025 Degrees of Freedom (df) f
Value of t
1 10 20 30 120 Normal
12.706 2.228 2.086 2.042 1.980 1.960
48
TRADING SYSTEMS AND METHODS
acteristics of price and economic data change as part of the evolving process, and systematic trading should be able to adapt to these changes. This test is best applied to trading results in order to decide if a strategy is performing consistently. This is done with a 2-sample t-test: t=
where
P1 − P2 var ar12 var ar22 + n1 n2
P1 and P2 = the averages of the prices for periods 1 and 2 var1 and varr2 = the variances of the prices for periods 1 and 2 n1 and n2 = the number of prices in periods 1 and 2
and the two periods being compared are mutually exclusive. The degrees of freedom, df, f needed to find the confidence levels in Table A1.2 can be calculated using Satterthwaite’s approximation, where s is the standard deviation of the data values: ⎛ s12 s22 ⎞ ⎜ + ⎟ ⎝ n1 n2 ⎠ df = 2 2 ⎛ s12 ⎞ ⎛ s22 ⎞ ⎜ ⎟ ⎜ ⎟ ⎝ n1 ⎠ ⎝ n2 ⎠ + ( n1 − n2 ) ( n2 − n1 )
When using the t-test to find the consistency of profits and losses generated by a trading system, replace the data items by the net returns of each trade, the number of data items by the number of trades, and calculate all other values using returns rather than prices.
STANDARDIZING RISK AND RETURN In order to compare one trading method with another, it is necessary to standardize both the tests and the measurements used for evaluation. If one system has total returns of 50% and the other 250%, we cannot decide which is best unless we know the duration of the test and the volatility of the returns, or risk. If the 50% return was over 1 year and the 250% return over 10 years, then the first one is best. Similarly, if the first return had an annualized risk of 10% and the second a risk of 50%, then both would be equivalent. The return relative to the risk is crucial to performance as will be discussed in Chapter 21, System Testing. For now it is only important that returns and risk be annualized or standardized to make comparisons valid.
49
Basic Concepts and Calculations
Calculating Returns The calculations for both 1-period returns and annualized returns will be an essential part of all performance evaluations. In its simplest form, the 1-period rate of return, R, or the holding period rate of return is often given as Return =
Ending value − Start a ing n value Ending value = −1 Starting value Starting value
For the stock market, which has continuous prices, this can be written r1 =
p1 − p0 p1 = −1 p0 p0
where p0 is the initial price and p1 is the price after one period has elapsed. The securities industry often prefers a different calculation, ⎛ P ⎞ rn = ln ⎜ t ⎟ ⎝ Pt−1 ⎠ Both methods have advantages and disadvantages. Neither one is the “correct” calculation. Note that in some software, the function log is actually the natural log, and log10 is the log base 10. It is best to always check the definitions. In order to distinguish the two calculations, the first method will be called the standard method and the second the ln method. In the following spreadsheet example, shown in Table 2.3 over 22 days, the standard returns are in column D and the ln returns in column E. The differences seem small, but the averages are 0.00350 and 0.00339. The standard returns are better by 3.3% over only one trading month. At this rate, the standard method would have yielded returns that were nearly 40% higher after one year. The net asset value (NAV ( V), used extensively throughout this book, compounds the periodic returns, and most often has a starting value, NAV V0 = 100. NAV Vt = NAV Vt−1 × (1 + rt) Annualizing Returns In most cases, it is best to standardize the returns by annualizing. This is particularly helpful when comparing two sets of test results, where each covers a different time period. When annualizing, it is important to know that • Government instruments use a 360-day rate (based on 90-day quarters). • A 365-day rate is common for most other data that can change daily. • Trading returns are best with 252 days, which is the typical number of days in a trading year for the United States (262 days for Europe).
50
TRADING SYSTEMS AND METHODS
TABLE 2.3 Calculation of Returns and NAVs from Daily Profits and Losses Date
9/10/2010 9/13/2010 9/14/2010 9/15/2010 9/16/2010 9/17/2010 9/20/2010 9/21/2010 9/22/2010 9/23/2010 9/24/2010 9/27/2010 9/28/2010 9/29/2010 9/30/2010 10/1/2010 10/4/2010 10/5/2010 10/6/2010 10/7/2010 10/8/2010 10/12/2010 Average Std Dev Ann StdDev AROR
PL
Cum PL
1154 1795 –1859 –1603 449 1090 2949 1346 64 –2051 3269 1795 –1154 128 –705 1090 –449 2308 –769 –256 –1218
100000 101154 102949 101090 99487 99936 101026 103974 105320 105384 103333 106602 108397 107243 107372 106666 107756 107307 109615 108846 108589 107372
Standard Return
Return using LN
0.01154 0.01774 –0.01806 –0.01585 0.00451 0.01090 0.02919 0.01295 0.00061 –0.01946 0.03164 0.01684 –0.01064 0.00120 –0.00657 0.01022 –0.00416 0.02150 –0.00702 –0.00236 –0.01122 0.00350 0.01502 0.23846
0.01147 0.01759 –0.01822 –0.01598 0.00450 0.01084 0.02877 0.01286 0.00061 –0.01966 0.03115 0.01670 –0.01070 0.00119 –0.00659 0.01016 –0.00417 0.02128 –0.00704 –0.00236 –0.01128 0.00339 0.01495 0.23730
NAV
NAV using LN
100.00 101.15 102.95 101.09 99.49 99.94 101.03 103.97 105.32 105.38 103.33 106.60 108.40 107.24 107.37 106.67 107.76 107.31 109.62 108.85 108.59 107.37
100.00 101.15 102.91 101.08 99.49 99.94 101.02 103.90 105.18 105.24 103.28 106.39 108.06 106.99 107.11 106.45 107.47 107.05 109.18 108.48 108.24 107.11
125.85%
119.69%
The following formulas use 252 days, which will be the standard throughout this book except for certain interest rate calculations; however, 365 or 360 may be substituted, or even 260 for trading days in other parts of the world. The annualized rate of return (AROR) on a simple-interest basis for an investment over n days is E 252 AROR ORsimple = n × E0 n where E0 is the starting equity or account balance, En is the equity at the end of the nth period, and 252/n / are the years expressed as a decimal. When the 1-period returns are calculated using the standard method, then the annualized compounded rate of return is 252
⎛ En ⎞ n AROR ORcompounde ⎟ −1 m d =⎜ ⎝ E0 ⎠ Note that AROR or R (capital) refers to the annualized rate of return while r is the daily or 1-period return. Also, the form of the results is different for the two calculations. An
51
Basic Concepts and Calculations
increase of 25% for the simple return will show as 0.25 while the same increase using the compounded returns will be 1.25. When the 1-period returns use the ln method, then the annualized rate of return is the sum of the returns divided by the number of years AROR ORln method t
∑ =
n
r
i =1 i
n
An example of this can be found in column F, the row labeled AROR, in the previous spreadsheet. Note that the annualized returns using the ln method are much lower than those using division and compounding. The compounded method will be used throughout this book. Probability of Returns The use of the standard deviation and compounded rate of return are combined to find the probability of a return objective. In the following calculation,2 the arithmetic mean of continuous returns is ln(1 + Rg), and it is assumed that the returns are normally distributed. ⎛T ⎞ ln ⎜ ⎟ − ln(1 + Rg )n ⎝B⎠ z= s×n where
z = standardized variable (can be found in Appendix A1) T = target value or rate-of-return objective B = beginning investment value Rg = geometric average of periodic returns n = number of periods s = standard deviation of the logarithms of the quantities 1 plus the periodic returns
Risk and Volatility While we would always like to think about returns, it is even more important to be able to assess risk. With that in mind, there are two extreme risks. The first is event risk, which takes the form of an unpredictable price shock. The worst of these is catastrophic risk, which will cause fatal losses or ruin. The second risk is self-induced by overleverage, or gearing up your portfolio, until a sequence of bad trades causes ruin. The risk of price shocks and leverage will both be discussed in detail later in other chapters. The standard risk measurement is useful for comparing the performance of two systems. It is commonly applied to the returns of a single stock or an entire portfolio
2
This and other very clear explanations of returns can be found in Peter L. Bernstein, The Portable MBA in Investment.
52
TRADING SYSTEMS AND METHODS
compared to a benchmark, such as the returns of the S&P 500 or a bond fund. The most common estimate of risk is the standard deviation, σ, of returns, r, shown earlier in this chapter. For most discussions of risk, the standard deviation will also be called volatility. When we refer to the target volatility of a portfolio, we mean the percentage of risk represented by 1 standard deviation of the returns, annualized. For example, in the previous spreadsheet, columns D and E show the daily returns. The standard deviations of those returns are shown in the same columns in the row “Std Dev” as 0.01512 and 0.01495. Looking only at column D, 1 standard deviation of 0.01502 means that there is a 68% chance of a daily profit or loss less than 1.502%. However, target volatility always refers to annualized risk, and to change a daily return to an annualized one we simply multiply by 252. Then the daily standard deviation of returns of 1.512% becomes an annualized volatility of 23.8%, also shown at the bottom of the spreadsheet example. Because we only care about the downside risk, there is a 16% chance that we could lose 23.8% in one year. The greater the standard deviation of returns, the greater the risk. Beta Beta (β) is commonly used in the securities industry to express the relationship of a single market to an index or portfolio. If beta is zero then there is no relationship; if it is positive then the single series tends to move with the index, both above and below. As beta gets larger the volatility of the single market tends to be increasingly greater than the index. Specifically, 0 < β < 1, the volatility of the single market is less than the index β = 1, the volatility of the single market is the same as the index β > 1, the volatility of the single market is greater than the index A negative beta is similar to a negative correlation, where the moves of the market are generally opposite to the index. Beta is found by calculating the linear regression of the single market with the index. It is the slope of the single market divided by the slope of the index. Alpha, the added value, is the y-intercept of the solution. The values can be found using Excel, and are discussed in detail in Chapter 6. A general formula for beta is Beta(A) = cov(returns A, returns B)/var(returns B) where A is the single market and B is a portfolio or index. Adjusting to the Target Volatility If we have a target volatility of 12%, that is, we are willing to accept a 16% chance of losing 12% in one year, but the actual returns show an annualized volatility of 23.8% based on an investment of $100,000, then to correct to a 12% target we simply increase the investment by 23.8/12.0, or a factor of 1.98 to $198,000, while holding the same position size. This is essentially deleveraging your positions by trading a smaller percentage of your account
53
Basic Concepts and Calculations
value. Alternatively, we can reduce the position size by dividing by 1.98 and keeping the investment the same. All results in this book will be shown at the target volatility of 12% unless otherwise stated. This is considered a modest risk level, which can be as high as 18% for some hedge funds. It will allow you to compare various systems and test results and see them at a level of risk that is most likely to represent targeted trading results. Annualizing Daily and Monthly Returns The previous examples used daily data and an annualization factor of 252. For monthly data, which is most common in published performance tables, we would take the monthly returns and multiply by 12 . In general, annualizing can be done by multiplying the data by the square root of the number of data items in a year. Then we use 252 for daily data, 12 for monthly, 4 for quarterly, and so on. Monthly Data Always Appears Less Volatile Although monthly performance results are common in financial disclosure documents, this convention works to the advantage of the person publishing the performance. It is unlikely that the highest or lowest daily net asset value (NAV) will occur on the last day of the month, so the extremes will rarely be seen, and the performance statistics will appear smoother than when using daily returns. Those responsible for due diligence before investing in a new product will often require daily return data in order to avoid overlooking a large drawdown that occurred mid-month. Using the S&P index as an example, the annualized volatility of the daily returns from 1990 through 2010 was 18.6%, but based on monthly returns it was only 15.3%. The risk based on monthly returns is 17.7% lower, but the annualized rate of return would be the same because it only uses the beginning and ending values. Downside Risk Because the standard deviation is symmetric, a series of jumps in profits will be interpreted as larger risk. Some analysts believe that it is more accurate to measure the risk as limited to only the downside returns or drawdowns. The use of only losses is called lower partial moments, where lowerr refers to the downside risk, and partial means where only one side of the return distribution is used. The easiest way to see this is semivariance, which measures the dispersion that falls below the mean, R , or some target value,
∑ (R − r ) Semivariance = n
i =1
i
n
2
, where each ri < R
However, the most common calculation for system performance is to take the daily drawdowns, that is, the net loss on each day that the total equity is below the peak equity. For example, if the system returns had produced an equity of $25,000 on day t, followed by a daily loss of $500, and another loss of $250, then we would have two values as input 500/25000 and 750/25000, or 0.02 and 0.03. Only those net returns below
54
TRADING SYSTEMS AND METHODS
the most recent peaks are used in the semivariance calculation. Alternatively, you could just take the standard deviation of these daily drawdowns to find the probable size of the drawdowns. One concern about using only the drawdowns to predict other drawdowns is that it limits the number of cases and discards the likelihood that higher-than-normal profits can be related to higher overall risk. In situations where there are limited amounts of test data, using both the gains and losses will give more robust results. When there is a large amount of data, the use of drawdowns can be a very good measurement. A full discussion of performance measurements can be found in Chapter 21, System Testing, and also in Chapter 23 under the headings “Measuring Return and Risk” and “Ulcer Index.”
THE INDEX The purpose of an average is to transform individuality into classification. In doing that, the data is often smoothed, and useful information is gained. Indexes have attracted enormous popularity in recent years. Where there was only the Value Line and S&P 500 trading as futures markets in the early 1980s, now there are stock index futures contracts representing the markets of every industrialized country. The creation of trusts, such as SPDRs (called “Spyders,” the S&P 500), Diamonds (DIA, the Dow Jones Industrials), and Qs (QQQ, the NASDAQ 100) have given stock traders a familiar vehicle to invest in the broad market rather than pick individual shares. Industrial sectors, such as pharmaceuticals, health care, and technology, first appeared as mutual funds, then as ETFs, and now can also be traded as futures. These index markets all have the additional advantage of not being constrained by having to borrow shares in order to sell short, or by the uptick rule (if it is reinstated) requiring all short sales to be initiated on an uptick in price. Index markets allow both individual and institutional participants a number of specialized investment strategies. They can buy or sell the broad market, they can switch from one sector to another (sector rotation), or they can sell an overpriced sector while buying the broad market index (statistical arbitrage). Institutions find it very desirable, from the view of both costs and taxes, to temporarily hedge their cash stock portfolio by selling S&P 500 futures rather than liquidating stock positions. They may also hedge using options on the S&P futures or SPYs. An index simplifies the decision-making process for trading. If an index does not exist, one can be constructed to satisfy most purposes. The index holds an important role as a benchmark for performance. Most investors believe that a trading program is only attractive if it has a better return-to-risk ratio than a portfolio of 60% stocks (as represented by the S&P 500 index), and 40% bonds (the Lehman Brothers Treasury Index). Beating the index is called creating alpha, proving that you’re smarter than the market.
Basic Concepts and Calculations
55
Constructing an Index An index is standardized way of expressing price movement, normally an accumulation of percentage changes. Most indexes have a starting value of 100 on a specific date. The selection of the base year is often “convenient” but can be chosen as a period of price stability. The base year for U.S. productivity and for unemployment is 1982; for consumer confidence, 1985; and for the composite of leading indicators, 1987. The CRB Yearbook shows the Producer Price Index (PPI) from as far back as 1913. For example, the PPI, which is released monthly, had a value of 186.8 in October 2010 and 185.1 in September 2010, a 0.9184% increase in one month. An index value less than 100 means that the index has less value than when it started. Each index value is calculated from the previous value as: ⎛ Current price ⎞ Current index value = Previous index index e value × ⎜ ⎟ ⎝ Previous price ⎠ and the 1-period returns are calculated in the same way as shown previously in this chapter.
Calculating the Net Asset Value—Indexing Returns The last calculations shown in the spreadsheet, Table 2.3, are the net asset value (NAV), calculated two ways. This is essentially the returns converted to an index, showing the compounded rate of return based on daily profit and losses relative to a starting investment. In the spreadsheet, this is shown in column F using standard returns and G using ln returns. The process of calculating NAVs can be done with the following steps: 1. Establish the initial investment, in this case $100,000, shown at the top of column C.
This can be adjusted later based on the target volatility. 2. Calculate the cumulative account value by adding the daily profits or losses
(column B) to the previous account value (column C). 3. Calculate the daily returns by either (a) dividing today’s profit or loss by yesterday’s
account value to get r, or (b) taking the natural log of 1 + r. 4. If using method (a) then each subsequent NAV Vt = NAV Vt−1 × (1 + rr), and if using method
(b) then each NAV Vt = NAV Vt−1 + ln(1 + r). r
The final values of the NAV are in the last dated rows. The U.S. government requires that NAVs be calculated this way, although it doesn’t specify whether returns should be based on the natural log. This process is also identical to indexing, which turns any price series into one that reflects percentage returns.
56
TRADING SYSTEMS AND METHODS
Leveraged Long or Short Index Funds As index markets have become more popular, financial engineering has created a wide range of innovative trading vehicles. Mutual funds, such as Rydex and ProFunds, cater to market timers, a group of money managers that may trade in and out of the funds each day. These funds track the major index markets closely, but offer unique variations. There are both long and short funds, and each may be leveraged. When you buy a long fund that tracks the S&P 500 (called Nova by Rydex), you are simply long the equivalent of the S&P 500. However, when you buy a short S&P fund, called Ursa, you profit when the S&P index price drops. In addition, both Rydex and ProFunds offer leverage of 1.5 or 2.0 on these funds, so that a gain of 1.0% in the S&P 500 translates into a gain of 2.0% in ProFunds’ UltraBull S&P fund; a drop of 1.0% in the S&P would generate a profit of 2.0% in ProFunds’ UltraBear fund. The motivation behind the short funds, or inverse funds, is to circumvent the U.S. government rule that does not permit short sales in retirement accounts. The calculation for leveraged long funds is very similar to a simple index; however, a short fund (where you profit from a decline in prices) is compounded to the upside, in the same way as a long fund. The following calculation will create a long and short index that closely approximates those used by Rydex and ProFunds. In addition, it includes the calculation of the daily high and low index values. If you intend to create a leveraged S&P index, start with the cash S&P price. Use the cash index equivalent for each of the mutual fund indexes that you plan to duplicate. In the following calculations, leverage is the leverage factor of the fund. Initial index values for both long and short funds are XC1 = 100 ⎛H ⎞ XH1 = XC1 + 100 × ⎜ 1 − 1.0 ⎟ × Leverage ⎝ C1 ⎠ ⎛L ⎞ XL1 = XC1 + 100 × ⎜ 1 − 1.0 ⎟ × Leverage ⎝ C1 ⎠ Each subsequent index value for long funds is ⎛⎛ C ⎞ ⎞ XC i = XC i−1 × ⎜⎜⎜⎜ i − 1.0 ⎟⎟ × Leverage + 1.0⎟⎟ ⎠ ⎝⎝ C i − 1 ⎠ ⎛⎛ H ⎞ ⎞ XH i = XC i−1 × ⎜⎜⎜ i − 1.0 ⎟ × Leverage + 1.0⎟⎟ ⎠ ⎝⎝ C i−1 ⎠ ⎛⎛ L ⎞ ⎞ XLi = XC i−1 × ⎜⎜⎜ i − 1.0 ⎟ × Leverage + 1.0⎟⎟ ⎠ ⎝⎝ C i−1 ⎠
Basic Concepts and Calculations
57
For each subsequent value for the short funds invert the middle term: ⎛⎛ C ⎞ ⎞ XC i = XC i−1 × ⎜⎜⎜ i−1 − 1.0 ⎟ × Leverage + 1.0⎟⎟ ⎠ ⎝⎝ C i ⎠ ⎛⎛ H ⎞ ⎞ XH i = XC i−1 × ⎜⎜⎜ i−1 − 1.0 ⎟ × Leverage + 1.0⎟⎟ ⎠ ⎝⎝ C i ⎠ ⎛⎛ L ⎞ ⎞ XLi = XC i−1 × ⎜⎜⎜ i−1 − 1.0 ⎟ × Leverage + 1.0⎟⎟ ⎠ ⎝⎝ C i ⎠ where
XC, XH, H and XL = the leveraged index closing, high, and low prices C, H H, and L = the underlying close, high, and low prices or index values.
If there is no leverage, then substitute the value 1 for leverage in the equations.
Cross-Market and Weighted Index It is very convenient to create an index for two markets that cannot normally be compared because they trade in different units. For example, if you wanted to show the spread between gold and IBM, you could index them both beginning at the same date. The new indexes would then be in the same units (percent) and would be easy to compare. Most often, an index combines a number of related markets into a single number. A simple aggregate index x is the ratio of unweighted sums of market prices in a specific year to the same markets in the base year. Most of the popular indexes, such as the New York Stock Exchange Composite Index, fall into this class. A weighted aggregate index biases certain markets by weighting them to increase or decrease their effect on the composite value. The index is then calculated as in the simple aggregate index. When combining markets into a single index value, the total of all the weights will equal 1 and all weights are expressed as a percentage.
U.S. Dollar Index A practical example of a weighted index is the U.S. Dollar Index, traded as DX on the New York Board of Trade (NYBOT) and USDX on the Intercontinental Exchange (ICE). It is a trade-weighted geometric average of six currencies: the euro, 57.6%; the Japanese yen, 13.6%; the UK pound, 11.9%; the Canadian dollar, 9.1%; the Swedish krona, 4.2%; and the Swiss franc, 3.6%. The Dollar Index serves as a valuable economic indicator, but shows only 13.6% representing Asia. It is not a good substitute for a diversified world market portfolio.
58
TRADING SYSTEMS AND METHODS
The Dollar Index rises when the U.S. dollar increases in value relative to the other currencies. In the daily calculation of the Dollar Index, each price change is represented as a percent. If, for example, the euro rises 50 points from 1.2500 to 1.2550, the change is 1.2550/1.2500 = .004; this is multiplied by its weighting factor 0.576 and contributes –0.002304 to the index (a rising euro is a falling dollar).
STANDARD MEASUREMENTS OF PERFORMANCE As important as standardizing risk and return is the need to compare the performance of two funds or two trading models in order to decide which is best. That decision is normally made based on a combination of return and risk. The simplest and most practical of these measurements is the information ratio (IR) Informatio t n ratio r =
Annualized returns t Annualized ris r k
where both annualized returns and annualized risk (the same as annualized volatility) have been given in the previous section of this chapter. When you compare performance using any return/risk ratio, you are looking for the optimum point on the efficient frontier. That is, any fund with a higher return but the same risk will be preferable, and any fund with the same return but a lower risk will be preferable. Sharpe Ratio The Sharpe ratio, presented by William F. Sharpe, is the most popular of all performance measures. It differs from the more generic information ratio in that it isolates excess return by subtracting the risk-free rate of return from the fund performance Sharpe ratio =
Annualized returns t − Risk -ffree returns t Annualized ris r k
Treynor Ratio The Treynor ratio also isolates excess return; however, it replaces the annualized risk of the fund or trading program with the beta of the portfolio. Beta is the volatility (risk) of a stock relative a benchmark index, for example, the S&P. The portfolio beta is the sum of the weighted individual stock betas within the portfolio. If the fund has a beta of 1.2, then it has 20% more volatility than the overall market and moves generally in the same direction (see the previous section on beta). The Treynor ratio is Treyno y r ratio r =
Annualized returns t − Risk-ffree returns t Program beta
59
Basic Concepts and Calculations
Other Performance Measurements There are numerous variations on performance measures of varying degrees of usefulness. Most often the simplest ones are the best. The value of any measurement is to rank one trading system or fund above another in terms of risk and reward; that is, to help make the decision that one is better. The developers of each performance measure believe that each of others is flawed, yet the most popular ratios will usually rank the candidate programs in similar order. The most common performance measure after the information ratio is simply the maximum drawdown relative the investment size. The maximum drawdown should always be measured as a percentage from a highest NAV to the lowest subsequent NAV. The maximum drawdown is important because, in a long performance record, a single, large drawdown can be lost in the standard deviation when there are an overwhelming number of “normal” drawdowns. A statistician might be satisfied saying that there is a very, very small chance of that large drawdown occurring again, but an investor might want to know that it did happen and understand why it happened. One measure that accounts for this is the Calmar ratio Calmar ratio =
Annualized retur t rn M Maximu md drawdown
Another measure that tries to focus on the drawdowns is the Sortino ratio. It uses downside volatility as the risk, which is the lower partial moment of degree 2, but can also be substituted with the standard deviation of those days in which the NAV was lower than the previous high NAV (see the section on semivariance). Sortino ratio r =
Annualized retur t rn − Risk ffree retur t rn Downside volatility t
These performance measures will be used throughout the book when comparing different systems. They will be discussed further, along with other performance measures, in Chapter 21, System Testing.
PROBABILITY Calculation must measure the incalculable. —Dixon G. Watts Change is a term that causes great anxiety. However, the effects and likelihood of a chance occurrence can only be measured—not predicted. The area of study that deals with uncertainty is probability. Everyone uses probability in daily thinking and actions. When you tell someone that you will “be there in 30 minutes,” you are assuming: • Your car will start. • You will not have a breakdown.
60
TRADING SYSTEMS AND METHODS
• You will have no unnecessary delays. • You will drive at a predictable speed. • You will have the normal number of green lights. All these circumstances are extremely probabilistic, and yet everyone makes the same assumptions. Actually, the 30-minute arrival is intended only as an estimate of the average time it should take for the trip. If the arrival time were critical, you would extend your estimate to 40 or 45 minutes to account for unexpected events. In statistics, this is called increasing the confidence interval. You would not raise the time to two hours because the likelihood of such a delay would be too remote. Estimates imply an allowable variation, all of which is considered normal. Probability is the measuring of the uncertainty surrounding an average value. Probabilities are measured in percent of likelihood. For example, if M numbers from a total of N are expected to fall within a specific range, the probability P of any one number satisfying the criteria is P=
M , 0< P Yieldt−3mo then rates will rise • If (R ( > 0.3 or IYO > 0.5) and Yieldt < Yieldt−3mo then rates will fall
Money Supply Using monthly data for M2 and the 3-month Treasury bill yields, where m is the current month, If (M2 ( m−M2 − m−1) > (M2 ( m−M2 − m−6) and Yieldt > Yieldt−11mo then rates will rise If (M2 ( m−M2 − m−1) < (M2 ( m−M2 − m−6) and Yieldt < Yieldt−11mo then rates will fall Consumer Sentiment Using the University of Michigan’s Consumer Sentiment Survey (CS), S and where m is the month it is released, If CS Sm > CS Sm−12 and CS Sm > CS Sm−11 and Yieldt > Yieldt−4mo then rates will rise If CS Sm < CS Sm−12 and CS Sm < CS Sm−11 and Yieldt < Yieldt−4mo then rates will fall Unemployment Claims Using monthly unemployment claims (UC) C released on the first Friday of each month, If UC Cm < UC Cm−11 and UC Cm > UC Cm−14 then rates will rise If UC Cm > UC Cm−11 and UC Cm < UC Cm−14 then rates will fall The big picture of price direction is very important, and an accurate forecast can greatly improve results. Using fundamental data in a systematic way is perfectly consistent with other algorithmic approaches.
7
Murray A. Ruggiero, Jr., “Fundamentals Pave Way to Predicting Interest Rates,” Futures (September 1996).
CHAPTER 3
Charting
I
t is very likely that all trading systems began with a price chart, and we come back to a chart whenever we want a clear view of where the market is going. Nowhere can a picture be more valuable than in price forecasting. Elaborate theories and complex formulas may ultimately be successful, but the loss of perspective is easily corrected with a simple chart. We should remember the investor who, anxious after a long technical presentation by a research analyst, could only blurt out, “But is it going up or down?” Even with the most sophisticated market strategies, the past buy and sell signals should be seen on a chart. The appearance of an odd trade can save you a lot of aggravation and money. Through the mid-1980s technical analysis was considered only as chart interpretation. In the equities industry, that perception is still strong. Most traders begin as chartists, and many return to it or use it even while using other methods. William L. Jiler, a great trader and founder of Commodity Research Bureau, wrote: One of the most significant and intriguing concepts derived from intensive chart studies by this writer is that of characterization, or habit. Generally speaking, charts of the same commodity tend to have similar pattern sequences which may be different from those of another commodity. In other words, charts of one particular commodity may appear to have an identity or a character peculiar to that commodity. For example, cotton charts display many round tops and bottoms, and even a series of these constructions, which are seldom observed in soybeans and wheat. The examination of soybean charts over the years reveals that triangles are especially favored. Head and shoulders formations abound throughout the wheat charts. All commodities seem to favor certain behavior patterns.1 In addition to Jiler’s observation, the cattle futures market is recognized as also having the unusual occurrence of “V” bottoms. Until recently, both the silver and pork belly 1
William L. Jiler, “How Charts Are Used in Commodity Price Forecasting,” Commodity Research Publications (New York, 1977).
79
80
TRADING SYSTEMS AND METHODS
markets have tendencies to look very similar, with long periods of sideways movement and short-lived but violent price shocks, where prices leap rather than trend to a new level. The financial markets have equally unique personalities. The S&P traditionally makes new highs, then immediately falls back; it has fast, short-lived drops and slower, steadier gains. Currencies show intermediate trends bounded by noticeable major stopping levels while interest rates and bonds have long-term trends. Charting remains the most popular and practical form for evaluating price movement, and numerous works have been written on methods of interpretation. This chapter will summarize some of the accepted approaches to charting and the trading rules normally associated with these patterns. Some conclusions are drawn as to what is most likely to work and why. The next chapter covers systems that are derived from these patterns and are designed to take advantage of behavioral patterns found in charts.
FINDING CONSISTENT PATTERNS A price chart is often considered a representation of human behavior. The goal of any chart analyst is to find consistent, reliable, and logical patterns that can be used to predict price movement. In the classic approaches to charting, there are consolidations, trend channels, top-and-bottom formations, and a multitude of other patterns that are created by the repeated action of large groups of people in similar circumstances or with similar objectives. The most important of all the chart patterns is the trendline. Only recently have computer programs been able to interpret chart patterns; and only one book, Bulkowski’s Encyclopedia of Chart Patterns2 has managed to show a comprehensive analysis of chart formations. In all fairness, there can be numerous valid interpretations of the same chart. In order to identify a chart price formation, it is first necessary to select the data frequency (for example, daily or weekly), then the starting date and a time horizon (long-term or short-term), before a chart interpretation can begin. Given the wide range of choices, it should be surprising that any two analysts see the same patterns at the same time. Chart analyses, frequently published in magazines, may themselves be the cause of the repeated patterns. Novice speculators approach the problem with great enthusiasm and often some rigidity in an effort to follow to the rules. They will sell double and triple tops, buy breakouts, and generally do everything to propagate the survival of standard chart formations. Because of their following, it is wise to know the most popular techniques, if only as a defensive measure. Chapter 4 will review some of the attempts to turn these patterns into trading systems. 2 Thomas
N. Bulkowski, Encyclopedia of Chart Patterns (New York: John Wiley & Sons, 2000). Results of Bulkowski’s studies are included in Chapter 4, in the section “A Study of Charting Patterns.”
Charting
81
What Causes Chart Patterns? Speculators have many habits, which, taken in large numbers, cause recognizable chart patterns. The typical screen trader (not on the exchange floor), or an investor placing his or her own orders, will usually choose an even number—for example, buy Microsoft at $26.00, rather than at $26.15. If even dollar values are not used, then 50¢ and 25¢ are the next most likely increments, in that order. And, as the share prices get higher, the increments get farther apart. With Berkshire Hathaway (BKA) trading at $125,000 per share, placing an order at a $10 increment would seem very precise. In futures trading, the same is true. There are far more orders placed in the S&P Index at 1310.00 than at 1306.50, or 10-year Treasury notes at 115 16 32 instead of 115 19 32 . The public is also said to always enter into the bull markets at the wrong time. When the television financial news, syndicated newspapers, and radio carry stories of dangerously low oil supplies, a new cancer treatment drug, or the devastation of the nation’s wheat crop, the infrequent speculator enters in what W. D. Gann calls the grand rush, causing the final runaway move before the collapse or the final sell-off before the rally; this behavior is easily identifiable on a chart. Gann also talks off lost motion, the effect of momentum that carries prices slightly past its goal. Professional traders recognize that a fast, volatile price may move as much as 10% farther than its objective. A downward swing in the U.S. dollar/Japanese yen from par at 1.0000 to a support level of 0.8000 could overshoot the bottom by 0.0100 without being considered significant. The behavioral aspects of prices appear rational. In the great bull markets, the repeated price patterns and divergence from chance movement are indications of the effects of mass psychology. The classic source of information on this topic is Mackay’s Extraordinary Popular Delusions and the Madness of Crowds originally published in 1841.3 In the preface to the 1852 edition the author says: We find that whole communities suddenly fix their minds on one object, and go mad in its pursuit; that millions of people become simultaneously impressed with one delusion. . . . In 1975, sugar was being rationed in supermarkets at the highest price ever known, 50¢ per pound. The public was so concerned that there would not be enough at any price that they bought and horded as much as possible. This extreme case of public demand coincided with the price peak, and shortly afterwards the public found itself with an abundant supply of high-priced sugar in a rapidly declining market. The world stock markets are often the target of acts of mass psychology. While U.S. traders watched at a distance the collapse of the Japanese stock market from its heights of 38,957 at the end of December 1989 to its lows of 7,750 in 2003, a drop of 80%, they were able to experience their own South Sea Bubble when the NASDAQ 100 fell 83.5% from its highs of 4,816 in March 2000 to 795 in October 2002. And, while the subprime crisis has taken years to play out, the unparalleled drop in value of nearly all investments at the same time, 3
Reprinted in 1995 by John Wiley & Sons.
82
TRADING SYSTEMS AND METHODS
September 2008, was clearly an act of investor panic. Prices seem to drop suddenly at the time when buyers are most confident, then start the long climb up again. It should not be difficult to understand why contrary thinking has developed a strong following. Charting is a broad topic to be studied in detail; the chart paper itself and its scaling are sources of controversy. A standard bar chart (or line chart) representing highs and lows can be plotted for daily, weekly, or monthly intervals in order to smooth out the price movement over time. Bar charts have been drawn on semilog and exponential scales,4 where the significance of greater volatility at higher price levels is put into proportion with the quieter movement in the low ranges by using percentage changes. Each variation gives the chartist a unique representation of price action. The shape of the chart box and its ratio of height/width will alter interpretations that are based on angles. Standard charting techniques may draw trendlines at 45° or 30° angles across the chart; therefore, expanding or compressing a chart on a screen will change the angles. This chapter uses traditional daily price charts and square boxes. It may be a concern to today’s chartist that the principles and rules that govern chart interpretation were based on the early stock market, using averages instead of individual stocks or futures contracts. This is discussed in the next section. For now, refer to Edwards and Magee, who removed this problem by stating that “anything whose market value is determined solely by the free interplay of supply and demand” will form the same graphic representation. They continued to say that the aims and psychology of speculators in either a stock or commodity environment would be essentially the same, that the effect of postwar government regulations have caused a “more orderly” market in which these same charting techniques can be used.5
WHAT CAUSES THE MAJOR PRICE MOVES AND TRENDS? Prices can move higher for many months or even years, creating a bull market. They can also move down, creating a bear market. Although price moves can be as short as a few minutes or as long as decades (as happened with interest rates and gold), it is how each chartist defines a “trend” that is most important. Once recognized, the price trend forms a bias for trading decisions that can make the difference between success and failure. The long-term direction of prices is driven by four primary factors: 1. Government policy. When economic policy targets a growth rate of 4%, and the current growth rate is 1%, the Federal Reserve (the “Fed” or any central bank) lowers interest rates to encourage growth. Lowering rates stimulates business activity. The Fed raises interest rates and dampens economic activity to control inflation. Changing interest rates has a profound impact on the flow of investment money between countries, on international trade, on the value of currencies, and on business activity. 4 R.W.
Schabacker, Stock Market Theory and Practice, Forbes (New York, 1930), 595–600. Robert D. Edwards and John Magee, Technical Analysis of Stock Trends (Springfield, MA: John Magee, 1948), Chapter 16.
5
Charting
83
2. International trade. When the United States imports goods, it pays for it in dollars.
That is the same as selling the dollar. It weakens the currency. A country that continually imports more than it exports increases its trade deficit and weakens its currency. A country that increases its exports strengthens its currency and its economy. 3. Expectation. If investors think that stock prices will rise, they buy, causing prices
to rise. Expectations can lead an economic recovery although there is no statistical data to support a recovery. Consumer confidence is a good measure of how the public feels about spending. The economy is active when consumer confidence is high. A lack of public confidence following the subprime collapse dampened all economic activity and delayed the recovery for years. 4. Supply and demand. A shortage, or anticipated shortage, of any product causes its
price to rise. An oversupply of a product results in declining prices. These trends develop as news makes the public aware of the situation. A shortage of a product that cannot be replaced causes a prolonged effect on its price, although the jump to a higher price may happen quickly.
THE BAR CHART AND ITS INTERPRETATION BY CHARLES DOW The bar chart, also called the line chart, became known through the theories of Charles H. Dow, who expressed them in the editorials of the Wall Street Journal. Dow first formulated his ideas in 1897 when he created the stock averages in order to have a more consistent measure of price movement for stock groups. After Dow’s death in 1902, William P. Hamilton succeeded him and continued the development of his work into the theory that is known today. Those who have used charts extensively and understand their weak and strong points might be interested in just how far our acceptance has come. In the 1920s, a New York newspaper was reported to have written: One leading banker deplores the growing use of charts by professional stock traders and customers’ men, who, he says, are causing unwarranted market declines by purely mechanical interpretation of a meaningless set of lines. It is impossible, he contends, to figure values by plotting prices actually based on supply and demand; but, he adds, if too many persons play with the same set of charts, they tend to create the very unbalanced supply and demand which upsets market trends. In his opinion, all charts should be confiscated, piled at the intersection of Broad and Wall and burned with much shouting and rejoicing.6 This attitude seems remarkably similar to the comments about program trading that followed the stock market plunge in October 1987, where it was condemned as the cause of the crash. In 2011 we again had comments about high frequency trading “manipulating” 6
Richard D. Wyckoff, Stock Market Technique, Number One (New York: Wyckoff, 1933), 105.
84
TRADING SYSTEMS AND METHODS
the markets, and in Europe they have banned short sales to stem volatility in the equity index markets. Of course, volatility continued to be high, but liquidity dropped. It’s politics, not logic. Charting has become an integral part of trading. The earliest authoritative works on chart analysis are long out of print, but the essential material has been recounted in newer publications. If, however, a copy should cross your path, read the original Dow Theory by Robert Rhea;7 most of all, read Richard W. Schabacker’s outstanding work Stock Market Theory and Practice, which is probably the basis for most subsequent texts on the use of the stock market for investment or speculation. The most available book that is both comprehensive and well written is Technical Analysis of Stock Trends by Edwards and Magee, now in its ninth edition.8 It is focused on chart analysis with related management implications and a small section on commodities. For the reader who prefers concise information with few examples, the monograph by W. L. Jiler, Forecasting Commodity Prices with Vertical Line Charts, and a complementary piece, Volume and Open Interest: A Key to Commodity Price Forecasting, can still be found.9 Two more recent publications that are widely read are John Murphy’s Technical Analysis of the Financial Markets and Jack Schwager’s Schwager on Futures: Technical Analysis, part of a two-volume set.
The Dow Theory The Dow Theory10 is still the foundation of chart interpretation and applies equally to stocks, financial markets, commodities, and the wide variety of investment vehicles used to trade them. It is part investor psychology supported by chart analysis. It is impressive that it has withstood the tests of more than 100 years. Charles Dow was the first to create an index of similar stocks—the Industrials and the Railroads, although today’s components are very different from those in 1897. The purpose of the index was to smooth out erratic price movement and find consistency by combining less active stocks. Thin trading causes unreliable price patterns. Dow’s work can be viewed in two parts: his theory of price movement, and his method of implementation. Both are inseparable to its success. Dow determined that the stock market moved as the ocean, in three waves, called primary, secondary, and 7 Arthur
Sklarew, Techniques of a Professional Chart Analyst (Commodity Research Bureau, 1980). 8 Robert D. Edwards and John Magee, Technical Analysis of Stock Trends, 9th ed. (Snowball Publishing, 2010). 9 Two other works worth studying are Gerald Appel, Winning Market Systems: 83 Ways to Beat the Market (Great Neck, NY: Signalert, 1974); and Gerald Appel and Martin E. Zweig, New Directions in Technical Analysis (Great Neck, NY: Signalert, 1976). 10 The rules of the Dow Theory in this section are based on a fine article by Ralph Acampora and Rosemarie Pavlick, “A Dow Theory Update,” originally published in the MTA Journal (January 1978, reprinted in the MTA Journal, Fall–Winter 2001). Other parts of this section are drawn from Kaufman, A Short Course in Technical Trading (Hoboken, NJ: John Wiley & Sons, 2003).
Charting
85
FIGURE 3.1 Dow Industrial, Utilities, and Transportation Indexes, 1991–2010. Dow originally created the industrial and railway averages to hide the large, erratic price moves caused by price manipulation and lack of liquidity. Dow Theory has been adapted to use the current versions of the major indexes, the Industrials (top panel), the Utilities (center panel), and the Transportation Index (bottom panel). Although these indexes represent different aspects of the economy, they have become highly correlated.
daily fluctuations. The major advances and declines, lasting for extended periods, were compared to the tides. These tides were subject to secondary reactions called waves, and the waves were comprised off ripples. Readers familiar with other charting methods will recognize these patterns as the foundation of Elliott Wave analysis. In 1897, Dow published two sets of averages in the Wall Street Journal, the Industrials and the Railroads in order to advance his ideas. These are now the Dow Jones Industrial Average and the Transportation Index. Figure 3.1 shows more than 20 years of history for the three most important averages the Industrials, the Transportation, and the Utilities.
The Basic Tenets of the Dow Theory There are six fundamental principles of the Dow Theory that fully explain its operation. 1. The Averages Discount Everything (except “acts of God”) At the turn of the twentieth century there was considerably less liquidity and regulation in the market; therefore, manipulation was common. By creating averages, Dow could reduce the frequency of “unusual” moves in a single stock, that is, those moves that seemed unreasonably large or out of character with the rest of the market. Dow’s Industrials average the share value of 30 companies (adjusted for splits); therefore, an odd move in one of those prices would only be 1 30 of the total, reducing its importance so that it would not distort the results. The average also represented far greater combined liquidity than a single stock. The only large moves that would appear on a chart of the average price were price shocks, or “acts of God.”
86
TRADING SYSTEMS AND METHODS
2. Classifications of Trends There are three classifications of trends: primary trends, secondary swings, and minor day-to-day fluctuations. The primary trend, also called the wave, is the trend on a grand scale. When there is a wave of rising prices we have a bull market; when prices are declining there is a bear market. A wave is a major move over an extended period of time, generally measured in years. A clear bull market can be seen in the previous Dow charts (Figure 3.1) throughout all of the 1990s ending at the beginning of 2000, and again from 2003 through mid-2007. Bull and Bear Market Formation (for Monthly or Weekly Prices) The beginning of a bull or bear market is determined using a breakout signal, shown in Figure 3.2, based on large swings in the index value (a complete explanation of breakout signals can be found in Chapter 5). The bull market signal occurs at the point where prices confirm the uptrend by moving above the high of the previous rally. The bear market signal occurs on a break below the low of the previous decline. It is commonly accepted that a bull or bear market begins when prices reverse 20% from their lows or highs. In order to get an upwards breakout signal needed for a new bull market, we want to look at support and resistance levels (the previous intermediate high and low prices) separated by approximately a 10% price move based on the index value. This type of signal is called swing trading. At the top of Figure 3.2 the horizontal broken line should occur at about 20% below the absolute price highs, and the second peak should be approximately 10% higher than the previous swing low. It is interesting to note that both bull and bear markets start with a price reversal of 20%. But 20% from the highs can be much greater than 20% from the lows. For example, in the sell-off in September 2008, the S&P was measured from its high of about 14,000 in late
Bear market
Bear market signal Breakout
Bull market resumes
Bull market
FIGURE 3.2 Bull and bear market signals are traditional breakout signals, but on a larger scale.
Charting
87
2007. A decline to 11,200, or 2,800 points, triggered the bear market. In the first quarter of 2009, the S&P reached its lows of about 6,500. A new bull market began at 7,800, a rally of only 1,300 points. Thus the number of points needed to “officially” start a bull market was only 46% of the bear market trigger, showing a significant bias toward bull markets. Bull and Bear Market Phases In Dow Theory, the primary trends develop in three distinct phases, each characterized by investor action. These phases can be seen in the NASDAQ bull market of the late 1990s and the subsequent bear market (Figure 3.3). The Bull Market Phase 1: Accumulation. Cautious investors select only the safest and best-valued stocks to buy. They limit purchases to deeply discounted stocks at depressed price levels and consider only primary services and industries, most often buying utilities and high yielding stocks. Phase 2: Increasing volume. Greater investor participation causes increasing volume, rising prices, and an improving economic picture. A broader range of investors enters the market convinced that the market has seen its lowest prices. Secondary stocks become popular. Phase 3: Final explosive move. Excessive speculation and an elated general population result in a final explosive move. Everyone is talking about the stock market;
FIGURE 3.3 NASDAQ from April 1998 through June 2002. A clear example of a bull and bear market with a classic pattern of volume.
88
TRADING SYSTEMS AND METHODS
people who have never considered investing directly now enter the market. The public is convinced that profits will continue and buying becomes indiscriminate. Investors borrow to buy stocks. Value is unimportant because prices keep rising. Earnings and dividends are ignored. The Bear Market Phase 1: Distribution. Professionals begin selling while the public is in the final stages of buying. Stocks are distributed from stronger to weaker hands. The change of ownership is facilitated by less experienced investors who enter the bull market too late and pay what turn out to be unreasonably high prices. Phase 2: Panic. Prices decline faster than at any time during the bull market and fail to rally. The news constantly talks about the end of the bull market. The public sees an urgency to liquidate. Investors who borrowed money to invest late in the bull market, trading on margin or leverage, now speed up the process. Some are forced to liquidate because their portfolio value has dropped below the critical point. The divesting of stocks takes on a sense of panic. Phase 3: Lack of buying interest. The final phase in the sustained erosion of prices results from the lack of buying by the public. After taking losses, investors are not interested in buying even the strongest companies at extremely undervalued prices. All news is viewed as negative. Pessimism prevails. It is the summer of 2002. Schabacker’s Rules Schabacker also had a simple guideline to identify the end of both a bull and a bear market.11 End of a Bull Market 1. Trading volume increases sharply. 2. Popular stocks advance significantly while some other companies collapse. 3. Interest rates are high. 4. Stocks become a popular topic of conversation. 5. Warnings about an overheated stock market appear on the news.
End of a Bear Market 1. Trading volume is low. 2. Commodity prices have declined. 3. Interest rates have declined. 4. Corporate earnings are low. 5. Stock prices have been steadily declining and bad news is everywhere. 11
Adapted from James Maccaro, “The Early Chartists: Schabacker, Edwards, Magee,” Technical Analysis of Stocks & Commodities (November 2002).
89
Charting
Secondary Trends (Secondary Reactions Using Weekly or Daily Prices) Secondary reactions are also called corrections orr recoveries and can be identified using smaller swing values. Corrections in bull markets are attributed to the prudent investor taking profits. This profit phase can have an erratic start but is considered complete when prices rise above the previous secondary rally. The bull market is back in force when a new high occurs (see Figure 3.4), the point where a trader can enter a new long position. Lines may be substituted for secondary movements. In Dow Theory, a line is a sideways movement lasting from two to three weeks to months, trading in about a 5% range. Characteristics of a Secondary Reaction • There are a number of clear downswings. • The movement is more rapid in the reversal (down during a bull market) than in the primary move. • The reactions last from three weeks to three months. • If the volume during the price drop is equal to or greater than the volume just prior to the decline, then a bear market is likely. If volume declines during the drop, then a reaction is confirmed. • The atmosphere surrounding the decline is important. If there is a lot of speculation, then a bear market may develop. Minor Trends (Using Daily Prices) In Dow Theory, minor trends are the only trends that can be manipulated. They are usually under six days in duration. Because they are considered market noise, not affecting the major price direction, they are seen as frequent up and down movements.
Profittaking
Bull market resumes
Potential end to secondary reaction
Bull market
Reentering long positions
FIGURE 3.4 Secondary trends and reactions. A reaction is a smaller swing in prices that ends when a new high reinstates the bull market.
90
TRADING SYSTEMS AND METHODS
3. The Principle of Confirmation For a bull or bear market to exist, two of the three major averages (the Industrials, the Transportation, and the Utilities) must confirm the direction. When first created, the Dow Theory required the confirmation on only the Utilities and the Railroads. Although much has changed since Dow devised this rule, the purpose is to assure that the bull or bear market is a widespread economic phenomenon and not a narrower industry-related event. 4. Volume Goes with the Trend Volume confirms the price move. Volume must increase as the trend develops, whether it is a bull or bear market. It is greatest at the peak of a bull market or during the panic phase of a bear market. 5. Only Closing Prices Are Used Dow had a strong belief that the closing price each day was the most important price. It was the point of evening-up. Not only do day traders liquidate all of their positions before the close of trading, reversing their earlier impact, but many investors and hedge funds execute at the close. Although liquidity was a problem during Dow’s time, even actively traded stocks in today’s market show increased price swings when a larger order is executed during a quiet period. There is always high volume at the close of trading, when investors with short and long time frames come together to decide the fair price. Some traders believe that there is no closing price anymore, given the access to 24-hour trading; however, that is not yet true. Every market has a settlement price. This is usually at the end of the primary trading session (previously the pitt or open outcry session). The settlement price is necessary to reconcile all accounts, post profits and losses, and trigger needed margin calls. Banks could not operate without an official closing time and settlement price. 6. The Trend Persists A trend should be assumed to continue in effect until its reversal has been signaled. This rule forms the basis of all trend-following principles. It considers the trend as a longterm price move, and positions are entered only in the trend direction. The Dow Theory does not express expectations of how long a trend will continue. It simply follows the trend until a signal occurs that indicates a change of direction.
Interpreting Today’s S&P Using Dow Theory After 110 years, can the Dow Theory correctly interpret the major market index, the S&P? Figure 3.5 shows the S&P 500, using continuous, back-adjusted futures prices, from 1994 through the middle of 2003. The sustained bull market that began in 1987, or possibly 1984, peaks near the end of the first quarter of 2002. There is a steady increase in volume, as Dow had foreseen, although volume does not peak at the top of the market—it starts to decline noticeably about three months before the top. We will see in the study of volume that volume spikes occur at extremes, but a longer-term volume confirmation is very important. Declining volume at the beginning of 2003 signals a divergence in sentiment
91
Charting
HIG GH AT 1675
BEAR MARKET BEGINS
HIGH OF 1400
20% REVERSAL FROM 1675 OCCURS AT 1340
20% REVERSAL FROM 940 OCCURS AT 1128
20% REVERSAL FROM 1400 OCCURS AT 1120 BREAKOUT
LOW W AT 940 20% REVERSAL FROM LOWS OCCURS AT 900
Volume 11571.00
VOLUME RISES AS BULL MARKET CONTINUES
LOW AT 750
VOLUME DROPS NEAR TOP
VOLUME INCREASES SLIGHTLY
FIGURE 3.5 Dow Theory applied to the S&P. Most of Dow’s principles apply to the current marketplace, but some experience and interpretation is necessary.
that foretells the end of the bull market. Volatility increases as prices move towards the end of the uptrend, another predictable pattern. The price move from 1994 through the peak in 2002 shows both Phase 2 and Phase 3 of the bull market. The price decline in the third quarter of 1998 addresses the issue: Are there exceptions to the 20% rule that changes a bull market to a bear market? A 20% drop from a high of 1400 is 1120, very close to the point where prices stopped their decline and reversed. Dow never used the number 20%, and analysts would claim that, because of the speed of the decline and the quick recovery, this was not a bear market signal. Some of these decisions require judgment, some experience, and just a little bit of hindsight. Realistically, we cannot expect every Dow signal to always be correct, just as we cannot expect to be profitable on every trade. Long-term success is the real goal. Transition from Bull to Bear in the S&P Looking again for a 20% reversal from the S&P highs of 1675, we target the price of 1340. This time, volume has declined into the highs and continues to decline quickly. From the second quarter of 2000 through the first quarter of 2001 prices fall sharply, giving back the gains from mid-1997, nearly three years. When prices break below 1300 they confirm the previous low at the end of 2000, making it clear that a bear market is underway. During the subsequent decline, prices attempted to rally. There are four cases of a sharp “V” bottom followed by a significant move higher. After the low at 940 at the end of September 2001, prices move to about 1180, above the 20% reversal of 1128. However, after the first reversal to 1075 prices fail to move back above the highs, finally breaking below 1180 and continuing on to make new lows. Although the recovery exceeded 20%,
92
TRADING SYSTEMS AND METHODS
the lack of a confirming breakout can be interpreted as a bull market failure. Not every pattern falls neatly into a rule. We come to the last year of the S&P chart, where prices have resisted going below 850, and now appear to be moving above the level of 970 and about to confirm a bullish breakout. Is it the end of the bear market? Volume was the highest at the two lowest price spikes, and then declined. Many stocks are undervalued, according to experts, yet those same experts see no reason for the market to rally further because the recent rise has already reflected reasonable expectations for profits and growth in the next year. Who would be correct, Charles Dow or the talking heads of the financial news networks? It was Dow.
Dow Theory and Futures Markets The principles of the Dow Theory are simple to understand. Major price moves are most important when they are confirmed by volume. They follow a pattern created by investor action that seems to be universal when seen from a distance. In order to implement his theory, Dow created an index that minimized the erratic moves in individual stocks due to lack of liquidity and price manipulation. The primary features of the Dow Theory should hold for any highly liquid, actively traded market. This applies to index futures and most financial futures markets, as well as foreign exchange, which have enormous volume and reflect major economic trends. Because of the variety of products traded as futures and ETFs, an investor may be able to apply Dow’s principle of confirmation using any two related financial markets, such as the S&P Index, 10-year Treasury notes, or the U.S. dollar index, in the same way that the Industrials, Utilities, and Transportation indexes were used for stocks. A strong economic trend often begins with interest rate policy and has a direct impact on the value of the currency, and a secondary effect on the stock market. Stock prices can be stimulated by lower rates or dampened by raising rates; therefore, confirmation from these three sectors is reasonable. When trading in futures, the nearby contract (the one closest to delivery) is most often used; however, the total volume of all futures contracts traded for each market must be used rather than volume for a single contract.
CHART FORMATIONS While Dow Theory is a macro view of price movement, more often chart analysis deals with much shorter time periods. Most traders hold positions from a few days to a few weeks; however, they apply the same patterns to both shorter or longer intervals. Chart analysis uses straight lines and geometric formations on price charts. It analyzes volume only in the most general terms of advancing and declining phases. Chart patterns can be classified into the broad groups of: • Trendlines and channels • One-day patterns
Charting
• • • •
93
Continuation patterns Accumulation and distribution (tops and bottoms) Retracements Other patterns
Of these, the most important is the trendline.
The Trend in Retrospect It is easier to see the trend on a chart after it has occurred. Trying to identify the trend as it is developing is much more difficult. The monthly chart in Figure 3.6 shows a sustained uptrend trend, but there is a slowing of that trend toward the end. Will the upward trend continue? Will prices begin a downward trend? Will they move sideways? The purpose of charting is to apply tools that provide the best chance of identifying the future direction of prices. If wrong, these tools also control the size of the loss. The time interval is a key element when identifying a trend. Weekly and monthly charts show the major trends more clearly than daily charts. Longer-term charts remove much of the noise that interferes with seeing the bigger picture. Many chartists start by evaluating a weekly or monthly chart, then apply the lines and values developed on those charts to a daily chart. The weekly chart provides direction or biases the direction of trades while the daily chart, or even a 15-minute chart, is used for timing entries and exits. Further discussion of this can be found in Chapter 19.
FIGURE 3.6 The trend is easier to see after it has occurred. While the upwards trend is clear, are prices going to continue higher, or is this the end of the trend?
94
TRADING SYSTEMS AND METHODS
TRENDLINES The trendline determines the current direction of price movement, and often identifies the specific point at which that direction will change. The trendline is the most popular and recognized tool of chart analysis. Most analysts will agree that the trend is your friend; that is, it is always safer to take a position in the direction of the trend. • An upwards trendline is drawn across the lowest prices in a rising market. • A downwards trendline is drawn across the highest prices in a declining market. Figure 3.7 shows a classic downwards trendline, A, drawn on a chart of Intel. It connects the highest price of $22 with price peaks at 18.00, 16.75, and 16.15 before ending at 15.50. When prices move through the trendline heading higher, the downtrend has been penetrated. This may end the downtrend or cause a new downtrend line to be drawn. In this case it was the end of the downtrend.
Redrawing Trendlines Most trendlines are not as long-lived or clear as the downtrend in Intel, which was drawn after the fact. Instead, we will treat the uptrend as it develops. The first uptrend line, B, is drawn when the first reversal shows a second low point. The upwards trendline B is drawn across the lows of points 1 and 2. Although prices do not decline through trendline B, rising prices pull back to points 3 and 4, well above the trendline.
A 5 D
3
4 C
1
B
2
FIGURE 3.7 Upwards and downwards trendlines applied to Intel, November 2002 through May 2003.
Charting
95
At that point, we choose to redraw the upwards trendline connecting point 2 with 3 and 4, forming what appears to be a stronger trendline. Trendlines are considered more important when they touch more points. However, prices move up quickly, and we decide to redraw the trendline connecting points 4 and 5. It is very common to redraw trendlines as price patterns develop. Care must be taken to draw the lines in a way that touches the most points, although some chart analysts would draw a line that connects points 1 and 5, crossing through points 2, 3, and 4, because the final picture seems to represent the dominant upwards price pattern. This can be seen as the broken line in Figure 3.7.
Support and Resistance Lines Price movement creates patterns that reflect the combined perception that all investors have of the current economic situation. Trends result from confidence or concern about the health of business or the supply and demand of a product. When there is no dominant opinion, prices move sideways in a price range determined by current volatility levels— sometimes wide, sometimes narrow. Because there are always buyers and sellers, prices do not stand still. Investment funds continue to add and withdraw money from the market. Periods of uncertainty form a sideways price pattern. The top of this pattern is called the resistance level, and the bottom is the support level. Once established, the support and resistance levels become key to identifying whether a trend is still in force. A horizontal support line is drawn horizontally to the right of the lowest price in a sideways pattern. It is best when drawn through two or more points and may cross above the lowest price if it makes the pattern clear. It represents a firm price level that has withheld market penetration (or allowed minor penetration). It may be the most significant of all chart lines. In the chart of gold futures prices (Figure 3.8), the support line is drawn across the bottom of a sideways period, beginning at the first low price on the left but crossing slightly above the next lowest point. The support line could have been drawn at $280.50 to include the first cluster of low prices and crossing above the lows bars but representing a clear support level. A horizontal resistance line serves the same purpose as the support line and is drawn across the highest highs of the sideways interval. It represents the price that has resisted upwards movement. Resistance lines are not normally as clear as support lines because they are associated with higher volatility and erratic price movement. In Figure 3.8 there are two choices for the horizontal resistance line. The most common selection would be the line that begins at top 1 and crosses below the high of top 2. In the same spirit as the support line, a resistance line could have been drawn much lower, beginning at top 3 and crossing above a cluster of highs while penetrating through the bars with tops 1 and 2.12 12 In
Carol Oster, “Support for Resistance: Technical Analysis and Intraday Exchange Rates,” FRBNY Economic Policy Review (July 2000), the author shows that support and resistance levels specified by six trading firms over three years were successful in predicting intraday price interruptions. In addition, these levels were valid for about five days after they were noted.
96
TRADING SYSTEMS AND METHODS
FIGURE 3.8 Horizontal support and resistance lines shown on gold futures prices.
Note the Position of the Closing Price of the Bar A price bar that has the high price penetrating upwards through resistance but closes lower is considered a failed breakout and confirms the sideways pattern. The same is true for a failed penetration of the support level. You may choose to raise the resistance line to the high of that failed bar, but most chartists ignore it, keeping the resistance line at its original position. Then we can expect to see a number of high prices penetrate through the resistance lines as shown by the breakout 2 line in Figure 3.8. Resistance Becomes Support, and Support Becomes Resistance Horizontal support and resistance lines are strong indicators of change. If prices are moving sideways because investors are unsure of direction, then a move through either support or resistance is usually associated with new information that causes investors to act. Whatever the cause, the market interprets this as a new event. Having moved out of the sideways pattern, prices have a tendency to remain above resistance to confirm the change. If prices have moved higher, then the resistance line becomes a support line. If prices fall below the resistance line, the price move is considered a failed breakout. In the right part of Figure 3.8, prices break out above the resistance levels and then come back to test those levels. In this example, prices seem to confirm that the breakout 2 line was the more realistic resistance line. A Trendline Is a Support or Resistance Line The angled trendlines in Figure 3.7 are also called support and resistance lines. An upwards trendline, drawn across the lows, is a bullish support line because it defines the
Charting
97
lowest price allowed in order to maintain the upwards trend. The downward trendline, drawn across the highs, is a bearish resistance line. These angled trendlines are most reliable when used to identify major price trends. Horizontal lines work well for shorter time frames. Back-Adjusted Data All traders use online services to display charts. They can draw support and resistance lines using various tools supplied by the service and can convert daily data to weekly or monthly with a single click. When looking at prices that go back many years, the analyst must be sure that the older data is not back-adjusted in any way. For example, futures trade in contracts of limited maturity, and are most liquid during the last few months before expiration. Long-term charts put contracts together by back-adjusting the prices, so that the older data does not give the actual price at that time, but is altered by accumulated roll difference. Using those older prices as a guide for support or resistance doesn’t make any sense. This same problem exists for stocks that have split. The old price that you see on the chart may not be the actual price traded at that time. Floor traders are good at remembering the last major high or low and will trade against those prices, or buy and sell breakouts. When plotting the support and resistance lines, look for the data option that creates a history of prices without back-adjusting.
Rules for Trading Using Trendlines The simplest formations to recognize are the most commonly used and most important: horizontal support and resistance lines, bullish and bearish support and resistance lines, and channels created using those lines. Proper use of these basic lines is essential for identifying the overall direction of the market and understanding the patterns formed as prices move from one level to another. Many traders will generate their buy and sell orders directly from their chart analysis. Other, more computer-oriented analysts have automated the more important trendlines, particularly horizontal support and resistance, which has become the basic breakout system. Major chart patterns create the underlying profitability of chart trading; the more complex formations, as we will discuss further, may enhance good performance but rarely compensate for losses resulting from being on the wrong side of the trend. Once the support and resistance lines have been drawn, a price penetration of those lines creates the basic trend signal (Figure 3.9). The bullish support line defines the upward trend, and the bearish resistance line denotes the downward one. For long-term charts and major trends, this is often sufficient. Some traders add the additional rule that once the price has penetrated a trendline, it must remain penetrated for some time period in order to confirm the new trend. Most false penetrations correct quickly. Confirming the New Trend Direction In actual trading, the price crossing the trendline is not as clean as in Figure 3.8. Most often prices that have been moving higher will cross below the trendline, then recross
98
TRADING SYSTEMS AND METHODS
FIGURE 3.9 Basic sell and buy signals using trendlines.
moving higher, then move lower again. The trendline is an important turning point, and there may be indecision that is reflected in a sideways price movement before prices reestablish a trend. To deal with this situation, traders may: • Wait a set time period to confirm that prices remain on the new side of the trendline. • Wait for a reversal after the penetration, then enter a trade in the new direction even if the reversal crosses the trendline again. • Create a small safety zone (called a band or channel) around the trendline and enter the new trade if prices move through the trendline and through the safety zone. Each of these techniques requires a delay before entering. A delay normally benefits the trader by giving a better entry price; however, if prices fall quickly through an upwards trendline and do not reverse or slow down, then any delay will result in a much worse entry price. Unfortunately, most of the biggest profits result from breakouts that never pull back. Catching only one of these breakouts can compensate for all the small losses due to false signals. Many professional traders wait for a better entry price. They may be steady winners, but they do not often profit from the biggest moves.
Trading Rules for Horizontal Support and Resistance Levels As with angled trendlines, horizontal support and resistance lines show clear points for buying and selling. Also similar to angled trendlines, the horizontal lines become increasingly important when longer time intervals and more points are used to form the lines. The technique for entering trades using horizontal lines is similar to that using angled trendlines; however, the maximum risk of the trade is clearly defined. • Buy when prices move above the horizontal resistance line • Sell when prices move below the horizontal support line
99
Charting
Support #3 Close-out long Support #2
Horizontal resistance Buy
Support #1
Maximum risk
Horizontal support
FIGURE 3.10 Trading rules for horizontal support and resistance lines.
Once a long position has been entered, it is not closed out until prices move below the support line. The maximum risk of the trade is the difference between the support and resistance lines. As prices move higher, each swing reversal forms a low from which a new horizontal support line is drawn. After the initial entry, single points are most often used to create the horizontal support and raise the level at which the trade will be closed out. Figure 3.10 shows the pattern of horizontal support and resistance lines as the trade develops. For a swing low to form, prices must reverse by more than some threshold number of points or percentage. Not every small reversal qualifies as a swing low. Note that the first pullback in Figure 3.10 shows prices crossing below the original resistance line. This is a common occurrence, but the original line no longer holds the importance it had before it was broken. While it should provide support for the pullback (a resistance, once broken, becomes a support), it is more important to record the bottom of the new pullback as the support level. These new support levels need only one price point. After the third support level is drawn, prices rally but then fall back through the third level, at which point the long position is closed out. A short position, if any, is not entered until a new sideways price pattern is established and horizontal support and resistance lines can be drawn across more than one point. Identifying Direction from Consolidation Patterns It is said that markets move sideways about 80% of the time, which means that sustained directional breakouts do not occur often, or that most breakouts are false and fail to identify a new market direction. Classic accumulation and distribution formations, which occur at long-term lows and highs, attempt to find evolving changes in market sentiment. Because these formations occur only at extremes, and may extend for a long time, they represent the most obvious consolidation of price movement. Even a rounded or saucer-shaped bottom may have a number of false starts; it may seem to turn up in a
100
TRADING SYSTEMS AND METHODS
uniform pattern, then fall back and begin another slow move up. In the long run, the pattern looks as if it is a somewhat irregular, extended rounded bottom; however, using this pattern to enter a trade in a timely fashion can be disappointing. It is easier to average in, where smaller positions are entered at fixed intervals as long as the developing formation remains intact. Most other consolidation formations are best viewed in the same way as a simple horizontal sideways pattern, bounded above by a resistance line and below by a support line. If this pattern occurs at reasonably low prices, we can eventually expect a breakout upwards when the fundamentals change. Occasionally, prices seem to become less volatile within the sideways pattern, and chartists take this opportunity to redefine the support and resistance levels so that they are narrower. Breakouts based on these more sensitive lines tend to be less reliable because they represent a temporary quiet period inside the larger, normal level of market noise; however, there are two distinct camps, one that believes that breakouts are more reliable after a period of low volatility and the other that prefers breakouts associated with high volatility. Some of the situations are discussed in Chapter 20 under “VIX” and “Volatility System.”
Creating a Channel with Trendlines A channell is formed by a trendline and another line drawn parallel to the trendline enclosing a sustained price move. The purpose of the channel is to define the volatility of the price move and establish reasonable entry and exit points. Up to now, the trendline has only been used to identify the major price direction. A long position is entered when the price crosses a downward trendline moving higher. The trade is held until the price moves below the upwards trendline. However, it is more common to have a series of shorter trades. While the biggest profits come from holding one position throughout a sustained trend, a series of shorter trades each has far less risk and is preferred by the active trader. Be aware that trendlines using very little data are essentially analyzing noise and have limited value. Before a channel can be formed, the bullish or bearish trendline must be drawn. A clear uptrend line requires at least two, and preferably three or more major low points on the chart, as shown in Figure 3.11, where points 1, 2, and 3 are used. These points do not have to fall exactly on the line. Once the trendline is drawn, the highest high, point B, can be used to draw another line parallel to the upwards trendline. The area in between the two parallel lines is the channel. In theory, trading a channel is a simple process. We buy as prices approach the support line (in this case the upwards trendline), and we sell as prices near the resistance line. These buy and sell zones should be approximately the bottom and top 20% of the channel. Because the channel line is used to determine price targets, you might choose to draw the broken line across point A. The use of point A creates a channel that is narrower than the one formed using the higher point B and recognizes the variability of price movement. This allows you to take profits sooner. If prices continue through the lower trendline after a long position has been set, the trade is exited. The trend direction has changed, and a new bearish resistance line,
101
Charting
e C
el lin
n han llel c Para B Buy
A
Buy
Sell
zone
zone
3 2 dline tren
rd pwa
U
1
FIGURE 3.11 Trading a price channel. Once the channel has been drawn, buying is done near the support line and selling near the resistance line.
the downward trendline, needs to be drawn using points B and C, shown in Figure 3.12. Once the first pull-back occurs leaving a low at point 4, a parallel line is drawn crossing point 4, forming the downward channel. In a downward trending channel, it is best to sell short in the upper zone and cover the short in the lower zone. Buying in the lower zone is not recommended; trades are safest when they are entered in the direction of the trend. When the support and resistance lines are relatively horizontal, or sideways, the channel is called a trading range. There is no directional bias in a trading range; therefore,
Be a Ne rish w d res ow ista C nw n ard ce li tre ne nd line
B
A
D
is d
raw
n
3 2 1
Trend changes Trade is exited
4
Channel line drawn after first pullback
FIGURE 3.12 Turning from an upward to a downward channel. Trades are always entered in the direction of the trend.
102
TRADING SYSTEMS AND METHODS
you can enter new long positions in the support zone and enter new shorts in the sell zone. In both cases, penetration of either the support or resistance lines forces liquidation of the trade and establishes a new trend direction.
ONE-DAY PATTERNS The easiest of all chart patterns to recognize occur in one day. They include gaps, spikes, island reversals, reversal days, inside days, outside days, wide-ranging days, and, to a lesser extent, thrust days. Some of these patterns are important at the moment they occur, and others must be confirmed by other factors.
Gaps Price gaps occur when important news influences the market at a time when the exchange is closed. Orders accumulate to be executed on the next open. An upwards gap exists when the low of the current day is higher than the high of the previous day. If all trading were 24 hours, then we would see a fast, volatile move, but not a gap. For example, there are three popular ways to trade the S&P 500 index, 1. Futures, traded in the Chicago Mercantile Exchange pit from 8:30 A.M. to 3:15 P.M.
(Central time) 2. Spyders (SPY) on the AMEX during the same hours 3. The electronic S&P mini-futures contract which trades nonstop from Sunday evening
at 6 P.M. until Friday afternoon at 3:15 P.M. on the Globex platform Gaps only exist when using the primary trading session (the pit session). Most afterhours trading is on light volume and may be ignored for charting purposes. An exception is in Europe where they have an extended session from the original 4 P.M. close (European time) to 10 P.M. or 10:30 P.M. to allow trading at the same time the U.S. markets are open. The markets then close and reopen when the normal European business day begins. For European markets it is best to use the combined sessions that start at about 9 A.M. and continue until about 10 P.M. Economic reports are released by the U.S. government at 7:30 A.M. (Central time); therefore, they occur before the S&P pit trading and the SPDRs begin trading, but during the electronic emini S&P session. There is no gap in electronic trading, but the other markets will open sharply higher or lower to adjust to the current emini price. When the financial news shows give the expected open of the stock market, they are using the difference between the previous NYSE closing price and the current price of the electronic session. This creates frequent opening gaps in those markets. Gaps can also occur because of a large cluster of orders placed at the point where the stock or futures market penetrates support or resistance. It is possible to have a gap during the trading session, immediately following bullish economic report, or
Charting
103
concurrent with an anticipated news release of consequence, when there are a large number of buyers and few sellers. There is also the rarer case of an event shock such as September 11, 2001. In charting, gaps are interpreted differently based on where they occur in the current price pattern. In some cases, a gap signals a continued move and in other situations it is expected to be the end of a price move. The four primary gap formations are shown on a chart of Amazon.com in Figure 3.13. They are: 1. The common gap, which appears as a space on a chart and has no particular
attributes—that is, it does not occur at a point associated with any particular significance. A common gap appears in May 1999 during a downward move. 2. A breakaway gap occurs at a point of clear resistance or support. It occurs when
there are a large number of buy orders just above a major resistance line, or sell orders below a support line. Most often this is seen after a prolonged period of sideways price movement when most chartists can draw the same horizontal support and resistance lines. The clearer the formation, and the longer the sideways period, the more likely there will be a large breakaway gap. The term breakaway requires some hindsight because it is applied only when the gap is followed by a sustained price move. There are two breakaway gaps in Figure 3.13, the first shortly after prices make a new high, the second in the middle of the chart when prices break upwards through
FIGURE 3.13 Price gaps shown on a chart of Amazon.com.
104
TRADING SYSTEMS AND METHODS
a steep downward trendline, and the last near the right of the chart when prices gap through a clear downwards trendline. In order to trade a gap, a position must be entered in advance of the gap, as prices approach the support or resistance level. Once a long position is set and prices gap up you gain free exposure, which is the profit caused by the gap or by a fast market move in your favor. If prices do not gap up, they most often drift lower. The position can be exited with a small loss and reentered later. 3. An exhaustion gap occurs at the end of a sustained and volatile price move and confirms the reversal. Exhaustion gaps usually occur on the day after the highest price of the upwards move; however, in the Amazon chart, it is one day later. Because it signifies a clustering of orders anxious to exit the long side, it has all the signs associated with an exhaustion gap. 4. A runaway gap occurs at different points during a clear trend and confirms the trend. It does not appear to have any practical use because the trend can stop and reverse just after a runaway gap and it will be renamed an island top, or some other formation. When holding a long position, an upwards runaway gap quickly adds profits, but also signifies extreme risk. Gaps can also be a hindrance to trading. A long position held when a downward breakaway gap occurs guarantees that any stop-loss order is executed far away from the order price. If the upwards breakaway gap occurs on light volume, it may be a false breakout. If a short is held, and if you are lucky, prices will fall back to the breakout level and then continue lower. If unlucky, you will be executed at the high of the move. In the final analysis, if the gap breakout represents a major change, a trade should be entered immediatelyy at the market. The poor executions will be offset by the one time when prices move quickly and no pullback occurs. A breakaway gap on high volume is usually indicative of a strong move and a sustained change. Filling the Gap Tradition states that prices will retrace to fill the gap that occurred sometime earlier. Naturally, given enough time, prices will return to most levels; therefore, nearly all gaps will eventually be filled. The most important gaps are not filled for some time. The gap represents an important point at which prices move out of their previous pattern and begin a new phase. The breakaway gap will often occur just above the previous normal, or established, price level. With commodities, once the short-term demand imbalance has passed, prices should return to near-normal (perhaps slightly above the old prices given inflation), but also slightly below the gap. When a stock price gaps higher based on earnings, a new product announcement, or a rumor of an acquisition, the price may not return to the previous level. A computer study of opening gaps, and a program that performs the study, can be found in Chapter 15. It shows the probabilities of subsequent price moves following gaps, based on different-sized gaps, in a wide selection of markets. Bulkowski has a large section devoted to gaps, some of which will be covered in Chapter 4.
105
Charting
Trading Rules for Gaps • A common gap is small and occurs with low volume and for no specific reason; that is, it is not the result of an obvious, surprising news release. Active traders will take a position counter to the direction of the gap, expecting the move to reverse and fill the gap, at which point they will take profits. If the gap is not filled within a few days, the trade is liquidated. • A breakaway gap is the result of bunched orders at an obvious support or resistance area. When a clear sideways pattern has developed, place a buy order just under the resistance level in order to benefit from the jump in prices (free exposure) when the breakout occurs. If a gap occurs on the breakout, then prices should continue higher. • A runaway gap is often found in the middle of a significant move. It is considered a good point to add to your position because the runaway gap confirms the move and offers additional potential profits. • An exhaustion gap is best traded as it is being filled, and, even at that stage, it is highly risky. Sell during the move upwards, placing a stop above the previous high of the move. If this pattern fails, prices could move higher in an explosive pattern. If you are successive, profits could also be large. Bulkowski on Gaps Bulkowski includes an extensive study of breakaway, continuation, and exhaustion gaps. The statistics developed for these three cases all conform to the expected patterns, as shown in Table 3.1. Almost by definition, we expect a breakaway gap, one that occurs when prices move out of a sideways range, to mark the beginning of a new trend, and the exhaustion gap (which actually can’t be seen until it reverses) to be the end of a trend. The continuation gap is somewhere in between and is only defined within the context of an existing trend. The results of the breakaway gap, only 1% and 6% retracements, confirm that the breakouts often continue the trend direction. Strategies that take advantage of this are the N N-day breakout, swing trading, and pivot point breakouts, providing that the observation period is greater than 40 days, the minimum considered to be a macrotrend.
Spikes A spike is a single, highly volatile day where the price moves much higher or lower than it has in the recent past. A spike can only be recognized one day later because trading range TABLE 3.1 Percentage of Time Gaps Are Closed within oneWeek, Based on a Sample of 100 Stocks Gap Type
Breakaway Continuation Exhaustion
Uptrends
Downtrends
1 11 58
6 10 72
106
TRADING SYSTEMS AND METHODS
of the following day must be much lower. It is easiest to show spikes in markets, such as U.S. 30-year Treasury bonds, that react to frequent economic reports. In Figure 3.14 there is a series of three spikes about four weeks apart. An upward spike, as shown in Figure 3.14, is always a local top because a spike is a day with above-average volatility and must be bracketed by two lower days. In all three cases shown, the spike represented the high price for at least one week. Because the spike is a clear top, when prices begin to rise again, they usually meet resistance at the top of the spike. Chartists draw a horizontal resistance line using the high price of the spike, which encourages selling at that level. After each spike the chart is marked with “failed test,” showing the price level where resistance, based on the previous spike, slowed the advance. The spike did not stop the trend, but it did cause a unique pattern. Quantifying Spikes A spike has only one dominant feature: a price high or low much higher or lower than recent prices. It must therefore also have high volatility. The easiest way to identify an upside spike is to compare the trading range on the day of the spike to previous ranges and to the subsequent day. This can be programmed in TradeStation by using the true range function and satisfying the conditions that the high on the day of the spike is
Failed test Spike #3
Failed test
Spike #2 Spike #1
Failed test
FIGURE 3.14 A series of spikes in bonds. From June through October 2002, U.S. bonds show three spikes that represent local tops. The spikes represent clear resistance levels that cause a unique pattern in the upwards move.
107
Charting
greater than the previous and subsequent highs by the amount off k × average true range over n days, Spike = high[1] - highest(high,n)[2] > k*average(truerange,n)[2] and high[1] - high > k*average(truerange,n)[2]
In this code, spike is a logical variable (true-false). A spike that occurs yesterday (where [1] indicates yesterday and [2] two days ago) is tested to see that the high of the spike is greater than the high of the previous n days, greater than the average true range of the same n days by a factor of k, and also greater than the high of today by the same factor k. Note that the use of [2] ends the true range calculation on the day before the spike. The value off k should be greater than 0.75. Spikes satisfying k > 1 are more desirable but less frequent. In Excel, the true range is TRn = Max(Hn - Ln,Hn - Cm,Cm - Ln)
where n is the current row, m is the previous row (n-1), and the high, low, and close ((H H, L, can C C) are in columns B, C, and D.
Island Reversals An island reversal or an island top is a single price bar, or group of bars, sitting at the top of a price move and isolated by a gap on both sides, before and after the island formation. Combined with high volatility, this formation has the reputation of being a major turning point. The gap on the right side of the island top can be considered an exhaustion gap. In Figure 3.15, showing AMR during the first part of 2003, there is one island reversal in midApril. This single, volatile day has a low that is higher than both the previous day and the following day. It remains the high for the next week but eventually gives way to another volatile price rise. Island bottoms also occur, but are less frequent. Pivot Point Reversals and Swings A pivot point is a trading day, or price bar, that is higher or lower than the bars that come before and after. If the entire bar is above the previous day and the following day, the pivot point reversal is the same as the island reversal. If it is a very volatile upwards day but the low price is not above the high of the surrounding bars, then it is a spike. If it is not a volatile day, then it is a weaker form of a spike. If you were plotting swing highs and lows, the high of an upwards pivot point reversal day would often become the swing high. It is common to locate a swing high by comparing the high of any day with two or more days before and after. The patterns of the days on either side of the high bar are not important as long as the middle bar has the highest high. When more days are used to identify pivot points, these reversals are expected to be more significant; however, they take longer to identify.
108
TRADING SYSTEMS AND METHODS
FIGURE 3.15 AMR in early 2003 showing a classic island reversal with examples of other one-day patterns.
According to tests by Colby and Meyers,13 entries that occur based on a breakout of the highs or lows of the pivot points, called pivot point channels, are much more reliable than simply entering in the direction of the reversal based on the close of the last bar of the pivot point formation. For traders not interested in this very short-term strategy, a pivot point may help entry timing for any longer term method. More recently, Colby14 tested a Pivot Point Reverse Trading System, using the following rules: • Buy (and close out short positions) when a pivot point bottom occurs and the close is higher than the previous close. • Sell (and close out long positions) when a pivot point top occurs and the close is lower than the previous close. Applying these rules to the Dow Jones Industrials (DJIA) for 101 years ending December 2000 showed nearly 7,000 trades (70 per year) with significant profits. Other tests of pivot points can be found in Chapter 4. Cups and Caps Another name given to the pivot point reversals are cups and caps, each determined by only three price bars, although another formation with the same name, cup with handle, 13 Tests of pivot point reversals and pivot point channels can be found in Robert W. Colby and Thomas A.
Meyers, The Encyclopedia of Technical Market Indicators (Homewood, IL: Dow Jones-Irwin, 1988). 14 Robert W. Colby, The Encyclopedia of Technical Market Indicators (New York: McGraw-Hill, 2003), 510–514.
Charting
109
is similar to a longer-term rounded bottom followed by a sideways or slight downward trend and a breakout to the upside. These two short-term formations are associated with trading rules that are identical to pivot point channels applied to the shortest time frame. Although some literature uses these formations backwards, a cap formation identifies a sell signal when the trend is up, while a cup is a setup for a buy signal in a downtrend. Once an uptrend is clear, a cap formation is found using either the daily closes or daily lows. For any three consecutive days, the middle day must have the highest close or the highest low. In a cup pattern, the middle day must have the lowest low or the lowest close of the 3-day cluster. In both cases, the positioning of the highs and lows of the other two days are not important as long as the middle day is lower for the cup and higher for the cap. The cup will generate a buy signal if: • The cup formation is the lowest point of the downtrend • The buy signal occurs within three days of the cup formation • The current price closes above the highest high (middle bar) of the cup formation The signal is false if prices reverse and close below the low of the cup formation, resuming the previous downtrend. This pattern is only expected to forecast a downward price move of two days; however, every change of direction must start somewhere, and this formation could offer an edge. A cap formation is traded with the opposite rules.
Reversal Days and Key Reversal Days A day in which there is a new high followed by a lower close is a downwards reversal day. An upwards reversal day is a new low followed by a higher close. A reversal day is a common formation, as seen in Figure 3.16, the Russell 2000 futures. Some of these days are identified; however, you can find many other examples in Figures 3.13 through 3.16. There have been many studies to determine the importance of reversal days for trading, but these are inconclusive. In Chapter 15 there is a detailed study of reversal days, indicating the likelihood of a subsequent price move based on this reversal pattern and other combinations. A reversal day by itself is not significant unless it can be put into context with a larger price pattern, such as a clear trend with sharply increasing volatility, or a reversal that occurs at the highest or lowest price of the past few weeks. Key Reversals A key reversal day is a more selective pattern, and has been endowed with great forecasting power. It is also called an outside reversal day, and is a weaker form of an island reversal. A bearish key reversal is formed in one day by first making a new high in an upward trend, reversing to make a low that is lower than the previous low, and then closing below the previous close. It should be associated with higher volatility. Examples of key reversal days can be seen in Figures 3.14 and 3.15. It is considered more reliable when the trend is well-established.
110
TRADING SYSTEMS AND METHODS
OUTSIDE DAY
INSIDE DAY
OUTSIDE DAY REVERSAL DAY
INSIDE DAY
INSIDE DAY
REVERSAL DAY
INSIDE DAY
OUTSIDE DAY
INSIDE DAY
REVERSAL DAY OUTSIDE DAY AND KEY REVERSAL DAY INSIDE DAY FOLLOWED BY OUTSIDE DAY
KEY REVERSAL OUTSIDE DAY
REVERSAL DAY
FIGURE 3.16 Russell 2000 during the last half of 2002 showing reversal days, key reversal days, inside days, and outside days.
As with reversal days, studies have shown mixed results using the key reversal as a sole trading indicator. The most complete analysis,15 similar to others, concluded that the performance was “strikingly unimpressive.” Even though tests have not proved its importance, traders still pay close attention to key reversals. Because this pattern has kept its importance, we can conclude that other factors unconsciously enter into the selection of key reversal days for trading. A successful trader’s senses should not be underestimated; the extent and speed of the prior trend, a change in liquidity, a quieter market tone, or some external news may be essential in confirming the important reversals. The job of a system developer is to find those factors that will turn this pattern into a successful indicator. The best place to start is by assuming the attitude of those traders who see a reversal day as an important pattern. As noted earlier, a comprehensive study of reversal days and other patterns can be found in Chapter 15. Figure 3.16 shows a number of reversal days during the rapid drop of the Russell 2000 in January 2002. Three patterns of particular interest are the reversal days at the two extreme lows in July and October 2002, and the high in between, during August. Although there are many other reversal days embedded within other parts of the price move, the reversals off the lows are clearly at higher volatility than most other days, and follow very sharp, accelerating price drops. The reversal day that ends the intermediate high during August does not share these attributes; however, it tops a pattern that is not the dominant trend, but an upwards reaction within a previous sustained downtrend. If we focus on the characteristics of those reversal days that mark price extremes, rather than all reversal days, we should expect successful results. 15
Eric Evans, “Why You Can’t Rely on ‘Key Reversal Days,’ ” Futures (March 1985).
Charting
111
Programming Key Reversal Days A key reversal day can be recognized and tested using a computer program. In TradeStation’s EasyLanguage the instructions for downward key reversal are KeyReversalDown = 0; if close[1] > average(close[1],n) and high >= highest(high[1],n) and low < low[1] and close < close[1] then KeyReversalDown = 1;
where the first term tests for an uptrend over n-days, the second term tests that the current day is the highest price of the same n-days, the third term verifies that a lower low has occurred, and the last term tests for a lower close. This can be done in Excel by using the max x and min functions instead of highest and lowest. A TradeStation function to identify key reversals is TSM Key Reversals and can be found on the Companion Website along with an Excel spreadsheet of the same name. Adding a volatility factor, so that the key reversal day has noticeably higher volatility than the previous days seems to select more significant patterns. In the spreadsheet, which uses heating oil from 2005 through 2011 as an example, the basic rules gave marginal gains, but a filter that took only trades where today’s true range was greater than 1.5 × average priorr 20-day true range was much better. 2-Bar Reversal Patterns Martin Pring16 has called attention to a special 2-bar reversal pattern that frequently precedes a strong directional change. This pattern consists of two days that are essentially the mirror image of one another. Consider a market in which prices have been moving steadily higher. The first day of the pattern shows a volatile upwards move with prices opening near the lows and closing near the highs. On the following day, prices open where they had closed, trade slightly higher (nearly matching the previous day’s highs), then fall sharply to close near the lows, giving back all of the previous day’s move. Following the 2-bar reversal to the downside, the next few days should not trade above the midpoint of the 2-bar reversal pattern. The smaller the retracement, the more likely there will be a good sell-off. It is easy to explain the psychology of this pattern. The first bar represents the strong bullish feeling of the buyers, while the second bar is seen as complete discouragement at the inability to follow through to even higher levels. It will take some days before traders are willing to test the highs again. More traders may view this as a potential major reversal. High volume can confirm the reversal. The nature of the move to follow depends on the extent of the previous trend and the volatility. Four key factors in predicting a strong reversal are: 1. Stronger preceding trends 2. Wider, more volatile 2-bar patterns 3. Greater volume than in previous days 4. Smaller retracements following the 2-bar pattern 16
Martin Pring, “Twice as Nice: The Two-Bar Reversal Pattern,” Active Traderr (March 2003).
112
TRADING SYSTEMS AND METHODS
Wide-Ranging Days, Inside Days, and Outside Days A wide-ranging day is a day of much higher volatility than recent days, but no requirement that it is higher or lower than other days. An outside day must have both a higher high and lower low than the previous day. Inside days are an example off volatility compression. All three patterns are very common but indicate that something special has happened. Examples of these patterns are shown in Figure 3.17, a one-year, active trading period for Tyco ending in July 2000, before any accounting scandal surfaced. Wide-Ranging Days A wide-ranging day is likely to be the result of a price shock, unexpected news, or a breakout in which many orders trigger one another, causing a large increase in volatility. A wide-ranging day could turn out to be a spike or an island reversal. Because very high volatility cannot be sustained, we can expect that a wide-ranging day will be followed by a reversal, or at least a pause. When a wide-ranging day occurs, the direction of the close (if the close is near the high or low) is a strong indication of the continued direction. A wide-ranging day is easily seen on a chart because it has at least twice, or three times the volatility of the previous trading days. There is no requirement that it makes a new high or low relative to a recent move, or that it closes higher or lower. It is simply a very volatile day. Outside Days An outside day often precedes a reversal. An outside day can also be a wide-ranging day if the volatility is high, but when volatility is low and the size of the bar is slightly longer than the previous bar, it is a weak signal. As with so many other chart patterns, if one
FIGURE 3.17 Wide-ranging days, outside days, and inside days for Tyco.
Charting
113
day has an unusually small trading range, followed by an outside day of normal volatility, there is very little information in the pattern. Selection is important. Inside Days An inside day is one where the high is lower than the previous high and the low is higher than the previous low. That is, an inside day is one where both the highs and lows are inside the previous day’s trading range. An inside day represents consolidation and lower volatility. In turn, lower volatility is most often associated with the end of a price move. After a burst of activity and a surge of upward direction, prices have reached a point where the buyers are already in and the price has moved too far to attract more buyers. Volume drops, volatility drops, and we get an inside day. An inside day is often followed by a change of direction, but that is not guaranteed. We only know that the event that drove prices up is now over. If more news surfaces to ignite prices, the next move could just as easily be up as down In Figure 3.17 there are two inside days at the price peak on the top left of the Tyco chart. The first inside day is followed by a small move lower, then a small move higher, followed by another inside day. This last inside day precedes a major sell-off. On the right top of the chart there are two inside days immediately before another sharp drop. Some analysts believe that a breakout from low volatility is more reliable than one following high volatility. For those readers interested in these patterns, a quantitative study of wide-ranging, inside days, and outside days can be found in Chapter 4. Some Notes about 1-Day Patterns One-day patterns are very common; therefore, traders tend to be selective about when they are used. Taken as a group, patterns that are repeated frequently are less reliable and need to be combined with other patterns. Those that occur during periods of high or low volatility or volume may also be less dependable. While a reversal day is clearly a 1-day formation and can be identified at the end of the trading day, and an opening gap is recognized instantly, most other 1-day patterns are not clear until the day after. An upwards spike and a downwards pivot point reversal both require the high of the next day to be much lower than the high of the spike or pivot day; and the island reversal must show a gap on the following day. Although they cannot be used at the end of the day on which they occur, these formations are reasonably timely for an active trader.
CONTINUATION PATTERNS Continuation patterns occur during a trend and help to explain the stage of development of that trend. A continuation pattern that occurs within a long-term trend is expected to be resolved by continuing in the direction of the trend. If prices fail to move in the direction of the trend following a major continuation pattern, then the trend is considered over. The primary continuation patterns are triangles, flags, pennants, and wedges. The larger formations of these patterns are more important than the smaller ones.
114
TRADING SYSTEMS AND METHODS
Symmetric, Descending, and Ascending Triangles Triangles tend to be larger formations that occur throughout a trend. A symmetric triangle is most likely to occur at the beginning of a trend when there is greater uncertainty about direction. A symmetric triangle is formed by a price consolidation, where uncertainty of buyers and sellers results in decreasing volatility in such a way that prices narrow to the center of the previous trading range. In Figure 3.18 the symmetric triangle is formed at about the level of the previous support. The breakout from a symmetric triangle often marks the beginning of a longer-term trend.
Formation of a Descending Triangle Even during a clear downward trend, prices will rally. Because the trend is clear, sellers are anxious to step in and sell these upwards moves, looking for the trend to continue. The top of this mid-trend rally is likely to be the last support point where prices broke out of a previous pattern. In Figure 3.18, the top of the first descending triangle comes very close to the breakout level of the symmetric triangle, and the larger descending triangle towards the lower right of the chart has its high point at the breakout of another descending triangle. The recent lows of the new trend form a temporary support level, and prices may bounce off that level while short-term traders play for small profits. This action forms a descending triangle. As more traders are convinced that prices are still heading lower, rallies off the support level are sold sooner, causing a narrower pattern, until prices
FIGURE 3.18 Symmetric and descending triangles and a developing bear market in gold futures.
Charting
115
finally break below support. The descending triangle is complete. In an upwards trend an ascending triangle would be formed. Size of the Triangles A triangle should take no less than two weeks to form; however, they can span a much longer period, occasionally up to three months. Larger formations represent periods of greater uncertainty. They may be followed by another symmetric triangle, again indicating that traders are undecided about direction. If the symmetric triangle is resolved in the current trend direction, the trend is in full force, and a large price move is expected. Triangles can be consistent indicators of investor confidence. Because they reflect human behavior, they are not always perfect in appearance and not always consistent in pattern. It takes experience to identify the formation in a timely manner.
Flags A flag is a smaller pattern than a triangle, generally less than three months for the longterm trader, and is formed by a correction in a bull market or a rally in a bear market. A flag is a congestion area that leans away from the direction of the trend and typically can be isolated by drawing parallel lines across the top and bottom of the formation. At the beginning of a trend, the flags may not lean away from the direction of the new trend as clearly as during a well-established trend. If the first flag after an upwards breakout leans down, it confirms the new upwards trend. Figure 3.19 shows an assortment of triangles, flags, and pennants. There are two small flags, one in the middle of the chart and one in the lower right, each leaning upwards as expected in a downtrend. A larger flag slightly below center could also have been a symmetric triangle. Both patterns are resolved by a continuation of the trend.
Pennants Pennants are irregular triangles normally leaning toward the trend, similar to a descending triangle in a downtrend but without a horizontal support line. A typical pennant can be seen in the middle of Figure 3.19. During a sustained trend, triangles are large, clear formations, with horizontal support or resistance lines, while pennants are consolidation formations requiring only that the lines converge. They usually lean in the direction of the trend, but that is not a requirement. A larger pennant should lean in the direction of the trend in a manner similar to a descending triangle; however, a small pennant may serve the same purpose as a flag and lean away from the trend.
Wedges A pattern that looks as if it is a large pennant, with both sides angling in the same direction, but does not come to a point, is a wedge. In an upwards-trending market, the wedge should be rising as shown on the right side of the General Electric chart, Figure 3.20, near
116
TRADING SYSTEMS AND METHODS
Symmetric triangle inside a descending triangle
Flag Pennan nt
Symmetric triangle or a flag?
Flag Triangle or pennant?
FIGURE 3.19 An assortment of continuation patterns. These patterns are all resolved by prices moving lower. A downward pennant can be found in the middle of the chart.
g we
Risin
dge
Rising wedge Pennant
FIGURE 3.20 Wedge. A weaker wedge formation is followed by a strong rising wedge near the end of 1999 in this chart of General Electric.
Charting
117
the end of 1999. The earlier wedge has nearly a horizontal upper line, bridging the pattern between a wedge and a rising triangle. A rising wedge is formed in the same way as an ascending triangle. Investors, convinced that the share price will rise, will buy smaller and smaller reversals even as prices make new highs. In the end, prices continue in the direction of the trend. In a typical rising wedge the lower line has a steeper angle than the upper line. The angle of the wedge should be steeper as the trend becomes clear. The earlier wedge formation shown in Figure 3.20 is nearly symmetric. If we study the bigger picture, we can see that the uncertainty at the beginning of the trend is reflected in the symmetric formation, while the rising wedge occurs after the trend is well established and investors anticipate a continuation. Run Days Triangles, flags, pennants, and wedges represent the best of the continuation patterns. They can be identified clearly while they are still being formed and the direction of the breakout can be anticipated and traded. Other formations, such as run days, are not as timely. A run day occurs when the low of that day is higher than the previous n days, and the high of the day is lower than the subsequent n highs. When it occurs, this pattern confirms that a trend is in effect. The more days used to define the run day, the stronger the pattern. Therefore, a 5-day run day requires 11 days to identify, 5 before the run day and 5 after. Unlike the other continuation patterns, which have a breakout level that can be used as a trading signal, entering a long position after 11 days of a strong upwards move is not likely to be a good entry point. There are no trading rules or trading action associated with run days. They simply confirm what you have already seen on charts—that prices have been trending.
BASIC CONCEPTS IN CHART TRADING Having covered the fundamental chart patterns, there are some additional concepts that should be discussed in order to keep the proper perspective. Charting involves a great deal of subjective pattern identification; therefore, there may be a choice of patterns within the same time interval. There are also many cases where prices nearly form a pattern, but the shape does not fit perfectly into the classic definition.
Major and Minor Formations In the study of charting, the same patterns will appear in short- as well as long-term charts. An upwards trendline can be drawn across the bottom of a price move that only began last week, or it can identify a sustained 3-year trend in the financial markets, or a 6-month move in Amazon.com. In general, formations that occur over longer time intervals are more significant. All-time highs and lows, well-defined trading ranges, trendlines
118
TRADING SYSTEMS AND METHODS
based on weekly charts, and head-and-shoulder formations are carefully watched by traders. Obscure patterns and new formations are not of interest to most chartists, and cannot be resolved consistently unless traders buy and sell at the right points. Charting is most successful when formations are easy to see; therefore, the most obvious buy and sell points are likely to attract a large number of orders.
Market Noise All markets have a normal level of noise. The stock index markets have the greatest amount of irregular movement due their extensive participation, the high level of anticipation built into the prices, the uncertain way in which economic reports and news will impact prices, and because it is an index. This is contrasted to short-term interest rates, such as Eurodollars, which have large participation but little anticipation because it has strong ties to the underlying cash market, governed by the central bank. The normal level of noise can be seen in the consistency of the daily or weekly trading range on a chart of the Dow or S&P. When volatility declines below the normal level of noise, the market is experiencing short-term inactivity. An increase in volatility back to normal levels of noise should not be confused with a breakout. This same situation can be applied to a triangular formation, which has traditionally been interpreted as a consolidation, or a pause, within a trend. This pattern often follows a fast price change and represents a short period of declining volatility. If volatility declines in a consistent fashion, it appears as a triangle; however, if the point of the triangle is smaller than the normal level of market noise, then a breakout from this point is likely to restore price movement to a range typical of noise, resulting in a flag or pennant formation. Both of these latter patterns have uniform height that can include a normal level of noise, but they would not be reliable signals.
ACCUMULATION AND DISTRIBUTION—BOTTOMS AND TOPS Most of the effort in charting, and the largest payout in trading, goes into the identification of tops and bottoms. For long-term traders, those trying to take advantage of major bull and bear markets, these formations can unfold over fairly long periods. These prolonged phases, which represent the cyclic movement in the economy, are called accumulation when prices are low and investors slowly buy into their position, and distribution at the top, where the invested positions are sold off. The same formations can occur over shorter periods and are very popular among all traders; however, they are not as reliable. There are many top and bottom formations that are popular and easily recognized. In order of increasing complexity, they are the V-top V or V V-bottom, the double or triple top or bottom, the common rounded top or bottom, the broadening top or bottom, the head-and-shoulders formation, and the complex top or bottom.
119
Charting
V-Tops and V-Bottoms The V-top (actually an inverted “V”), which may also have a spike on the final day, is the easiest pattern to see afterwards, but the most difficult top formation to anticipate and trade. There have been times, such as in 1974, 1980, and 2000, when the frequency of V-tops were deceiving. V V V-tops are preceded by critical shortage and demand, and magnified by constant news coverage. In 1974, it was a combination of domestic crop shortage, severe pressure on the U.S. dollar abroad, and foreign purchases of U.S. grain that combined to draw public attention to a potential shortage in wheat. The news was so well publicized that novice commodity traders withdrew their funds from their declining stock portfolios and bought any commodity available as a hedge against inflation. It could not continue for long. When the top came in soybeans, silver, and most other commodities, there was no trading for days in locked-limit markets; paper profits dwindled faster than they were made, and the latecomers found their investments unrecoverable. The public often seems to enter at the wrong time. The most dramatic of all price moves was the technology bubble of the 1990s, ending with a peak in the NASDAQ index during March 2000. As you can see in Figure 3.21, prices rose faster near the end of the bull market, then collapsed just as quickly. It would have been reasonable to expect the move up to end any time after prices penetrated through 3,000, and difficult to expect them to reach 5,000. Recently, there have been runs in many commodities, but cotton stands out as exceptional. Flooding in both Pakistan and Egypt has greatly reduced the supply causing prices to soar. Figure 3.22 shows prices in February 2011 at levels four times the normal price and a top has not yet formed. Normally, supply shortages in agricultural markets correct
FIGURE 3.21 A V-top in the NASDAQ index, March 2000.
120
TRADING SYSTEMS AND METHODS
Cotton (cents/pound)
250 200 150 100 50
12/31/2007 2/29/2008 4/30/2008 6/30/2008 8/31/2008 10/31/2008 12/31/2008 2/28/2009 4/30/2009 6/30/2009 8/31/2009 10/31/2009 12/31/2009 2/28/2010 4/30/2010 6/30/2010 8/31/2010 10/31/2010 12/31/2010 2/28/2011 4/30/2011 6/30/2011 8/31/2011 10/31/2011
FIGURE 3.22 Cash cotton prices showing V-top in early 2011.
by the next season, but the current run has been so extensive that it may take more time to resolve. Inevitably, it will be solved in the same way, over one or two crop years. The psychology of the runaway market is fascinating. In some ways, everyy V-top shares a similarity with the examples in Mackay’s Extraordinary Popular Delusions and the Madness of Crowds. When beef is in short supply, the result of higher feed costs, the consumers do not tend to consider pork, fowl, or fish as an adequate substitute and will accept increased costs longer than expected. This is called inelastic demand. As prices near the top, the following changes occur: • • • •
The cost becomes an increasing factor in the standard household budget. Rising prices receive more publicity. Movements for public beef boycotts begin. Grain prices decline due to the new harvest.
This becomes a matter explained by the Theory of Elasticity. It can be applied to the 1973 soybean, 1980 silver, and the recent cotton markets. The theory is based on the principle that when prices get high enough, four phenomena occur: 1. Previously higher-priced substitutes become practical (synthetics for cotton, re-
claimed silver). 2. Competition becomes more feasible (corn sweetener as a sugar substitute, alternate
energy). 3. Inactive operations start up (Southwest gold mines, marginal production of oil). 4. Consumers avoid the products (beef, bacon, silver, cotton).
Consequently, the demand suddenly disappears (the same conclusion arrived at by economists).
121
Charting
Announcements of additional production, more acreage, new products, boycotts, and a cancellation of orders all coming at once cause highly inflated prices to reverse sharply. These factors form a V-top that is impossible to anticipate with reasonable risk. There is a natural reluctance to cash in on profits while they are still increasing every day. The situation becomes even more perilous at the end of the move when more investors join the party. These latecomers who entered their most recent positions near the top will show a loss immediately and will need to get out of the trade first; they cannot afford a continued adverse move. Once a reversal day is recognized, there is a mad rush to liquidate. The large number of investors and speculators trying to exit at the same time causes the sharpness in the V V-top and extends the drop in prices. There is a liquidity void at many points during the decline where there are no buyers and a long line of sellers. A V-top or V V-bottom is always accompanied by high volatility and usually high volume. When the V V-top is particularly extreme, it is commonly called a blow-off. A true V V-top or V-bottom will become an important medium- or long-term high or low for that market. V Two V-Tops in Amazon.com There is a classic V V-top in Amazon.com during January 1999, shown in Figure 3.23, and another potential, smaller formation in April. This second one looked as though it was a V-top for two days, then quickly disappeared into a broader formation of no particular patV tern. A V V-top cannot be recognized after only a 1-day downturn. The final peak seen in Amazon in late April 1999 is broader than a classic V V-top but could still be labeled the same.
Potential V V-top
Classic V-top V Spike
V-Botttom V
FIGURE 3.23 Classic V-top in Amazon, January 1999, and two other tops.
122
TRADING SYSTEMS AND METHODS
When trading, you would expect rising prices to fail when they approach the level of a previous clear V V-top, which forms significant resistance. In Figure 3.23, where prices began the second V V-top, declined for two days, rallied for the next three days, then dropped sharply for two days, we would normally expect a further decline. In this case, prices made another attempt to break the highs, succeeded, then collapsed. After the last peak, it will be necessary to wait until the price falls below the support level at $75 in order to confirm the downward break, having been fooled on the previous move. V-Bottoms V-bottoms are much less common than their upside counterparts. They occur more often in commodity markets where supply and demand can change dramatically and leverage causes surges of buying and selling. Both V V-tops and V-bottoms V should be read as a sign that prices have gone too far, too fast. Both buyers and sellers need time to reevaluate the fundamentals to decide where prices should be. V-bottoms V are usually followed by a rebound and then a period of sideways movement. Two good examples can be found in the crude oil chart, Figure 3.24, and in the stock market crash of October 1987.
Double and Triple Tops and Bottoms The experienced trader is most successful when prices are testing a major support or resistance level, especially an all-time high in a stock or a contract or seasonal high or low
V V-top
V V-bottom
V V-bottom
FIGURE 3.24 Two V-bottoms in crude oil.
123
Charting
in futures. The more often those levels are tested, the clearer they become and the less likely prices will break through to a new level without additional fuel. This fuel comes in the form of higher earnings or a change in the fundamental supply and demand factors. A double top is a price peak followed, a few days or weeks later, by another peak, and stopping very close to the same level. A double bottom, more common than a double top, occurs when two price valleys show lows at nearly the same level. Because prices are more likely to settle for a while at a lower price than a high one, prices often test a previous support level causing a double bottom. Tops and bottoms occur at the same level because traders believe that the same reason that caused prices to fail to go higher the first time will be the reason they fail the second time. The exceptionally high or low prices are the result of speculation rather than fundamentals. In the same way that some stocks will trade at price/earnings ratios far above any rational assessment of business prospects in the near future, commodity prices can be pushed to extremes by crowd psychology without regard to value. Traders, looking for a place to sell an unreasonably high price, target the previous point where prices failed. Although a classic double top is thought to peak at exactly the same price, selling in anticipation of the test of the top may cause the second peak to be lower than the first. Figure 3.25 shows one type of double top in crude oil. While some double tops are two sharp peaks, this one looks as though it was gathering energy. It penetrated slightly above the previous high, but could not sustain higher prices. Double tops are rarely perfect.
Double top and rounded top
No, prices did not trade below zero. Negative values are caused by back-adjusting of the data.
FIGURE 3.25 A double top in crude oil.
124
TRADING SYSTEMS AND METHODS
Double Bottoms Bottoms are more orderly than tops. They should be quiet rather than volatile. They are caused by prices reaching a level that is low enough for the normal investor to recognize that there is little additional downside potential. Economists might call this the point of equilibrium. Neither buyers nor sellers are convinced that prices will continue to move lower. They wait for further news. Double bottoms will often test the same price level because large-position traders and commercial users of commodities accumulate more physical inventory, or increase their futures position, each time the price falls to their target level. Once prices are low, there is less chance of absolute loss. Selling a double top can be very risky. The greatest risk when buying a double bottom is that your timing is wrong. If prices do not rally soon, you have used your capital poorly. Cisco shows a double bottom in Figure 3.26, although it lacks the clear decline in volatility that we would like to see, and which accompanies commodities when they reach a price level near the cost of production. The small spikes down show four attempts to go lower, followed by a faster move up. When prices cross above the highs formed between the two bottom patterns, we have a completion, orr confirmation, of the double bottom. Traders will start to buy a double bottom when prices slow near previous low levels. They will also look for declining volume or confirmation in the stock price of another related company or a related sector ETF. Waiting for the breakout above the highs of the bottom formation is a safer signal for a conservative trader, but lost opportunity for a more active one.
Double bottom m confirmed
Double bottom
FIGURE 3.26 A double bottom in Cisco.
Charting
125
Triple Tops and Bottoms Triple tops and triple bottoms are considerably less common than double tops and bottoms; however, of the two, bottoms can be found more readily. Figure 3.27 shows a classic triple top in natural gas. A triple top can be formed from a V V-top, but in this case, the first peak is an island reversal, the second is a spike, and the third an extended top that ends the move. If we did not have the advantage of seeing the triple top afterwards, each of the individual tops would look as if it were the end of the move. After the first island reversal prices dropped $2; after the second peak there was another large gap down and a 1-day loss of more than $1. High volatility is normally associated with an extreme top. By waiting for a confirmation of a decline after the single or double top, the trade would have been entered $1.50 to $2.50 below the top, and that position would be held while prices reversed to test the highs. Selling tops is risky business. A triple bottom that can be traded is most likely to occur at low prices and low volatility, much the same as a double bottom. They show an inability to go lower because investors are willing to accumulate a position at a good value. For commodities, it is a good place for a processor to accumulate inventory. The Danger of Trading Double and Triple Tops There are many examples of double tops and a smaller number of triple tops. Ideally, there is a lot of money to be made by selling tops at the right place. However, the
FIGURE 3.27 Natural gas shows a classic triple top.
126
TRADING SYSTEMS AND METHODS
likelihood of this good fortune happening is less than it appears. Consider why a triple top is so rare. It is because prices continue higher and the potential triple top disappears into a strong bull market pattern. This happens even more often with double tops. Every time a price pulls back from new highs, then starts moving up again, there is a potential double top. In a prolonged bull market, many double tops disappear in the move higher. Selection of the double top becomes important. This is done using volume, volatility, support, and resistance, and sometimes common sense. These confirming indicators are discussed throughout this book. Until then, it is important to recognize the difficulty of deciding whether the current pattern will be a single, double, or triple top, or simply a pause in a bull market. Although we would all like to be a seller at the highs, these tops are best sold after they are confirmed, that is, after a decline proves that the top has occurred. Even then, a new high should cause a fast exit from the trade. As with other chart patterns, declining volume would be a welcome confirmation after the formation of the first top and would accompany each additional test of the top.
Extended Rectangle Bottom Many of the important chart formations can be traded using a penetration of one of the support or resistance lines as a signal. Those with the most potential profitability occur on breakouts from major top or bottom formations. The simplest of all bottom formations, as well as one that offers great opportunities, is the extended rectangle at longterm low price levels. Fortunes have been made by applying patience, some available capital, and the following plan: 1. Find a market with a long consolidating base and low volatility. In July 2002
Amazon.com reaches a low with volatility declining. In futures, crude oil remained at low prices for 13 years, as seen in Figure 3.28. The bottom can be confirmed by a decrease in the open interest. When evaluating interest rates, consider using the yield rather than the price. 2. Buy whenever there is a test of its major support level, placing a stop-loss to
liquidate all positions on a new low price. Increasing volume should confirm the buying, and with futures markets the upside breakout should be accompanied by increasing open interest. For crude oil, the resistance was between $21 and $22 because OPEC had set its OGSP (Official Government Selling Price) between $18 and $22. 3. After the initial breakout, buy again when prices pull back to the original resistance
line (now a support level). Crude rallied from the lows to just under $40 before pulling back to the old resistance level at $19. Close out all positions if prices penetrate back into the consolidation area and start again at Step 2. 4. Buy whenever there is a major price correction in the bull move. These adjustments,
or pullbacks, will become shorter and less frequent as the move develops. They will
127
Charting
Crude Oil Cash Prices 160 140 V-top
Price ($/bbl)
120 100 80 60 Resistance 40 V-bottom
20 Extended rectangular bottom
3/ 30 3/ /198 30 3 3/ /198 30 4 3/ /198 30 5 3/ /198 30 6 3/ /198 30 7 3/ /198 30 8 3/ /198 30 9 3/ /199 30 0 3/ /199 30 1 3/ /199 30 2 3/ /199 30 3 3/ /199 30 4 3/ /199 30 5 3/ /199 30 6 3/ /199 30 7 3/ /199 30 8 3/ /199 30 9 3/ /200 30 0 3/ /200 30 1 3/ /200 30 2 3/ /200 30 3 3/ /200 30 4 3/ /200 30 5 3/ /200 30 6 3/ /200 30 7 3/ /200 30 8 3/ /200 30 9 /2 01 0
FIGURE 3.28 An extended rectangular bottom in crude oil from 1986 through 1999.
usually be proportional to current volatility or the extent of the price move as measured from the original breakout. 5. Liquidate all positions at a prior major resistance point, a top formation, or the break-
ing of a major bullish support line. Building positions in this way can be done with a relatively small amount of capital and risk. The closer the price comes to major support, the shorter the distance from the stop-loss; however, fewer positions can be placed. In his book The Professional Commodity Trader, Stanley Kroll discussed “The Copper Caper—How We’re Going to Make a Million,” using a similar technique for building positions. It can be done, but it requires patience, planning, and capital. The opportunities continue to be there. This example of patiently building a large position does not usually apply to bear markets. Although there is a great deal of money to be made on the short side of the market, prices move faster and may not permit the accumulation of a large position. There can also be exceptionally high risk caused by greater volatility. The only pattern that allows for the accumulation of a large short position is the rounded top, discussed in the next section. Within consolidation areas for commodities at low levels, there are a number of factors working in your favor: the underlying demand for a product, the cost of production, government price support (for agricultural products), and low volatility itself. There is also a clear support level that may have been tested many times. A careful position trader will not enter a large short-sale position at an anticipated top when volatility is high, but instead will join the buyers who contribute to the growing volume and open interest at a well-defined major support level.
128
TRADING SYSTEMS AND METHODS
Rounded Tops and Bottoms When prices change direction over a longer time period they can create a rounded top or bottom pattern. A rounded top reflects a gradual change in market forces from buyers to sellers. In the stock market it is also called distribution. It is a clear sign that any attempt to move prices higher has been abandoned. Rounded tops often lead to faster and faster price drops as more investors liquidate their long positions or initiate shorts. In Figure 3.29 we see two classic rounded tops in the German DAX stock index. The first is an example of gathering downside momentum as more investors become aware of the decline. Prices drop faster after a break of the double bottom. The rounded top offers a rare opportunity to accumulate a short position with relatively low volatility. Rounded Bottom A rounded bottom, similar to a rounded top, is an extended formation where prices gradually turn from down to up. In Figure 3.30 we see a rounded bottom in the Japanese yen followed by a breakaway gap. Similar to the extended rectangle, the rounded bottom offers traders an opportunity to accumulate a large long position. In this case, the sharp rally as prices move through the high of the rounded bottom, followed by a runaway gap, clearly marks the end of the rounded bottom. The breakout can be interpreted as a change in the supply and demand balance. A breakout, whether in stocks or futures, indicates that something new has entered the picture.
Rounded top
Rounded top Double bottom
Classic V-bottom V
FIGURE 3.29 Two rounded tops in the German DAX stock index.
129
Charting
Rounded bottom
FIGURE 3.30 A classic rounded bottom in the Japanese yen.
Wedge Top and Bottom Patterns We have seen a wedge formation as a continuation pattern in Figure 3.20, but a large ascending wedge can mark the top of a move and a large descending wedge the bottom. The dominant characteristic of the wedge is that volatility is declining towards the end. In Figure 3.31 there is a declining wedge in the Japanese yen. Volatility compresses until a breakout is inevitable. If the breakout had been to the downside, this wedge would have been interpreted as a continuation pattern. In this example, a breakout in the opposite direction is a strong indicator of a major reversal.
Head-and-Shoulders Formation The classic top and bottom formation is the head and shoulders, accepted as a major reversal indicator. This pattern, well known to chartists, appears as a left shoulder, a head, and a right shoulder, seen in Figure 3.32. The head-and-shoulders top is developed with the following five characteristics: 1. A strong upward breakout reaching new highs on increasing volume. The pattern
appears to be the continuation of a long-term bull move. 2. A consolidation area formed with declining volume. This can look much like a de-
scending flag predicting an upwards breakout, or a descending triangle indicating a downwards breakout.
130
TRADING SYSTEMS AND METHODS
Buy signal
FIGURE 3.31 A large declining wedge followed by an upside breakout in the Japanese yen.
Left shoulder
Head Rising right shoulder
Neckline
Sell
T Target
FIGURE 3.32 Head-and-shoulders top pattern in the Japanese Nikkei index.
Charting
131
3. Another upwards breakout on continued reduced volume forms the head. This is the
key point of the formation. The new high is not confirmed by increased volume, and prices drop quickly. 4. Another descending flag or triangle is formed on further reduced volume, followed
by a minor breakout without increased volume. This last move forms the right shoulder and is the third attempt at new highs for the move. 5. The lowest points of the two flags, pennants, or triangles become the neckline of the
formation. A short sale is indicated when this neckline is broken. Trading Rules for Head and Shoulders There are three approaches to trading a head-and-shoulders top formation involving increasing degrees of anticipation: 1. Wait for a confirmation. a. Sell when the final dip of the right shoulder penetrates the neckline. This repre-
sents the completion of the head-and-shoulders formation. Place a stop-loss just above the entry if the trade is to be held only for a fast profit, or place the stop-loss above the right shoulder or above the head in order to liquidate on new strength, allowing a longer holding period. b. Sell on the first rally after the neckline is broken. (Although more conservative,
the lost opportunities may outweigh the improved entry prices.) Use the same stops as in Step la. 2. Anticipation of the final shoulder. a. Sell when the right shoulder is being formed. A likely place would be when prices
have retraced their way half the distance to the head. A stop-loss can be placed above the top of the head. b. Wait until the top of the right shoulder is formed and prices appear to be declining.
Sell and place a stop either above the high of the right shoulder or above the high of the head. Both steps 2a and 2b allow positions to be taken well in advance of the neckline penetration with logical stop-loss points. Using the high of the head for a protective stop is considered a conservative approach because it allows the integrity of the pattern to be tested before the position is exited. 3. Early anticipation of the head.
Sell when the right part of the head is forming, on the downwards price move, with a stop-loss at about the high of the move. Although this represents a small risk, it has less chance of success. This approach is for traders who prefer to anticipate tops and are willing to suffer frequent small losses to do it. Even if the current prices become the head of the formation, there may be numerous small corrections that will look like the market top to an anxious seller.
132
TRADING SYSTEMS AND METHODS
Volume was a recognized part of the classic definition of the head-and-shoulders formation and appeared in Robert D. Edwards and John Magee’s Technical Analysis of Stock Trends, published in 1948. This is no longer considered as important. There are many examples of successful head-and-shoulders formations that do not satisfy the volume criterion. Nevertheless, declining volume on the head or the right shoulder of a top formation must be seen as a strong confirmation of a failing upwards move, and is consistent with the normal interpretation of volume.
EPISODIC PATTERNS There is little argument that all prices change quickly in response to unexpected news. The transition from one major level to another is termed an episodic pattern; when these transitions are violent, they are called price shocks. Until the late 1990s, there were very few price shocks in the stock market, the greatest being the one resulting from the terrorist attacks of September 11, 2001. Otherwise, price shocks can be caused by a surprising election result, the unexpected raising of interest rates by the Federal Reserve, the devaluation of a currency by an important Third World nation, sudden crop loss or natural disaster, or an assassination (or what we now call a geopolitical event). While price shocks are most common in futures markets, all markets are continually adjusting to new price levels, and all experience occasional surprises. Each news article, government economic release, or earnings report can be considered a mini-shock. A common price shock occurs when a pharmaceutical company’s application for a new drug is unexpectedly rejected by the U.S. Department of Agriculture (USDA). The pattern that results from episodic movement is exactly what one might expect. Following the sharp price movement, there is a period when volatility declines from its highs, narrowing until a normal volatility level is found and remaining at that level. In the Raytheon reaction to 9/11, the upwards price shock, shown in Figure 3.33 is followed by a volatile, unstable few days and then a steady decline in volatility as some level of equilibrium is found. The Raytheon price reacted opposite to most other stocks because it is a defense contractor, and a terrorist attack implies an increased amount of business from the government. Unless the news that caused the price shock was an error, in which case prices immediately move back to levels prior to the news, prices will settle in a new trading range near the extreme highs or lows. It will take time for the market to absorb the consequences of the news, and many traders will find the risk too high to participate. Price shocks have become the focus of much analytic work. Because a price shock is an unpredictable event, it cannot be forecast. This has a critical effect on the way in which systems are developed, especially with regard to the testing procedures. We understand at the time of the price shock that the event was entirely unexpected. However, years later, when the same prices are analyzed using a computer program, you might find that a trend or charting pattern predicted this move. The analysis records the profits as
133
Charting
Shock Bounce
Sell off Settle
FIGURE 3.33 Episodic pattern shown in an upward price shock in Raytheon following 9/11/2001.
though they were predictable and you are now basing your conclusions on a false premise. These important issues are covered in other parts of this book under the topics “Price Shocks,” “Searching for Robustness,” and “Optimization,” found in Chapters 21 and 22.
PRICE OBJECTIVES FOR BAR CHARTING Most traders set price objectives and use them to assess the risk and reward of a potential trade. Objectives are most reasonable for short-term trading and successful objectives are based on straightforward concepts and not complex calculations. There is also a noticeable similarity between the price objectives for different chart patterns. The simplest and most logical price objective is a major support or resistance level established by previous trading. When entering a long position, look at the most welldefined resistance levels above the entry point. These have been discussed in previous sections of this chapter. When those prior levels are tested, there is generally a technical adjustment or a reversal. The more well-established the support or resistance level, the more likely prices will stop. In the case of a strong upwards move, volatility often causes a small penetration before the setback occurs. A penetration of support or resistance, followed by a return to the previous trading range is considered a confirmation of the old range and a false breakout. Placing the price objective for a long position below the identifiable major resistance level will always be safe. The downside objective can be identified in a similar manner: Find the major support level and exit just above it. When trading with chart patterns, it pays to be flexible. Regardless of which method you use to identify a profit target, be prepared to take profits sooner if the market changes. For example, you have entered a long in IBM at $160 and set your profit objective at
134
TRADING SYSTEMS AND METHODS
$200. Prices move as predicted and reach $195 when volume starts to drop and the price pattern seems to move sideways. An experienced trader will say “close enough” and take the profit. Profit objectives are not perfect, only good guidelines. If you have set a single price target for a long position, and it falls slightly above a resistance level, then the lower resistance level should be used as the price objective. One practical solution that will be discussed in Chapter 22 is using multiple profit-targets. Rather than rely on a single point, traders will fan out their target points around the most likely objective, dividing their goal into three or five levels. As each profit-target is reached the risk of the current trade is reduced as is the likelihood of turning a profit into a loss. While waiting for prices to reach the objective, remember to watch for a violation of the current trend; trend changes take priority over profit objectives. If the trade is successful, and the goal is reached as expected, watch for a new pattern. If prices decline after the trade is closed out, then reverse and break through the previous highs or lows, the position may be reentered on the breakout and a new price objective calculated.
Common Elements of Profit Objectives Most chart formations have a price objective associated with them. The common ground for all of them is volatility. Each chart pattern is larger or smaller because of the current price volatility; therefore, the price targets derived from these formations are also based on volatility. In general, the price objective reflects the same volatility as the chart formation and is measured from the point where prices break out of the pattern.
Profit Targets for Consolidation Areas and Channels The most basic of all formations is the horizontal consolidation area, bounded on the top and bottom by a horizontal resistance and support lines. There are two possible profit targets, shown in Figure 3.34. 1. For any y horizontal consolidation pattern, the target is above the breakout of the
resistance line at a point equal to the height of the consolidation area (the resistance level minus the support level added to the resistance level). That makes the expected move equal to the extreme volatility of the consolidation area. 2. With extended rectangular formations, the upwards profit target is calculated as the
width of the consolidation pattern added to the support level. Although price objective (2) is a well-known and popular calculation, it is unrealistic when the extended formation is very prolonged. The standard calculation, given in (1), is more reasonable. A third objective is more conservative but even more practical: 3. Use the average volatility of the consolidation formation, or reduce the target in (1)
above by 20% to remove the extremes from influencing the objectives. A closer price target will be reached more often.
135
Charting
H
W
Resistance
H
Support W (a) Price objective Be
ari
sh
res
ist
Be ari
sh
su
an
ce
W
pp
ort
W
(b)
FIGURE 3.34 Price objectives for consolidation patterns and channels. (a) Two objectives for consolidation patterns. (b) Price objective for a channel.
The price objective for a channel is the same as the traditional objective for a horizontal consolidation pattern. Because the channel is at an angle, it is necessary to measure the width of the channel as perpendicular to the angled support and resistance channel lines; then project that width upwards from the point of breakout. The length of the channel does not change the profit target. Again, you may want to make the target slightly smaller than the original channel. Changing Price Objectives Using Channels Price objectives can be found as trends change and new channels are formed. Figure 3.35 shows the change from an upwards to a downwards trend. Once a breakout of an upwards channel has occurred (marked “First point of reversal”), we wait until the low is reached
136
TRADING SYSTEMS AND METHODS
FIGURE 3.35 Forming new channels to determine objectives.
at a, followed by the reaction back up to b. A resistance line, 1R, can be drawn from the prior high h to the top of the latest move b. A line, 1S, can be constructed parallel to 1R passing through point a, forming the initial downward channel. Price objective 1 is on line 1S S of the new channel and is used once the top at point b is determined. Price objective 1 cannot be expected to be too precise due to the early development of the channel. If prices continue to point c and then rally to d, a more reasonable channel can now be defined using trendlines 2R 2 and 2S. The support line will again become the point where the new price objective is placed. The upper and lower trendlines can be further refined as the new high and low reactions occur. The primary trendline is always drawn first; then the new price objective becomes a point on the parallel trendline.
Targeting Profits after Tops and Bottoms Because profit targets are based on the volatility of the underlying pattern, the profit targets for all top and bottom formations will seem very much the same. Looking back at Figure 3.27, natural gas, there is a triple top formation. Between each top is a reversal marking an important support level. The first pullback after the island reversal brought prices to 8.20, followed by a test of the top that formed the second peak. The second retracement stopped at 9.00 and was followed by the third peak. When prices finally drop through the highest support level at 9.00, we can treat it as a breakout and sell short. If this chart showed a double top, then the point where prices fall below the support between two tops confirms the top. Breaking this support level indicates that the topping formation is completed. But this was not a double top; therefore, we can take the lower of the two support levels between the three tops as the major confirmation of the pattern. In the natural gas chart, the lower support was at 8.20. Using either support level gives a measurement of the triple top pattern based on the volatility of prices. Calculating the Profit Target for a Top Formation The profit target is found by measuring the height of the top formation and projecting it downwards from the point where the top is confirmed, that is, the break of the support
Charting
137
level. For this example, profit targets will be calculated based on each of the support levels. The highest price of the move is 10.75. Let’s examine two profit targets: 1. Using the support level of 9.00, the height of the top is 10.75 – 9.00, or 1.75. Project-
ing that downwards from the breakout point of 9.00 gives a profit objective of 7.25. The first major pause in the price drop stopped at about 7.00, still showing high volatility. 2. Based on the second support level of 8.20, the height of the top is 2.65, and the profit
objective, measured from the break at 8.20, is 5.55. Prices reach 5.55, but only after stalling at about 6.50. The first target is very achievable and realistic. Prices are very volatile, and a drop of 1.75 could occur very quickly. The second target is less realistic. When targeting a much larger decline, and beginning at a much lower point, it is unrealistic to expect volatility to continue at the same high level. In the decline of natural gas from January through March, volatility also declines, so that by March it appears as though the move is over. Although price targets can often be correct, those that are far away will be less reliable. Profit Targets after a Bottom Formation The same principle can be applied to calculate the profit target for bottom formations. The distance from the lowest price of the bottom to the confirmation point is projected upwards from the breakout. This method can be applied to any type of bottom formation. In Figure 3.26, the double bottom in Cisco spanned the price range from about 5.00 to 6.25. The volatility of the bottom pattern, 1.25, is projected upwards from the breakout at 6.25 to get the target of 7.50. Because volatility should expand as prices rise, the exact volatility calculation can be used as a conservative measure. The Head-and-Shoulders Price Objective In keeping with other price targets, the head-and-shoulders top has a downside objective, which is also based on its volatility. This objective is measured from the point where the right shoulder penetrates the neckline and is equal to the distance from the top of the head to the neckline (Figure 3.36). For a major top, this goal seems modest, but it will be a good measure of the initial reaction and is generally safe, even if a new high price is reached later. A very similar example can be found in the Japanese yen (Figure 3.30). The neckline also angles up and to the right, and the price target finds the bottom of the first major support level following the break of the right shoulder. The position of the price objective is so significant that the subsequent drop in prices creates a breakaway gap. Triangles and Flags Triangles and flags have objectives based on volatility in a manner consistent with other patterns. The triangle objective is equal in size to the initial reaction, which formed the largest end of the triangle (Figure 3.37a). It may also be viewed as a developing channel
138
TRADING SYSTEMS AND METHODS
FIGURE 3.36 Head-and-shoulders top price objective.
rather than a triangle, with the ascending leg of the triangle forming the primary bullish trendline. The price objective then becomes the same as those used for channels. The flag is assumed to occur midway in a price move; therefore, the objective of a new breakout must be equal to the size of the move preceding the flag (Figure 3.37b). Recalling the comments on the problems associated with the decreasing volatility of the triangular formation, the use of the first reaction as a measure of volatility is a safe way to avoid problems. Using this technique with subsequent flags in a bull move will cause objectives to move farther away, becoming unrealistic. The Rule of Seven Another measurement of price objectives, the Rule of Seven, is credited to Arthur Sklarew.17 It is based on the volatility of the prior consolidation formation and computes three successive price objectives in proportion to one another. The Rule of Seven is not symmetric for both uptrends and downtrends. Sklarew believes that, after the initial leg of a move, the downtrend reactions are closer together than the reactions in a rising market. Because the downside of a major bear market is limited, it is usually characterized by consolidation. Major bull markets tend to expand as they develop.
17
Arthur Sklarew, Techniques of a Professional Chart Analyst (Commodity Research Bureau, 1980).
139
Charting
Objective
Objective line
(a)
(b)
FIGURE 3.37 Triangle and flag objectives. (a) Triangle objective is based on the width of the initial sides. (b) Flag objective is equal to the move prior to the flag formation.
To calculate the objectives using the Rule of Seven, first measure the length L of the initial leg of a price move (from the previous high or low, the most extreme point before the first pullback). The objectives are: 1. In an uptrend:
Upwards objective 1 = prior low + (L ( × 7/4) Upwards objective 2 = prior low + (L ( × 7/3) Upwards objective 3 = prior low + (L ( × 7/2) 2. In a downtrend:
Downwards objective 1 = prior high − (L ( × 7/5) Downwards objective 2 = prior high − (L ( × 7/4) Downwards objective 3 = prior high − (L ( × 7/3) The three objectives apply most clearly to major moves. During minor price swings, it is likely that the first two objectives will be bypassed. In Sklarew’s experience, regardless of whether any one objective is missed, the others still remain intact.
IMPLIED STRATEGIES IN CANDLESTICK CHARTS For a technique that is reported to have been used as early as the mid-1600s, Japanese candle charts were slow to find their way into the western method of analysis. Candle charts can be related to bar charts but offer additional visual interpretation. The candles
140
TRADING SYSTEMS AND METHODS
are created simply byy shading the piece of the bar between the opening and closing prices: white if the close is higher than the open and black if the close is lower than the open. The shaded area is called the body and the extended lines above and below the body are the shadows. With this simple change, we get an entirely new way of looking at and interpreting charts. The patterns become much clearer than the Western style of line chart. Although many candlestick patterns have equivalent bar chart formations, there is an implied strategy in many of them. The following summary uses the traditional candlestick names representing the significance of the formation (see Figure 3.38):
DOJI High
High
Open and Close
Low
Low, Open, and Cl Close
FIGURE 3.38 Popular candle formations.
Charting
141
• Doji, in which the opening and closing prices are the same. This represents indecision, a temporary balancing point. It is neither bullish nor bearish. A double doji, where two dojis occur successively, implies that a significant breakout will follow. • Engulfing patterns seem at first to be the same as outside days in bar charting, but the pattern only refers to the part of the bar between the opening and closing prices. Engulfing patterns are considered exceptionally strong signals of price change. A bullish engulfing pattern has a black candle followed by a white, indicating a wide range with a higher close. The bearish engulfing pattern is white followed by black, showing a lower close on the engulfing day. • Morning starr and evening starr are 3-day patterns that show a similarity to an island reversal, but are more specific. In the morning star, a bullish reversal pattern, the first day has a lower close than the open, the second day (called the star, similar to the island bottom) has a higher close, and the final reversal day has an even higher close. The bearish reversal is just the opposite, with two higher closes followed by a reversal day with a lower close. If the star is also a doji, then the pattern has more significance. • Piercing line and dark cloud coverr are bullish and bearish reversals. The piercing line, a bullish reversal, begins with a black candle (a lower close) and is followed by a white candle in which the open is below the previous day’s low and the close is above the midpoint of the previous day’s body (the open-close range). The dark cloud cover is a bearish formation, the opposite of the piercing line. • Hammer, a bullish reversal signal, showing the bottom of a swing, where the body is at the top of the candle, indicating an upwards change of direction, and the shadow is below the body. The body may be black or white. • Hanging man, a bearish reversal pattern where the body of the candle represents the high of a swing, and the shadow lies below in the direction of the reversal. The body may be black or white. • Shooting star, a bearish signal, also occurs at the top of a swing and has its body at the bottom of the candle with the shadow above. The body may be black or white. Although these patterns are similar to Western bar chart formations, none of them are exactly the same. The hammer, hanging man, and shooting star are reversal patterns but can only be compared to the simple pivot point where the middle day is higher or lower than the bars on either side. None of these candle formations is exactly the same as a key reversal day or island reversal. The engulfing pattern is stronger than the typical outside day because the spanning of the prior day’s range must be done only by the current day’s open-close range. The analysis of candle charts is a skill involving the understanding of many complex and interrelated patterns. For full coverage, Steve Nison’s, Japanese Candlestick Charting Techniques, second edition, is recommended, as well as a selection of newer books, which can be found on Amazon.
142
TRADING SYSTEMS AND METHODS
Quantifying Candle Formations The preciseness of the candle formations allow some patterns to be tested. The popular engulfing patterns can be defined exactly for a computer program as Bullish engulfing pattern = Previous open > previous close and today’s open < previous close and today’s close > previous open Bearish engulfing pattern = Previous close > previous open and today’s open > previous close and today’s close < previous open Another technique uses the shadows as confirmation of direction. We can interpret an increase in the size of the upper shadows as strengthening resistance (prices are closing lower each day); an increase in the size of the lower shadows represents more support. One way to look at this is by defining Upper shadow (white) = high − close
Lower shadow (white) = open − low
Upper shadow (black) = high − open
Lower shadow (black) = close − low
The sequences of upper and lower shadows can be smoothed separately using a moving average to find out whether they are rising or falling.18 A method for determining whether black or white candles dominate recent price movement is to use only the body of the candle, B = close − open, and apply a momentum calculation: Bup Body momentum = Bup + Bdown where
Bup = the sum of the days where B > 0 (body is white) Bdown = the sum of the days where B < 0 (body is black) 14 = the recommended number of days
When the body momentum is greater than 70, the whites dominate; when the value is below 20 the blacks dominate. These thresholds indicate a built-in upwards bias. Morning Star and Evening Star Two formations that are easily programmed are the morning starr (a bullish signal) and evening starr (a bearish signal). Using the morning star as an example, the rules call for a long downward (black) candle followed by a lower (the open of the next bar less than the close of the previous long bar), less volatile white candle, and finally an upward thrust shown as a gap up body with the close higher than the open (another white candle). 18
Both “shadow trends” and “body momentum” are adapted from Tushar Chande and Stanley Kroll, The New Technical Trader (New York: John Wiley & Sons, 1994).
143
Charting
When programmed (see TSM Morning Starr and TSM Evening Starr in the Companion Website), there are very few signals when we put restriction on the size of the bodies of the three days. Instead, we only required that the body of the first day be greater than the 20-day average, the second day less, and the third day greater. While there are still only a modest number of trades, the S&P performs well on the day following both patterns.
Qstick As a way of quantifying the Candle formations, Tuschar Chande19 created Qstick, a moving average of the body of the candle. It is intended to be an aid interpreting the charts but has simple trading rules as well. Iff Bodyt = Closet – Opent and Qt = average(period1,body), where period1 is suggested as 8 days AvgQt = average(period2,Q), where period2 is also 8 days Then the trading rules are Buy when Qt moves above AvgQt Sell when Qt moves below AvgQt
Pivot Points and Candle Charts John L. Person suggests that the strategies inherent in candle formations can be combined with support and resistance levels derived from pivot points.20 He uses the following calculations: 1. Pivot point, P = (high + low + close)/3 2. First resistance level, R1 = (P ( × 2) − low 3. Second resistance level, R2 = P + high − low 4. First support level, S1 = (P + 2) − high 5. Second support level, S2 S = P − high + low
Once a key formation for a top or bottom is recognized using candle charts, support and resistance levels calculated based on pivot points can be a strong indication of the extent of the following price move. Person used Dow futures to support his study. 19 Tushar
Chande and Stanley Kroll, The New Technical Traderr (New York: John Wiley & Sons, 1994). 20 John L. Person, “Pivot Points and Candles,” Futures (February 2003).
144
TRADING SYSTEMS AND METHODS
The Best of the Candles Bulkowski has summarized his own research in the success of various candles21 as • The best-performing candles had closing prices within 1 3 of the bar low, followed by the middle and high, respectively. • Candle patterns in a bear market outperform other markets, regardless of the breakout direction. • Most candles perform best on days with higher volume. • Candles with unusually long wicks outperform. • Unusually tall candles outperform.
PRACTICAL USE OF THE BAR CHART Trends Are Easier to See in Retrospect As important as it is to identify the direction of price movement, it is much easier to see the trend afterward than at the moment it is needed. There is no doubt that all stocks and futures markets have short-term swings and longer-term bull and bear markets. Unfortunately, at the time you are ready to trade, it is not going to be clear whether the current price trend is a short-term pattern that is about to change or long-term persistent trend experiencing a temporary reversal. The ease of seeing charts on a screen has made the past patterns clear. It seems natural to expect prices to trend in the future as clearly as they appear on a chart; however, it is not easy to do it in a timely fashion. The eye has a remarkable way of simplifying the chart patterns. The purpose of drawing a trendline is to recognize the direction even though prices can swing violently up and down during that trending interval. A new trend signal to buy or sell always occurs as the trend is changing; therefore, it is at the point of greatest uncertainty. Success in systematic trading, whether using charts or mathematics, relies on consistency. In the long run, it comes down to probabilities. Success can be achieved by recognizing the trend in 60% of the cases. In a typical trend-following system, because individual profits are much larger than losses, it is only necessary to be correct 30% or 35% of the time.
Long-Term Trends Are More Reliable than Short-Term Trends Charting is not precise, and the construction of the trendlines, other geometric formations, and their interpretation can be performed with some liberties. When using the simplest trendline analysis, it often happens that there is a small penetration of the channel 21
Thomas Bulkowski, “What You Don’t Know About Candlesticks,” Technical Analysis of Stocks & Commodities (March 2011).
Charting
145
or trendline followed by a movement back into the channel. Some think that this inaccuracy with respect to the rules makes charting useless; however, many experienced analysts interpret this action as confirmation of the trend. The trendline is not redrawn so that the penetration becomes the new high or low of the trend; it is left in its original position. We must always step back and look for the underlying purpose in each method of analysis, whether interpretive or fully systematic. The trendline is an attempt to identify the direction of prices over some time period. Chartists can use a simple straight line to visualize the direction; they draw the uptrend by connecting the lowest prices in a rising market, even though each point used may represent varying levels of volatility and unique conditions. The chance of these points aligning perfectly, or forecasting the exact price support level, is small. A trendline is simply a guide; it may be too conservative at one time and too aggressive at another; and you won’t know until after the trade is completed. Applied rigorously, charting rules should produce many incorrect signals but be profitable in the most important cases. The challenge of the chartist is to interpret the pattern of prices in context with the bigger picture. Many price moves are called trends, but the most important and sustained trends are those resulting from government policy, in particular those that affect interest rates. Therefore, the most reliable trends are long-term phenomena because government policy develops slowly and is often long-term. During a period of recession, as we saw in 2001 and 2002, the Federal Reserve continued to lower interest rates incrementally, causing a major bull market in all fixed-income maturities. It is easiest to see this trend by looking at a weekly chart of the 10-year Treasury note, rather than an intraday, 1-hour chart. The more detail there is, the more difficult it is to see the long-term trend. Following the subprime collapse of 2008, the Fed and other central banks decided to lower rates to the absolute minimum and keep them there as long as necessary to stimulate the economy. Ultimately, this will result in a protracted bull market in both stocks and commodities. The average daily impact of the long-term trend on prices is very small. For example, if yields were to drop a staggering 2% in one year, a rise of approximately 16 full points in price, the net effect each day would be a change of .064%, or 2 32 in price. If prices move nearly one full point, 2 32 or 1%, each day, that upwards bias would be overwhelmed by the daily market noise. It would be difficult to draw a trendline on a daily price chart until prices had drifted higher for a few months. Using a weekly chart removes much of this noise and makes the trend easier to see.
Multiple Signals Some of the impreciseness of charting can be offset with confirming signals. A simultaneous breakout of a short-term trendline and a long-term trendline is a much stronger signal than either one occurring at different times. The break of a head-and-shoulders neckline that corresponds to a previous channel support line is likely to receive much attention. Whenever there are multiple signals converging at, or near, a single price, whether based on moving averages, Gann lines, cycles, or phases of the moon, that point
146
TRADING SYSTEMS AND METHODS
gains significance. In chart analysis, the occurrence of multiple signals at one point can compensate for the quality of the interpretation.
Pattern Failures The failure to adhere to a pattern is equally as important as the continuation of that pattern. Although a trader might anticipate a reversal as prices near a major support line, a break of that trendline is significant in continuing the downward move. A failure to stop at the support line should result in setting short positions and abandoning plans for higher prices. A head-and-shoulders formation that breaks the neckline, declines for a day or two, then reverses and moves above the neckline is another pattern failure. Postpattern activity must confirm the pattern. Failure to do so means that the market refused to follow through; therefore, it should be traded in the opposite direction. This is not a case of identifying the wrong pattern; instead, price action actively opposed the completion of the pattern. Wyckoff calls this “effort and results,” referring to the effort expended by the market to produce a pattern that explains the price direction. If this pattern is not followed by results that confirm the effort, the opposite position is the best option. Change of Character Thompson22 discusses the completion of a pattern or price trend by identifying a change of characterr in the movement. As a trend develops, the reactions, or pullbacks, tend to become smaller. Traders looking to enter the trend wait for reactions to place their orders; as the move becomes more obvious, these reactions get smaller, and the increments of trend movement become larger. When the reaction suddenly is larger, the move is ending; the change in the character of the move signals a prudent exit, even if prices continue erratically in the direction of the trend. A similar example occurs in the way that prices react to economic reports or government action. The first time the Federal Reserve acts to raise rates after a prolonged decline, the market is not prepared, and interest rate prices react sharply lower. Before the next meeting of the Fed, the market may be more apprehensive, but is likely to be neutral with regard to expectation of policy. However, once there is a pattern of increasing rates following signs of inflation, the market begins to anticipate the action of the Fed. A sharp move in the opposite direction occurs when the government fails to take the expected action. Bull and Bear Traps While it is not much of a consolation to those who have gotten caught, a failed downside breakout is called a bear trap, and a failed upwards breakout is a bull trap. A bear trap occurs when prices fall below a clear support line, generating sell signals. After a few days, prices move back above the support line, often accelerating upwards. A bull trap 22
Jesse H. Thompson, “What Textbooks Never Tell You,” Technical Analysis of Stocks & Commodities (November/December 1983).
Charting
147
is a failed breakout of a resistance level. In both cases, prices appear to be continuing in the trend direction, but the final picture is a reversal. Although there is no advice on how to avoid bull and bear traps, the failed reversal should be recognized as soon as possible and the position should be reversed. Bull and bear traps often precede significant price reversals. As with other top and bottom patterns, a confirmation of the bear trap is complete when prices move above the next higher resistance level. In the case of a failed flag formation in a downward trend, prices break lower, as expected, then reverse. The confirmation occurs when prices move above the top of the failed flag pattern. The same principle would be true of other failed chart formations; the failure is confirmed when prices retrace the entire pattern.23
Testing Your Skill Recognizing a pattern is both an art and science. Not everyone has an eye for patterns; others see formations where no one else does. The first decision may be the most important: How much of the chart do you use? It is perfectly normal for different time intervals to show different trends. In some cases, arbitrarily cutting the chart at some previous date might cause a clear trend to disappear. The price scale (the vertical axis) of the chart is another variable not considered by some chartists. When applying methods requiring specific angles, the chart paper is expected to have square boxes. Because of the shape of the box, the formations may appear different from one piece of chart paper, or computer screen, to another. The timeliness of the pattern identification is the most serious problem. Can the formation be interpreted in time to act on a breakout, or is the pattern only seen afterwards? At different stages of development, the lines may appear to form different patterns. Before using your charting skills to trade, practice simulating the day-to-day development of prices using the following steps: 1. Hold a piece of the paper over the right side of the chart, covering the most recent
months, or better still, have someone else give you the partial chart. 2. Analyze the formations. 3. Determine what action will be based on your interpretation. Be specific. 4. Move the paper one day to the right, or have someone else give you the next day’s price. 5. Record any orders that would have been filled based on the prior day’s analysis.
Don’t cheat. 6. Determine whether the new day’s price would have altered your interpretation and
trade. 7. Return to Step 3 until finished. 23
See Christopher Narcouzi, “Winning with Failures,” Technical Analysis of Stocks & Commodities (November 2001).
148
TRADING SYSTEMS AND METHODS
This simple exercise might save a lot of money but may be discouraging. With practice you will become better at finding and using formations and will learn to select the ones that work best. Very few traders base their trading decisions entirely on bar charts. Many refer to charts for confirmation of separate technical or fundamental analysis; others use only the most obvious major trendlines, looking for points at which multiple indicators converge. The general acceptance of bar charting analysis makes it a lasting tool.
EVOLUTION IN PRICE PATTERNS A change has occurred in the stock market because of the S&P 500 index, SPDRs, and other index markets. If you think that stock prices are about to fall because of a pending interest rate announcement by the Fed, you can protect your portfolio by selling an equivalent amount of S&P futures. Afterwards, when you have decided that prices have stabilized, you can lift your hedge and profit from rising prices. It is an easy and inexpensive way to achieve portfolio insurance. You can also speculate in the S&P, NASDAQ, Dow, or sectors, rather than trade individual stocks. When institutions and traders buy or sell large quantities of S&P futures, the futures price will drift away from the S&P cash index, which represents the weighted average of the actual component stock prices. Program trading is the process that keeps the price of futures and ETFs aligned with the cash price of the stocks that comprise those index markets. If you have enough capital, and the difference between the S&P futures price and the S&P cash index is sufficiently large, with the futures higher than the cash, you can sell the S&P futures and buy all of the stocks in the S&P 500 cash index. It is a classic arbitrage that brings prices back together. It is all done electronically in seconds. But the ability to buy or sell all the stocks in the S&P at the same time has changed the patterns of individual stocks that are part of the S&P index. While at one time these stocks moved largely due to their own fundamentals, they now all move together. It no longer matters that IBM is fundamentally stronger than GE, or that Xerox is at a resistance level and Ford is at support, or even if a company is under investigation. When you buy the S&P futures, you buy all of the stocks at the same time. Today’s technical trader must keep one eye on the individual stock and the other eye on the index. Apple may have moved above its recent resistance level but stopped because the S&P Index is at its own resistance level, and there are more traders watching the S&P than even Apple. In today’s market, you can anticipate when a stock will find support and resistance by looking at the S&P chart rather than at the individual stock chart. Figure 3.39 shows the S&P 500 index, GE, and Exxon (prior to its collapse) over the same period from October 1999 through December 2000. Fundamentally, these three markets have little in common; however, the overall pattern of the three markets is
Charting
149
FIGURE 3.39 Similar patterns in the S&P, GE, and Exxon.
remarkably similar, with most tops and bottoms occurring at nearly the same time. Because it is unlikely that the fundamentals of each company would result in such a similar price pattern, we can conclude that the S&P futures, combined with program trading, forces the patterns to be materially the same. This change in the way stocks are traded reduces the ability to get diversification by trading across sectors and increases risk.
Globalization: The Similarity of Asian Markets There has been a noticeable and justifiable shift to Asian markets during the past five years. Their economies are booming while the United States and Europe are still trying to recover from the financial crisis. Although not all of the Asian stock markets are open to foreign investors, globalization has not passed them by. Figure 3.40 shows the equity index markets for Hong Kong (HSI), Singapore (SSG), Taiwan (STW), the Philippines (PHI), and Malaysia (KLI) as downloaded from Bloomberg. The patterns seem similar but the price levels are very different, making a comparison difficult. By volatility-adjusting each price series and starting each at 100 on the first date (January 1, 2005), the five series look remarkably the same, as shown in Figure 3.41. It is understandable that, as trading partners, these countries are somewhat dependent upon one another, yet the similarity is surprisingly close. One possible explanation would be the traders. If traders believe that a poor economic sign in one country means that others will also share in bad times, then they sell the equity index markets, or individual
150
TRADING SYSTEMS AND METHODS
35000 30000 25000 Hong Kong Kuala Lumpur Philippines Singapore Taiwan
20000 15000 10000 5000 0 1/3/2005
1/3/2006
1/3/2007
1/3/2008
1/3/2009
1/3/2010
FIGURE 3.40 Equity index prices for five Asian countries. Data from Bloomberg.
stocks, in each country. That would be similar to Hewlett-Packard announcing worse than expected earnings and having traders sell Dell expecting the same. Often the closer relationships caused by traders show that the movement of money is more important than the fundamentals. This was clearly the case for the subprime collapse in September 2008, when all markets moved the same way as investors withdrew their funds as quickly as possible. 200 180 160 Hong Kong
140
Kuala Lumpur Philippines
120
Singapore Taiwan
100 80 60 1/3/2005
1/3/2006
1/3/2007
1/3/2008
1/3/2009
1/3/2010
FIGURE 3.41 Asian equity index markets adjusted to the same volatility level and started at the value 100. Data from Bloomberg.
CHAPTER 4
Charting Systems and Techniques
T
he continued growth of computer applications has had a great impact on technical trading. The first techniques affected were moving averages and other mathematical trending methods, then easy-to-program indicators, followed by systematic optimization. More recently, econometric analysis, cycles, and pattern recognition have been the subject of new development. Many quote services that offer graphics can convert a bar chart to a point-and-figure or candlestick chart at the push of a button. Yet the techniques normally used in classic charting, such as trendlines, channels, and special patterns, are not easily automated because they often depend on the perception of the trader. However, a standard interpretation avoids errors and serves as a useful benchmark. The systems and techniques included in this chapter are those that might be used by traditional chartists. Many of them are classic methods by famous analysts. They do not all require the use of a chart to be followed, but they are clearly interpretations of natural price patterns. The time that it takes for a price to move from one level to the next is not significant in many of these charting systems; it is only the level itself that is important. The common ground in this chapter is that the methods can be automated. At the end of the chapter is a summary of Bulkowski’s work, a study and ranking of most popular chart patterns. This chapter begins with a review of a few of the earliest attempts at systematic trading. Of course, we have come much further in the 60 years since Dunnigan, and markets have expanded and changed. Yet they are still driven by investors with the same objectives. Given our wide range of techniques, tools, and technology, deciding on the most profitable path may be difficult. These first developers struggled with basic concepts and, in many ways, they are the same concepts that we try to resolve now. What appears to be unsophisticated to us now may actually be the key to the best solution. Lest we forget Occam’s Razor, One should not increase, beyond what is necessary, the number of entities required to explain anything. 151
152
TRADING SYSTEMS AND METHODS
DUNNIGAN AND THE THRUST METHOD William Dunnigan’s work in the early 1950s is based on chart formations and is purely technical. Although an admirer of others’ ability to perform fundamental analysis, his practical approach is contained in the statement: “If the economists are interested in the price of beans, they should, first of all, learn all they can about the price of beans. Then, by supporting their observations with the fundamental elements of supply and demand they will be certain that the bean prices will reflect these things.” 1 Dunnigan did extensive research before his major publications in 1954. A follower of the Dow Theory, he originally created a breakaway system of trading stocks and commodities, but was forced to drop this approach because of long strings of losses. The net results of his system, however, were profitable. He was also disappointed when his “23∕8 Swing Method’’ failed after its publication in A Study in Wheat Trading. But good often comes from failure, and Dunnigan had realized that different measurements should be applied to each market at different price levels. His next system, the Percentage Wheat Method, combined a 2½ % penetration and a 3-day swing, introducing the time element into his work and perhaps the first notion off thrust, a substantial move within a predefined time interval. With the 2½ %, 3-day swing, a buy signal was generated if the price of wheat came within 2% of the lows, then reversed and moved up at least an additional 2½ % over a period of at least three days. For Dunnigan, the swing method of charting2 represented a breakthrough; it allowed each market to develop its natural pattern of moves, more or less volatile than any other market. He had a difficult time trying to find one criterion for his charts that satisfied all markets, or even all grains, but established a $2 swing for stocks where Rhea’s Dow Theory used only $1 moves. His studies of percentage swings were of no help.
The Thrust Method Dunnigan’s final development of the Thrust Method combined both the use of percentage measurements with the interpretation of chart patterns, later modified with some mathematical price objectives. He defines a downswing as a decline in which the current day’s high and low are both lower than the corresponding high and low of the highest day of the priorr upswing. If currently in an upswing, a higher high or higher low will continue the same move. The reverse effect of having both a higher high and low would result in a change from a downswing to an upswing. The top and bottom of a swing 1 William
Dunnigan, Selected Studies in Speculation (San Francisco: Dunnigan, 1954), 7. to Make Profits in Commodities (Pomeroy, WA: Lambert-Gann, 1976). This book devotes a large section to swing charts and includes many examples of markets prior to Dunnigan’s work.
2 W. D. Gann, How
Charting Systems and Techniques
153
are the highest high of an upswing and the lowest low of a downswing, respectively. It should be noted that an outside or inside day, in which the highs and lows are both greater or both contained within any previous day of the same swing, has no effect on the direction. In addition to the swings, Dunnigan defines the five key buy patterns: 1. Test of the bottom, where prices come within a predetermined percentage of a prior
low. 2. Closing-price reversal, a new low for the swing followed by a higher close than the
prior day. 3. Narrow range, where the current day’s range is less than half of the largest range for
the swing. 4. Inside range, where both the high and low fall within the prior range. 5. Penetration of the top by any amount, what we now call a breakout.
These conditions are reversed for sell patterns. An entry buy signal was generated by combining the patterns indicating a preliminary buy, with a thrust the next day confirming the move. The thrust was defined as a price gain that varied with the price level of the market (for 1954 wheat, this was from ½ to 1½¢). Dunnigan’s system attempted to enter the market long near a bottom and short near a top, an improvement on the Dow Theory. Because of the risks, the market was asked to give evidence of a change of direction by satisfying two of the first four patterns followed by a thrust on the next day; otherwise, no trade was entered. The same buy and sell signals apply to changes in direction that did not occur at prior tops and bottoms but somewhere within the previous trading range. In the event that all the conditions were not satisfied and prices penetrated either the top or bottom, the fifth pattern satisfied the preliminary signal, and a thrust could occur on any day. This was not restricted to the day following the penetration. If nothing else happened, Dunnigan followed the rules of the Dow Theory to ensure that a major move would not be missed. Repeat Signals and Double Thrusts It has been said by followers of Dunnigan’s method that his repeat signals are the strongest part of his system; even Dunnigan states that they are more reliable, although they limit the size of the profit by not taking full advantage of the trend from its start. Repeat signals use relaxed rules not requiring a new thrust because the trend has already been identified. Two key conditions for repeat buy signals are: 1. A test of the bottom followed by an inside range (interpreted as market indecision). 2. A closing price reversal followed by an inside range.
A double thrust occurs when the first thrust is followed immediately by a second thrust; or, after the first thrust, a congestion area develops, followed by a second thrust
154
TRADING SYSTEMS AND METHODS
in the same direction as the first. Although Dunnigan used a fixed number of points to define his “thrust,’’ today’s traders may find today’s price move compared to the standard deviation of the daily price changes or the average true range are volatility measures that are more practical for identifying thrusts.
One-Way Formula Dunnigan worked on what he hoped would be a generalized version of his successful Thrust Method and called it the One-Way Formula. Based on his conclusions that the Thrust Method was too sensitive, causing more false signals than he was prepared to accept, he modified the confirmation aspect of the signal and made the thrust into the preliminary signal. He also emphasized longer price trends, which smooth performance and reduce signals. With the upswing and downswing rules remaining the same, Dunnigan modified the thrust to require its entire range to be outside the range of the prior day. For a preliminary buy, the low of the day must be above the high of the prior day. This is a much stronger condition than his original thrust yet only constitutes a preliminary buy. (It is likely that lower liquidity during the 1950s allowed for more gaps than we have now.) The confirmation requires an additional upthrust after the formation of, or test of, a previous bottom. There must be a double bottom or ascending bottom followed by a thrust to get a buy signal near the lows. If the confirmation does not occur after the first bottom of an adjustment, it may still be valid on subsequent tests of the bottom. For the One-Way Formula, repeat signals are identical to original confirming signals. Each one occurs on a pullback and test of a previous bottom, or ascending bottom, followed by an upthrust. Both the initial and repeat signals allow the trader to enter after a reaction to the main trend. The Dow approach to penetration is still allowed in the event that all else fails. The refinement of the original thrust method satisfied Dunnigan’s problem of getting in too soon. Updated Trend and One-Way Formula Ruggiero has interpreted Dunnigan’s trend and updated the One-Way Formula3 so that it can be programmed. An uptrend requires two consecutive days where the highs and lows are both higher, confirmed by prices moving above the high of the current downtrend. As simple as this is, results are good and similar to more complex methods. A program to test this method is TSM Dunnigan Trend, available on the Companion Website. The One-Way Formula is considerably more involved and requires identifying a double bottom, then takes advantage of a short-term uptrend or bounce that follows. A program to test this is TSM Dunnigan One-Way Formula, available on the Companion Website.
3
Murray Ruggiero, “Dunnigan’s Way,” Futures (November 1998).
Charting Systems and Techniques
155
The Square Root Theory The two previous methods show a conspicuous concentration of entry techniques and an absence of ways to exit. Although it is valid to reverse positions when an opposite entry condition appears, Dunnigan spends a great effort in portfolio management4 and riskreward conditions that were linked to exits. By his own definition, his technique would be considered “trap forecasting,” taking a quick or calculated profit rather than letting the trend run its course (the latter was called continuous forecasting). A fascinating calculation of risk evaluation and profit objectives is the Square Root Theory. He strongly supported this method, thinking of it as the “golden”5 key and claiming support of numerous esoteric sources, such as The Journal of the American Statistical Association, The Analyst’s Journal, and Econometrica. The theory claims that prices move in a square root relationship. For example, a market trading at 81 (or 92) would move to 64 (82) or 100 (102); either would be one unit up or down based on the square root. The rule also states that a price may move to a level that is a multiple of its square root. A similar concept can be found greatly expanded in the works of Gann (Chapter 14).
NOFRI’S CONGESTION-PHASE SYSTEM Markets spend the greater part of their time in nontrending motion, moving up and down within a range determined by near-stable equilibrium of supply and demand. Most trend followers complain about the poor performance that results from markets that fail to move continuously in one direction. However, their systems are designed to conserve capital by taking repeated small losses during these periods while waiting to capture the “big move.’’ Eugene Nofri’s system, presented by Jeanette Nofri Steinberg,6 is used during the long period of congestion, returning steady but small profits. Nofri’s system does not concern itself with the sustained directional move; therefore the user of the CongestionPhase System can wait to be certain of a well-defined congestion area before beginning a trading sequence. The basis of the system is a third-day reversal. If prices are within a congestion range and have closed in the same direction for two consecutive days, take the opposite position on the close of day two, anticipating a reversal. If this is correct, take the profits on the close of trading the next (third) day. The concept is that, during a sideways period, sustained runs, either up or down, are unlikely. The Congestion-Phase System is only applied to markets within a trading range specifically defined by Nofri. Users are cautioned not to be too anxious to trade in a newly formed range until adequate time has elapsed or a test of the support and resistance has failed. 4
Each of his writings on systems contained examples of multiple-fund management of varied risk. Refers to the Greek description of Fibonacci ratios. 6 A republication of Nofri’s method (2010) is available on successincommodities.com. 5
156
TRADING SYSTEMS AND METHODS
The top of the congestion area is defined as a high, which is immediately followed by two consecutive days of lower closing prices; the bottom of the congestion area is a low price followed by two higher days. A new high or low price cancels the congestion area. Any two consecutive days with prices closing almost unchanged (for example, ±2 ticks) are considered as one day for the purposes of the system. In cases where the top or bottom has been formed following a major breakout or price run, a waiting period of 10 additional days is suggested to ensure the continuance of the congestion area and limit the risk during more volatile periods. A congestion area is not formed until both a top and bottom can be identified. Penetration of a previous top and formation of a new top redefine the range without altering the bottom point; the opposite case can occur for new bottoms. If a false breakout occurs lasting two or three days, safety suggests a waiting period of seven days. Logical stops are also possible, the most obvious places being the top and bottom of the current congestion area, but closer stops could be formulated based on price volatility.
Implementing the Congestion-Phase System When programming the Congestion-Phase System, and most other older strategies, it is likely that not all the rules are as clearly defined as necessary. Some innovation and decisions need to be made. For this method, the greatest uncertainty was defining a “large move” after which we would wait 10 days before looking for new signals. In addition, the “false breakout” needs to be defined clearly and the choice of “two or three” days is taken as “two” days. The “large move” was defined as any net price change (absolute value) over a 10-day interval that was at least two times larger than the average net change over 10 days for all past data. The “false breakout” was any move above or below the congestion levels that reverted back into the congestion zone within two days. For simplicity, no stop losses were used because trades are held for only one day. However, an interesting characteristic of the pattern of signals should be noted. If we enter a new long position after two days down and the next day is also lower, then we close out the current trade with a loss but also reenter a new long at the same time because the “two day down” rule continues to apply. Once you enter a long (or short) you continue to hold it until you have a 1-day profit or the price moves out of the congestion zone. The TradeStation program, TSM Nofri Congestion Phase, can be found on the Companion Website. Figure 4.1 shows the signals from the program applied to wheat, which was chosen because it would have been a popular market when the strategy was first developed. Note that there were no signals during the rally in late September 2006 due to the “large move” rule. Performance was good for a surprisingly long period, although some markets showed large losses during the 2008 subprime crisis. The concept seems to have a sound basis although it may need to adjust to the extreme volatility in recent years. The Congestion-Phase System may stand alone as a short-term trading method or can be used to complement any longer technique. After 30 years, it is still unique in the way it defines a sideways range and generates trading signals. There is a shortage of strategies that are not based on trend following, and this method has potential for filling the gap.
Charting Systems and Techniques
157
FIGURE 4.1 Nofri’s Congestion-Phase System applied to wheat, as programmed on TradeStation.
OUTSIDE DAYS WITH AN OUTSIDE CLOSE There are numerous chart patterns that can be profitable if they are properly identified and traded consistently. Unfortunately, any one pattern may not appear very often, and traders may become impatient waiting for the opportunities. For others who feel that overall trading success is a combination of small victories, the outside day with an outside close is a good place to start. An outside day has the high and low outside the range of the previous day; that is, the high is higher and the low is lower. An outside close is one where the closing price is higher or lower than the prior day’s high or low, respectively. This pattern represents a volatile day, usually triggered by news, and is clearly resolved in one direction. If the close was in the direction opposite to a recent price move, it is also a key reversal day;7 however, this method does not attempt to find the current trend. A brief study by Arnold8 showed that this pattern proved profitable for a small sample of currencies, metals, and financials using the following rules: 1. Buy on the close of an outside day if the close is above the prior high; sell if the close
is below the prior low. 2. If buying, place a stop-loss just below the low of the outside day; if selling, place the
stop just above the high. 3. Close out the position on the close three days after entry.
After varying the exits from one to five days, Arnold concluded that this formation predicts reasonably consistent price movements for the next three days. 7 8
See the discussion of key reversals in Chapter 3. Curtis Arnold, “Your Computer Can Take You Beyond Charting,’’ Futures (May 1984).
158
TRADING SYSTEMS AND METHODS
Times have changed, and markets are generally noisier and often more volatile. In the 1970s and perhaps into the early 1980s, this pattern was likely to work, but not since the mid-1980s. However, if you reverse the rules and sell when today’s price closes above the previous high on a volatile day, your results are much better. Arnold held the trade for a fixed number of days, but some conditional exit is more likely to improve results. The program TSM Outside Day With An Outside Close is available on the Companion Website. It allows you to test the number of days that the trade is held. Results might be improved by removing trades during periods of low volatility because a wide-ranging day after one with a very narrow range may prove to have no forecasting value.
INSIDE DAYS Inside days can also be a predictor of direction. Prathap9 has identified the setup pattern An upwards day, Ct−2 > Ct−3 Followed by an inside day, Ht−1 < Ht−2 and Lt−1 > Lt−2 Followed by another upwards day, Ct > Ct−1 as a short-term indicator of a continued upwards move, especially for gold, silver, and crude oil. The reverse is true for downwards moves. A program to test this is TSM 3-Bar Inside Day, available on the Companion Website.
PIVOT POINTS A pivot point was defined in the previous chapter as the highest high price or a lowest low in the center of a number of days. Most often there are one to three days on either side of the pivot day. A pivot point can be used in the same way as a swing high or low, except that there is no minimum retracement needed, which adds a greater degree of natural flexibility to the patterns. It is also more restrictive than the swing high, which only needs a high price rather than a reversal after the high occurs; therefore, it introduces a lag as a trade-off for confirmation. Pivot points can be substituted for swing highs with generally greater success. Their best application is trend following, buying on an upwards move through the previous pivot high and selling on a break through the previous pivot low. Although most uses of pivot points will focus on one to three days on each side of the pivot point, using much longer periods, for example, 10 or 20 days, will give the performance the same appearance as a macrotrend program. A TradeStation program that generates trend signals, TSM Pivot Point Breakout, is available on the Companion Website along with an indicator, TSM Pivot Point, that plots the pivot points on a price chart, as seen in Figure 4.2. 9
Johnan Prathap, “Three-Bar Inside Bar Pattern,” Technical Analysis of Stocks & Commodities (March 2011).
Charting Systems and Techniques
159
FIGURE 4.2 U.S. 30-year T-bond prices showing pivot points above and below the price and buy and sell signals when there is a penetration of the previous pivot points, based on five days on either side of the pivot point.
ACTION AND REACTION Fundamentals may be responsible for the ultimate rise and fall of prices, but human behavior creates the patterns that occur as prices find their level of equilibrium. Each move is a series of overreactions and adjustments. Elliott’s Wave Principle is the clearest and most well-known of the theories founded entirely on this notion. Frank Tubbs’ Stock Market Correspondence Course is the first to define the magnitude of these reactions in his Law of Proportion; and, in 1975, the Trident System was based on both the patterns and the size of the action and reaction. Retracement of a major bull campaign is the most familiar of the market reactions and the one to which almost every theory applies. It is virtually unanimous that a 100% retracement, where prices return to the beginning of the move, encounters the most important support level. The 100% figure itself has been discussed in terms of unity, referring to its behavioral significance. The next most accepted retracement level is 50%, strongly supported by Gann and commonly discussed by experienced speculators. The other significant levels vary according to different theories: Schabackerr accepts an adjustment of 1∕3 or ½, considering anything larger to be a trend reversal. Angas anticipates 25% reactions for intermediate trends. Dunnigan and Tubbs look at the larger ½, 2∕3, or ¾ adjustments. Gann takes inverse powers of 2 as behaviorally significant: ½, ¼, 1∕8, . . . Elliottt based his projections on the Fibonacci ratio and its complement (0.618 and 0.382). Predicting advances to new higher or lower prices is based on prior moves. Gann believed in multiples of the lowest historic price as well as even numbers; prices would find
160
TRADING SYSTEMS AND METHODS
natural resistance at $2, $3, . . . , at intermediate levels of $2.50, $3.50, . . . , or at two to three times the base price level. Elliott looked at moves of 1.618 based on a Fibonacci ratio.
Fibonacci Ratios Along with the most common 1, ½, 1∕3, and ¼ retracement values, Fibonacci ratios have the greatest following. Fibonacci ratios are found by dividing one number in the Fibonacci summation series 1, 1, 2, 3, 5, 8, 13, 34, 55, 89, 144, 233, … by the preceding or following value. The series is formed beginning with the values 1, 1 and adding the last two numbers in the series together to get the next value. The numbers in the series, especially those up to the value 21, are often found in nature’s symmetry; however, the most important aspect of the Fibonacci sequence is the ratio of one value to the next. Called the Golden Ratio, this value Fn/Fn+1 approaches 1.618 as n gets large. An unusual quality that has drawn attention is that the inverse Fn+1/F /Fn = 0.618. The Golden Ratio has a long history. The great pyramid of Gizah, the Mexican pyramids, many Greek structures, and works of art have been constructed in the proportions of the Golden Ratio. These and other examples are given in Chapter 14 where they are also shown in context with trading systems. At this time it is important to recognize that many analysts who consider human behavior as the primary reason for the size of a price move and their retracements use the Fibonacci ratio 0.618 or, less often, its reciprocal 1 − 0.618 = 0.382, as very likely targets. Elliott is the most well-known advocate, and applications of his Wave Theory are filled with these ratios. Retracement rules have not been proved scientifically but they are accepted by most traders. In general terms, the retracement theories, orr revelation methods, can be categorized as eitherr proportional retracements orr time-distance goals. Proportional retracement states that prices will return to a level that is clearly related, by proportion or ratio, to the length of the prior price move. The larger the move, the clearer the retracement. The percentages and ratios expected to be successful are those that are most obvious: 100%, 50%, 33%, and so on, in addition to the Fibonacci ratio 1.618 and its inverse 0.618. The time-distance rule is popularized in the works of Gann (also found in Chapter 14). Gann’s retracement objectives can best be thought of as forming an arc of a circle, with the center at the price peak. The goal is satisfied when prices touch any point on the circle. Practically speaking, it is unrealistic to expect retracement levels to be reached exactly; therefore, when making this fully systematic it is better to allow for the targets to be closer by some percentage in the range of 10% to 15%.
Tubbs’ Law of Proportion The technical part of Frank Tubbs’ course in stock market trading is intense chart interpretation. The Law of Proportion presented in Lesson 9 of the course is a well-defined
Charting Systems and Techniques
161
FIGURE 4.3 Tubbs’ Law of Proportion.
action-and-reaction law. In cases where the nearby highs or lows of a swing were not broken, Tubbs claims four out of five successful predictions with his principle. The law states: Aggregates and individual stocks tend to run on half, two-thirds, three-fourths of previous moves. First in relation to the next preceding move which was made. Then in relation to the move preceding that. Applied to a stock trading at $20, an initial move from $20 to $26 would react ½ to $23, 2∕3 to $22, or ¾ to $21.50. Tubbs does allow for traditional price support as a major obstacle to the measured price retracement, and so unity (a 100% retracement) may be added to the three proportions. Figure 4.3 shows subsequent reactions to the stock move just described; the second reversal could be any of three values (or back to major support at $20.00), ending at $21.50, a ¾ reversal. Reversals 3, 4, and 5 are shown with their possible objectives. The last reversal, 5, becomes so small that the major support levels (horizontal broken lines) are considered as having primary significance, along with proportions of moves 1 and 2. Major support at $20.00 coincides with ½ of move 1 and 2∕3 of move 2. This would normally be sufficient to nominate that point as the most likely to succeed. Tubbs indicates that these points rarely occur with exactness, but proportions serve as a valuable guideline. The principle is one of reaction in relationship to an obvious preceding action.
162
TRADING SYSTEMS AND METHODS
Trident The Trident Commodity Trading System received its fair share of publicity when it was introduced at the beginning of 1975.10 An article in the 1977 Dow Jones Commodities Handbook had an excellent review of the background of the system and some of the conflicts surrounding its presentation and subsequent successes and failures. The system itself is not unique in concept but in its implementation. It is based upon the principle of price action and reaction with formations similar to the waves of R. N. Elliott. For each price move, there is a point of undervalue and overvalue with subsequent reaction, or adjustments, in price as it moves irregularly in the direction determined by the ultimate balance of supply and demand. The object of the system is to trade in the direction of the main trend but take advantage of the reactions (or waves) to get favorable entry and exit points. The concept of trading with the trend and entering on reactions had been discussed in the context of commodity technical analysis as early as 1942 by W. D. Gann and in the preceding section on action and reaction. As with Gann, the goal is to predict where the reactions will occur and what profit objective to set for each trade. Trident’s approach is easy to understand: Each wave in the direction of the main trend will be equal in length to the previous wave in the same direction. The target is calculated by adding this distance to the highest or lowest point of the completed reaction. The determination of the tops and bottoms of the waves is dependent on the time period used; the complex form of primary and intermediate waves, as in Elliott’s principle, would hold true with Trident (see Figure 4.4). Because there are inaccuracies in the measurement of behavioral phenomena, Trident emphasizes the practical side of its theory by offering latitude in its choice of entry and exit points. By entering after 25% of the anticipated move has occurred and exiting 25% before the target, there is ample time to determine that the downward reaction has ended before your long position is taken, and enough caution to exit well before the next reaction. A critical point in each main trend is midway between the start of the move and the target. If the midpoint is not reached, there is a change in direction of the main trend causing a reevaluation of the main trend and the reactions. A change of direction is considered conclusive if a reversal equal in size to 25% of the last reaction occurs during what was expected to be an extension of the main trend. That 25% value becomes the trailing stop-loss on any trade in the event the objective is not reached. This discussion is not intended to be a complete representation of the Trident System, but a brief description of its essential ideas. The actual system has substantial refinements and subtleties in target selection for major and minor trends and corrective moves; it includes points to reverse positions based on the trailing stop. However, the main premise must hold up if the strategy is to be successful. In a later bulletin to Trident users, it was suggested that a modification to the system be implemented with respect to money management. Using a technique similar to the Martingale System, each loss is followed by an increase in the size of the position traded. 10
Charles L. Lindsay, Trident: A Trading Strategy, reprinted in 1991 by Windsor Books.
Charting Systems and Techniques
163
FIGURE 4.4 Trident entry-exit.
The trader only has to continue to extend his positions and stay with the system until he wins. A comprehensive version of this classic gambling approach can be found in the sections “Martingales and Anti-Martingales” and “Theory of Runs,” both in Chapter 22. The Trident concepts are all reasonable. They include advance and retracement, trade the trend, don’t pick tops and bottoms, take the center out of each move, and use a trailing stop; however, their concept of position size can result in ruin.
An Overview of Percentage Retracements The last few sections have discussed specific retracement levels advocated by wellknown market analysts. This section takes a more general approach to percentage retracements, applying these levels to soybeans and the S&P 500, and draws some conclusions about their use. From previous discussions, the most important reversal that follows a sustained trend is a retracement of 100%, where prices give back all of their gains. A 100% pullback means that the reason for the previous price move has disappeared. This is most common for shorter time periods, where prices are driven by a single news event that turns out to be false, or that the initial reaction to a report was incorrect and prices give back all of their gains, often continuing in the opposite direction. Confused interpretations of economic reports are quite common. On some days, the government releases multiple reports at the same time, 8:30 Eastern time. These statistics can be new reports of retail sales and revised numbers of past sales. Recently, new housing starts were up 8%, causing a price jump, but then the National Association of Realtors announced a downward revision of 15% for the entire past year. The government revises its previous GDP and other statistics each time it releases new ones. In agriculture, the media reports a major problem with crops each year, the result of too little rain or too much rain. In the end, technology usually wins and there is a record harvest. There are constant rumors of large companies being the target of an SEC probe, or a company correcting an accounting “irregularity.” When news turns out to be false, it usually erases the previous gains.
164
TRADING SYSTEMS AND METHODS
For seasonal commodities, such as crops, there are longer patterns of rising and falling prices. In 1988, a shortfall in the soybean crop with dwindling warehoused stocks caused prices to double. After two years of good harvests, inventories were restored and prices returned to original levels, a 100% retracement. In 2001, the price of soybeans rallied during the growing months, June through August, based on lack of rain. By the end of August, it was clear that the damage was minimal, and prices fell back to the same level as in the spring, a 100% retracement. In 2012 we again have seen one of the greatest bull markets in grain caused by severe drought and anticipation of a harvest that will be at least 10% below normal. How long will that take to retrace? Certainly, news of a good 2013 crop will help, but prices also drop when demand disappears and the high price of corn causes substitution for products such cattle feed, sweeteners, and even reduction in the use of ethanol. The retracement can be faster than we think. Eventually, it will retrace near 100%. Many patterns used to analyze stock and index prices come from agricultural futures markets. Traders adopt any technique that has worked. The much greater liquidity of soybean futures compared to many individual stocks during the middle of the 1900s makes the futures patterns more reliable. Farmers, grain elevators, and speculators have been doing the same thing since the mid-1800s. Because agricultural products are highly seasonal, and tend to return to the same price levels periodically, they have excellent examples of retracements. Retracements Less than 100% There is a significant difference between a full retracement (100%) and a partial retracement. A full retracement negates the underlying reason for the previous move. But what is the significance of a 50% retracement? Retracements are a common occurrence. They have been compared to the ebb and flow of the tides. Investors buy until they have bought too much, then the sellers come in to correct the overbought situation until the price is back to a level that attracts more buying. The previous sections have discussed retracements of 50%, 33%, 25%, and 12.5%, as well as 61.8% and 38.2%. The obvious problem is that, if there are so many possible retracement levels, then the price is likely to stop at one of them, even if by chance. Without other information, the most successful retracements are most likely to be the larger ones. Then 100% is the most important, and 50% is the next most likely. After that there is 33% and 25%, each of less importance, with 12.5% too small to consider seriously. Fibonacci ratios are an exception; there seems to be good support for expecting mass behavior to be reflected in these ratios. Including Fibonacci, the most important retracements are 100%, 50%, and 61.8%. Figure 4.5 shows one of each primary retracement on a weekly soybean chart for a four-year period from 1976 to 1980. Markets that have high volume are most likely to conform to standard retracements. This means that index markets, such as the S&P 500, would also show 50% and 61.8% pullbacks, but individual stocks may not. Mass behavior is a function of broad participation.
165
Charting Systems and Techniques
Peak2 (exactly twice peak 1)
Peak 1
50% line 38% line
25% line
62% retracement
Starting level
100% retracements
FIGURE 4.5 Soybean retracements in the late 1970s.
S&P Retracement Levels The S&P has excellent liquidity; therefore, we would expect retracement levels to conform to the rule of large numbers. Unlike an agricultural product, or a stock with a strong seasonal performance, the S&P is not likely to retrace 100% of a longer-term move. We expect that the core inflation rate, added to the investment bias that exists in the United States, will cause a steady rise in the overall price of stocks. Figure 4.6 shows the first part of the bear market that began in 2000. The swing highs and lows are marked with letters beginning with A and C at the top, with B the low between them. The breakdown of the support line drawn horizontally from B results in prices reaching D, a decline of 100% of the range from A to B, followed by a retracement of 50% back to E (support becomes resistance). Throughout the decline we can find numerous examples of retracement that conform to the expectations of 100%, 50%, and less important, 62%. Each retracement level is a trading opportunity. If a rally is expected to stop at a 50% retracement, a short sale could be triggered automatically at that price. But anticipating a top and selling into a rising market have a high degree of risk. Price movement is not so precise that you can anticipate a target with a great degree of confidence. Targeting a profit level and exiting a trade is considered safe and sensible, because you are removing risk, but buying when prices are falling quickly is comparable to stepping in front of a moving train. Entering a new trade on a retracement is considered best when there is a confirmation that prices have stopped at that retracement level. This may manifest itself
166
TRADING SYSTEMS AND METHODS
A
C
100% retracement from A-B
E
50% retracement of C-D
B G 50% of E-F
D I 62% of G-H
F 50% of G-H 38% of G-H
H
FIGURE 4.6 S&P retracement levels.
as slowing price movement, declining volatility, or declining volume occurring at a point very close to your expected retracement level. If a new low follows on an increase in volume, then you quickly close out the trade and try again later. Common sense is needed in addition to a retracement target.
Clustering Price movement is a combination of two steps forward and one step backwards. Some serious students of price patterns say that it moves two steps forward and 1.618 steps backwards. Regardless of who is right, prices rarely move in one direction without reversing. Anticipating the size of a retracement is an attempt to capitalize on the mass behavior of the investors. The continuous flow of funds in and out of the markets reflects the risk tolerance of each participant but also their response to news and the general economy. When seen as the action of a large group, the places where prices stop and reverse, in both their forward movement and backwards steps, seem to cluster at specific levels. Retracements are most important after a sustained price move or during a clear trend. Interesting observations were made by Tom DeMark11 about identifying the price move that serves as the basis for measuring retracements. If the market is currently at 11
Thomas R. DeMark, “Retracing Your Steps,” Futures (November 1995). Also see Chapter 2 of DeMark, The New Science of Technical Analysis (New York: John Wiley & Sons, 1994).
Charting Systems and Techniques
167
a low, rather than judging the distance of this drop from the most recent swing high, he chooses to look for the highest point that has occurred since the last time the market traded at this low level, thereby eliminating obsolete data. He then finds the most likely retracement points using the Fibonacci ratios 0.618 and 1.618, plus Fibonacci “alternative” ratios 0.382, 0.50, 1.382, 2.236, and 2.618 applied to the difference between the high and low, added to the current low price. Trading at Even Numbers It is said that prices advance and decline to even numbers. A stock is more likely to stall at $10 than at $9.25; the price of gold resisted moving below $1000, but once it had traded lower, it struggled to go back above $1000. A study by the New York Federal Reserve confirms the increase in trader activity around even numbers. It makes sense that investors are more likely to place orders at even numbers. Active traders and longer-term investors do not usually tell a broker to buy at IBM at $153.20, but would more likely buy at $152 or $153. Even more investors would choose $150 or $155. When Martha Stewart placed her now well-known order to sell Imclone stock, it was at $60, not at an odd value. A good trader can take advantage of this obvious bias for placing orders by avoiding even numbers and looking for free exposure when prices move through those levels. Moves through even numbers can be thought of as minor breakouts. If you want to sell a breakout of Imclone short at $60, place your sell order at $60.25 to be ahead of the crowd and take advantage of a fast drop caused by the bunching of orders at even numbers.
CHANNEL BREAKOUT The classic upwards channel is formed by drawing a straight line along the bottom points of an upwards trend, then constructing a parallel line that touches the extreme high price of that same time interval, forming an envelope, or channel, around a price move. For a downward channel, the trendline is first drawn through the high points of the declining price pattern; then a parallel line is drawn through the lowest low price of that interval. It is easy to do this with a chart and a ruler, even easier with drawing tools on a screen, but not as simple to transfer this concept to a computer program. Because a channel breakout is basic trading strategy, an automated version may prove useful for identifying key market turning points. Two different approaches can be used: 1. Swing high and low points a. Locate the swing high and low points using the program discussed at the begin-
ning of Chapter 5. Alternately, pivot points can be used. b. The most recent trendline connects the two most recent high swing points or low
swing points.
168
TRADING SYSTEMS AND METHODS
Major high
Minor highs
Major low
Minor lows
Major low
FIGURE 4.7
Major and minor swings.
c. For a longer uptrend, use a least-squares regression of the most recent 3, 4, 5, etc.
low swing points. Choose the number of points that give the best fit, provided the slope is angling upwards. d. Draw a parallel line across the highest high of the same time interval using the
same slope as the regression line. e. Using two different swing percentage criteria, faster and slower trendlines can be
found (see Figure 4.7). 2. Use a straight-line fit a. Select the data beginning with the last swing high or swing low, based on observa-
tion or the swing program. b. Use the closing prices for Y (the dependent variable) and sequential integers 1, 2,
3, . . ., t for the values off X (the independent variable) through today. It would be easier if we could use the date instead of a sequential number, but the gaps due to weekends would cause an incorrect answer. Solve forr a and b, the slope and y-intercept, using the regression data analysis function in Excel located in the menu at Data/Data Analysis/Regression. Once you have the a and b values, any point on the line can be found using Straight line values, Y = a × X + b c. Create trendlines parallel to the regression line by finding the distance BL from the
line to the lowest point below the line, and BU, U from the line to the highest point above the line. Then the upper trendline (resistance) and the lower line (support) are
169
Charting Systems and Techniques
YU (upper) r = a × X + b + BU YL (lower) r = a × X + b − BL d. Project the bands one period ahead. In order to know whether the next price has
broken through the channel, indicating a change of trend, we project the channel one period ahead using the slope value, a: Projected upper channel band at n + 1 = a × X + b + BU + a Projected lower channel band at n + 1 = a × X + b − BU + a If the trend is up (the slope a > 0) and the next price, either the close or the low, is below the projected lowerr band, then the trend has turned from up to down. If the trend is down (a < 0) and the next price, either the close or high, is greater than the projected upper band, then the trend has turned up. When the slope, a, is very near zero, we have a sideways channel, but the same rules still apply. The use of the closing price to decide the breakout, rather than the high or low, is more conservative. Because a major channel is considered a strong chart formation, prices that approach the channel, but have not penetrated the band, would be candidates for a countertrend entry. For example, if the trend is down and prices come within 15% of the upper band (based on the channel width), we would enter a new short position (see Figure 4.8) or
A C E1
E2
E3
B
15% of channel width
X1 X2
FIGURE 4.8
Entering near the top of a declining channel.
170
TRADING SYSTEMS AND METHODS
add to existing short sales. We do not necessarily want to cover those existing shorts at the bottom of the channel, especially if the downtrend is severe; however, this technique offers a clear and safe way to scale into a trade with more than one entry point. The trade is closed out if the price breaks above the upper channel line in a downtrend or the lower channel line in an uptrend. If the trend is sideways (the slope is near zero) then exiting shorts and reversing to a long position is the preferred strategy. One note of caution: all trends turn sideways as they reverse direction. For a sideways market the rate of change of the price must also be small. A minor channel can also be used to signal buys and sells within a major channel. By finding swing points using a smaller minimum swing value, we can wait for a break of the minor channel to signal a new trend direction within the major channel. This gives an added confirmation that prices are moving in your direction before entering.
MOVING CHANNELS Channels are frequently constructed as moving bands around prices. Some of these, such as those using a standard deviation, can claim statistical significance (these are discussed in Chapter 8, in particular the section “Bollinger Bands”). A simple mathematical way of representing a moving channel might use the average of the high, low, and close (M) to designate the center of the channel (a substitute for the straight line); the upper (M and lower bands are constructed using the average daily range (or true range), R. The midpoint of the price move M and range R can be calculated over the past n days as Mt = Rt =
1 t ∑ ( H i + Li + Ci ) 3 n i=t−n+1 t 1 × ∑ ( H i − Li ) n i=t−n+1
Then the upper and lower channel bands add and subtract ½ R to the midpoint M M, and the forecast for the next day will project the path of the midpoint and apply a multiple of the range ((ff) for scaling,
Ut
Mt + ( Mt
Lt
Mt + ( Mt
Rt 2 R Mt 1 ) − f × t 2 Mt 1 ) + f ×
A long position is taken when the new price pt+1 > Ut+1; a short is taken when pt+1 < Lt+1. If a channel profit objective is needed, it can be calculated at a point equal in distance to the channel width from the channel breakout as follows
171
Charting Systems and Techniques
R
R/2
FIGURE 4.9
Channel calculation.
Rt 2 Rt Short objective (lower band), LOt+1 = Lt+1 – f × 2
Long objective (upper band), UOt+1 = Ut+1 + f ×
The objective may remain fixed at the price level determined on the day of the breakout, or preferably, will change each day to remain one band width from the new channel value (Figure 4.9). This method takes advantage of changing price volatility. More examples can be found in Chapter 20. An alternate way of defining a channel would be to forecast one day ahead using the slope of a regression analysis (linearr for a straight channel, log for a curved one) and use the standard deviation of the price changes to define the band. The other rules would remain the same.12
COMMODITY CHANNEL INDEX The Commodity Channel Index x (CCI) isn’t necessarily for commodities and uses a channel only in the broadest sense. Instead, it is a measure of the deviation of the current price from the previous n days. It is best for mean reversion trading and has reasonable 12 For
a further discussion of channels, see Donald Lambert, “Commodity Channel Index,” Technical Analysis of Stocks & Commodities (October 1980); and John F. Ehlers, “Trading Channels,” Technical Analysis of Stocks & Commodities (April 1986).
172
TRADING SYSTEMS AND METHODS
statistical properties. First, find the average of the sum of the daily high, low, and close over n days (call it ADP), P
∑ ADP DP =
t i t − n +1
( Hi
t
Li
Ci )
n
Then calculate the average deviation (AvgDev) over the same n-day interval
AvgDevt
∑ =
i t i t − n +1
Hi
Li + C i
ADP A Pi −1
n
Then CCIt is the ratio of today’s deviation divided by a fraction of the average deviation CCI t =
( H t Lt Ct A ADP Pt 1 ) 0.015 × AvgDevt−1
This can be easily done in a spreadsheet and plotted with the underlying price. The full spreadsheet, TSM Commodity Channel Index HPQ, can be found on the Companion Website. Development software may have a built-in function for this method. The CCI is essentially a variation on a standard deviation channel with similar advantages and disadvantages. When prices become overbought during a strong upwards move, they can stay that way for weeks at a time. Simple rules for buying and selling oversold and overbought prices will give frequent small profits and an occasional very large loss.
WYCKOFF’S COMBINED TECHNIQUES Richard D. Wyckoff, popular in the early 1930s and still discussed today, relied solely on charts to determine the motives behind price behavior. He combined the three most popular methods—bar charting, point charts (the predecessor of point-and-figure charts), and waves—to identify the direction, the extent, and the timing of price behavior, respectively.13 To Wyckoff, the bar chart combined price and volume to show the direction of the price movement. In general terms, it shows the trading ranges in which supply and demand are balanced. The volume complemented this by giving the intensity of trading, which relates to the quality of the long or short position. Wyckoff used group charts, or indexes, in the manner of Charles Dow, to select sets of stocks with the most potential, rather than looking only at individual stock price movement. This assures that the 13
Jack K. Hutson, “Elements of Charting,” Technical Analysis of Stocks & Commodities (March 1986).
Charting Systems and Techniques
173
move is based on the broader nature of the business, rather than on individual company dynamics. In today’s market, we can use the S&P 500 or sector ETFs to accomplish the same objective. Point-and-figure charts are used to condense price action. If prices move from lower to higher levels due to events, the time it takes to reach the new level is unimportant. Point-and-figure charts record events, not time. As long as prices rise without a significant reversal, the chart uses only one column; when prices change direction, a new column is posted (see the point-and-figure and the swing trading sections in Chapter 5). Price objectives can be determined from formations in a point-and-figure chart, and are usually related to the length of the sideways periods, orr horizontal formations. These objectives are normally closer than objectives found using similar bar chart formations. The wave chart, similar to Elliott’s theories (discussed in Chapter 14), represents the behavior of investors and the natural rhythm of the market. Wyckoff uses these waves to determine the points of buying and selling within the limitations defined by both the bar chart and point-and-figure charts. He considered it essential to use the wave charts as a leading indicator of price movement. Wyckoff used many technical tools but none rigidly. He did not believe in unconfirmed fundamentals but insisted that the market action was all you needed—the market’s primary forces of supply and demand could be found in charts. He did not use triangles, flags, and other formations, which he considered to be a type of Rorschach test, but limited his analysis to the most basic patterns, favoring horizontal formations or congestion areas. He used time-based and event-based charts to find the direction and forecast price movement, then relied on human behavior (in the form of Elliott waves) for timing. His trading was successful, and his principles have survived.
COMPLEX PATTERNS Most charting systems involve a few simple rules, trying to model a price pattern that seems to have repeatedly resulted in a profitable move. The most popular systems are trend breakouts, either a horizontal pattern or a trend channel. Over the years these approaches have proved to be steady performers. Another group of traders might argue that is it better to be more selective about each trade and increase the expectation of a larger profit than it is to trade frequently in order to win “in the long term”—that is, playing a statistical numbers game.
DeMark’s Sequential™ Tom DeMark has created a strategy, called a sequential, that finds a very overextended price move, one that is likely to change direction, and takes a countertrend position.14 14
Thomas R. DeMark, The New Science of Technical Analysis (New York: John Wiley & Sons, 1994).
174
TRADING SYSTEMS AND METHODS
His selling objective is to identify the place where the last buyer has bought. His rules use counting and retracements rather than mathematical formulas or trendlines. To get a buy signal, the following three steps are applied to daily data: 1. Setup. To begin, there must be a decline of at least nine or more consecutive closes
that are lower than the corresponding closes four days earlier (closet < closet−4). In the case where today’s close is equal to or greater than the close four days before, the setup must begin again. 2. Intersection. To assure that prices are declining in an orderly fashion, rather than
plunging, the high of any day on or after the eighth day of the setup must be greater than the low of any day three or more days earlier. Note that there can be a delay before the intersection occurs provided that the pattern is not negated by the rules in Step 3. 3. Countdown. Once the setup and intersection have been satisfied, we count the
number of days in which the close was lower than the close two days ago (closet < closet−2). The days that satisfy this countdown requirement do not need to be continuous. When the countdown reaches 13, we get a buy signal unless one of the following conditions occurs: a. There is a close that exceeds the highest intraday high that occurred during the
setup stage. b. A sell setup occurs (nine consecutive closes above the corresponding closes four
days earlier). c. Another buy setup occurs before the buy countdown is complete. In this case the
rules begin again at Step 2. This condition is called recycling. A sequential buy signal is shown in Figure 4.10 for the Deutsche mark (now the euro). The sell signal is the reverse of the buy. Traders should expect that the development of the entire formation will take no less than 21 days, but typically 24 to 39 days. Entering the Sequential Once the buy signal occurs, there are three choices for entering the market. The first is to enter on the close of the day on which the countdown is completed; however, this risks a new setup situation, which will extend the conditions for an entry. The second requires a confirmation of price direction, the close greater than the close four days ago, but it avoids the possibility of recycling. The third is to enter a long when the close is greater than the high two days earlier, a compromise between the first two techniques. Exiting the Sequential A number of exit conditions, consistent with the type of pattern, provide the trader with clear rules to liquidate the current trade. First, the current buy setup is complete, and the lowest price recorded does not exceed the furthest price recorded by the recent inactive setup (normally the previous sell setup). If, however, any price recorded in the current
175
Charting Systems and Techniques
Deutsche Mark
1 2 34 5 67 8
9 xx
x x x
xx
x
A
x B x
xx x
Buy
FIGURE 4.10 A sequential buy signal in the Deutsche mark.
buy setup exceeds the furthest price of the previous sell setup, then the position is held until a reverse signal occurs. Two stop-losses are also recommended. For a buy signal, the true range of the lowest range day of the combined setup and countdown period is subtracted from the low of that lowest day to create a stop-loss. Alternately, the difference between the close and the low of the lowest day is subtracted from the low of the lowest day for a closer stop-loss.
Thinking about Complex Patterns There seems to be an extreme contrast between the simplicity of a trend breakout and the very complex set of circumstances that produce a signal for DeMark’s sequential. The basic breakout system can be tested for robustness by comparing the performance of slightly longer and shorter calculation periods. As the calculation period becomes larger,
176
TRADING SYSTEMS AND METHODS
the trades should become more selective, the profits per trade become larger, and the overall performance profile improve. In the case of a single pattern, such as an island reversal or DeMark’s sequential, there is no way to measure robustness in the same terms. For the sequential, there is only one count of 13 days and 1 pattern. Robustness can only be found by applying this method across different, unrelated markets. Each trader must decide whether this pattern, or any other complex set of rules, produces a better set of trades, or whether it is too specific to survive the test of time.
A STUDY OF CHARTING PATTERNS There has always been a chasm between academics and practitioners over the value of technical analysis. Financial scholars have referred to charting as “voodoo finance,” while technicians believe that their trading success is enough to refute academic conclusions that charting has little value. After all, it took many years of profitable public performance before trend following gained the attention of academics; there is no reason to expect something more complicated to take less time.
Computer Recognition of Chart Patterns A very credible attempt to quantify charting patterns and assess their value was published by Lo, Mamaysky, and Wang.15 The authors applied kernel regression as a smoothing technique, then defined 10 charting formations in the context of the smoothed price series. For example, a head-and-shoulders top formation is defined in terms of the most recent five local maxima and minima in the smoothed series, E1, E2, E3, E4, and E5. In the definitions of the tops which follow, E1, E3, and E5 are maxima and E2 and E3 are minima; for the bottom formations, which are not shown, E1, E3, and E5 are minima and E2 and E3 are maxima. Head-and-Shoulders Top E3 > E1, E3 > E5 E1 and E5 are within 1.5% of their average E2 and E4 are within 1.5% of their average Broadening Top E1 < E3 < E5 E2 > E4 15 Andrew
W. Lo, Harry Mamaysky, and Jiang Wang, “Foundations of Technical Analysis: Computational Algorithms, Statistical Inference, and Empirical Implementation,” Journal of Finance (August 2000).
Charting Systems and Techniques
177
Triangular Top E1 > E3 > E5 E2 < E4 Rectangular Top Tops are within 0.75% of their average Bottoms are within 0.75% of their average Lowest top > highest bottom Double Top E1 and Eb are within 1.5% of their average, where E1 is a maxima ta* − t1* > 22 The identification of formations used a rolling window of 38 trading days; the notation t1 represents the first day of the current window, 37 days back. We interpret the notation ta* t1* > 22 to mean that the two extrema E1 and Eb must be separated by more than 22 days. Although the definitions are logical, the authors accept the differences between a mathematical definition of a charting formation and the visual, cognitive approach taken by a technical analysis. The human brain can assimilate and recognize more complex and subtle formations than the simple definitions presented in the paper. Then, on the one hand we have a somewhat limiting definition of chart patterns, and on the other we have the way in which humans select which patterns they choose to trade. It is far from certain which approach will yield the best returns. The 10 patterns defined were head-and-shoulders tops and bottoms, broadening tops and bottoms, triangular tops and bottoms, rectangular tops and bottoms, and double tops and bottoms. In an example of the triangular formations, the key points used to identify the pattern did not align to form classic straight line sides; however, the consolidating formation that was recognized is itself a good candidate for analysis. The success of the formation was measured by the returns over the three days immediately following identification. In addition, the formations were conditioned on the trend of volume; that is, returns were separated into formations that develop with increasing volume and decreasing volume.
Results of the Study Tests were performed on several hundred U.S. stocks traded on both the NYSE and NASDAQ, from 1962 through 1996. The most common formations, the double top and double bottom, showed more than 2,000 occurrences of each. The next most frequent were the head-and-shoulders top and bottom, with over 1,600 appearances each. As a
178
TRADING SYSTEMS AND METHODS
control, a random, synthetically created price series was also tested and showed only 1∕3 the number of head-and-shoulder formations. It argues that charting patterns are formed by the actions of the participants rather than by random events. Based on the number of stocks tested, the head-and-shoulders formation appeared about once each year for each stock. All but one of the chart formations (the triangular top) showed positive returns for the three days following the identification of the formation. Of these, five were rated as statistically significant: the head-and-shoulders top, the broadening bottom, the rectangular top, the rectangular bottom, and the double top. When formations were conditioned on rising or declining volume, the results changed for some of the patterns. In general, rising volume improved results. Falling volume was better for the head-and-shoulders top, and the rectangular top and bottom. Most analysts would expect rising volume to favor bottom formations and declining volume to improve most top formations; an academic study that contests this concept is likely to be viewed skeptically. On the whole, technical analysts would not be disappointed with the conclusions of this study. Although the chart patterns may not meet the strict definition set by an experienced technician, they did capture the spirit of the formation and showed that positive returns followed. Confirmation is gratifying; any other conclusion would have been ignored. For those not as mathematically gifted, but adept at computer programming, many of these formations can be created using the highs and lows generated from a swing chart, which is easily automated (a program is provided in Chapter 2). A trendline can be found using a least-squares regression through a series of swing highs or lows, qualified by a minimum variance. A triangle would be alternating swing highs and lows that are closer together. It is all within our reach.
BULKOWSKI’S CHART PATTERN RANKINGS A particularly helpful section in Bulkowski’s Encyclopedia of Chart Patterns is the summary at the end, where he ranks all the chart patterns by their success in forecasting price moves. The best five bullish formations are: 1. Upward breakout of a rectangular top 2. Upward breakout from a falling wedge 3. Upward breakout from an ascending triangle 4. Upward breakout from a double bottom 5. Upward breakout of a symmetric triangle after a downward move
For clarity, a rectangular top has multiple tests of a resistance level before the breakout, and a double bottom breaks out when the price goes above the highest price
Charting Systems and Techniques
179
that occurred between the two lows making up the double bottom. The upward breakout of a symmetric triangle formed during a downtrend is typically down and confirms the existing trend. Bulkowski’s study shows that it performs the opposite way, and with high reliability. The best five bearish patterns are 1. Descending scallops 2. Downward breakout of a symmetric triangle in a downtrend 3. Downward breakout of a broadening top 4. Downward breakout of a right-angled, descending, broadening formation 5. Downward breakout of a broadening bottom
Unlike the bullish formation, these seem dominated by broadening formations. For those unfamiliar with the descending scallop, an obscure formation, the scallop looks like a fishhook with the long stem to the left and the hook to the right. Attached to the end of the hook is another hook, also facing to the right, so that there is a series of longer declines and a shorter rounded recovery before another longer decline and rounded recovery. A broadening top shows alternating swings getting larger, a sideways pause during an uptrend. With a right-angled, descending, broadening formation there is a somewhat horizontal top (the right-angle) to the swing highs and a broadening bottom before the downward break. A broadening bottom is similar to a broadening top but occurs during a downward price trend. It is interesting that the broadening formations are more reliable when resolved to the downside. On the other hand, the symmetric triangle is the most dependable chart pattern because it forecasts a reliable price move whether it breaks to the upside or downside.
CHAPTER 5
Event-Driven T rends
T
rends are sustained price moves in one direction. In the previous chapter, an upwards trend was identified by drawing an upwards angling line under the lows of a rising price formation. But that involves a degree of interpretation. There are many other methods for recognizing the trend that are fully systematic. Of these there are two main categories, those that are sensitive to the way price moves over time, and others that ignore time and only concentrate on price level. This chapter will look at the second group. A price trend can be thought of as an accumulation of small and large reactions to news and events. Even in a strong upwards trend, not all of the reactions are positive, but the net effect is a sustained upwards move. Smaller events that cause price movement are the result of frequent, scheduled economic reports, earnings reports by NYSE listed companies, upgrades and downgrades announced by financial institutions, and countless other pieces of information available on the various news media. Larger price moves come in reaction to natural disasters, political coups, unexpected election results, extreme action by a Central Bank, a major production interruption, terrorism, and unexpected corporate or political scandals of far-reaching effect. Each year there seem to be more events that lead to uncertainty and reduced investor confidence. The impact of these material events can be long-term, temporary, or even structural, but they always cause an immediate change in price. Everyday news is filled with reasons for investors to either buy or sell, sometimes offsetting the effects of each other. Most often the result on price movement is small, but occasionally it can be a dramatic price shock. Among the earliest of trading systems are those that signaled a new upwards trend when prices moved higher than they had been for some time. There is no math required, simply the idea that, if prices moved to a new high or new low, then something important has changed. This approach is intuitively sensible and has proved to be a successful strategy. As you progress through this book and become familiar with more complex and mathematically intricate techniques, continually ask yourself to what degree the newer methods have improved on the older, simpler ways of recognizing a trend. We begin the presentation of trading systems with these event-driven trends that ignore time. A fundamental understanding of these methods is essential to every trader. 181
182
TRADING SYSTEMS AND METHODS
SWING TRADING A price swing is a sustained price movement of a predetermined size. An upwards swing ends with a swing high, or peak, and a downward swing ends with a swing low, or valley. The distance from a peak to a valley is the swing. A swing can be small or large, depending on the sensitivity of the swing criterion. A swing is easily seen on a chart. You can choose to plot only the major price moves, or you can fill the chart with the smallest of price reversals. The only requirement is that each swing be greater than a threshold value, expressed in cents or dollars, or as a percentage of the current price of the stock or commodity. This minimum value, called the swing filter, determines the frequency of the swings and therefore the sensitivity of the chart. Figure 5.1 shows a bar chart of gold futures with points above and below the bars representing the swing highs and lows based on a 5% minimum move from highs to low. Figure 5.2 shows the corresponding swing chart. Rather than 7 months of daily bars, there are only 18 points, each a new high or low separated from the previous by 5%. While the distance between these highs and lows can vary considerably on the daily bar chart, they have no time value on the swing chart. As long as prices do not make a new high or low by the swing filter amount, no entry occurs.
Constructing a Classic Swing Chart A classic technique for finding the swing highs and lows uses the following seven steps1 as shown in Figure 5.3. This can be applied to any data frequency, daily, weekly, hourly,
FIGURE 5.1 A bar chart of gold futures with 5% swing points marked. 1 Based on William F. Eng, “A Mechanical Trading System,” Technical Analysis of Stocks & Commodities (July 1986). Further information can be found in Eng, The Technical Analysis of Stocks, Options & Futures (Chicago: Probus, 1988).
183
Event-Driven T rends
Gold 5% Swings 2000 1900 1800 1700 1600 1500 1400 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
FIGURE 5.2 Corresponding swing chart of gold using a 5% swing filter.
or any intraday period; therefore, references to days in the following example could be replaced by weeks or 15-minute bars. In the example below, we use daily data for gold cash prices and a swing threshold of $5 per ounce (not 5% as in the previous illustration). 1. Begin by plotting the high to low of the first day in the first column of the chart. At
this point, we do not know the direction of this swing bar or the trend of gold prices.
FIGURE 5.3 Constructing a classic swing chart.
184
TRADING SYSTEMS AND METHODS
2. Add the second day of data. a. If there is a higher high but not a lower low, then continue the first swing higher
and ignore the low of the day. We can now call this an upswing. b. If there is a lower low but not a higher high, then continue the first swing lower
and ignore the high of the day. This is now a downswing. c. If there is both a new high and a new low (an outside day), then continue the cur-
rent high direction and ignore the low. As we will see later in the explanation of point-and-figure, you may choose the low instead, but this must choice must be consistently applied. d. If the high of the second day is less than the previous high of the column and the
low is greater than the previous low (an inside day), then ignore that day and go to the next day. 3. Once a direction has been established, add the next day’s data. a. If the current swing is up, then i. First look at the new daily high. If the high is higher than the high in the current
column, extend that swing to the new high, ignoring the low. Go to the next day. ii. If the new high is lower than the high of the current column then test for a swing
reversal. If the current swing high minus the low of the new day is greater than the swing filter value, then move one column to the right and plot the range of the new day high to low. The new swing is down. b. If the current swing is down, then i. Look first at the new daily low. If the low is lower than the low in the current
column, extend that swing down to the new low and ignore the high. Go to the next day. ii. If the new low is higher than the low of the current column, then test for a
swing reversal. If the high of the new day minus the low of the current column is greater than the swing filter value, then move one column to the right and plot the range of the new day from high to low. The swing is now up. 4. A new price that does not make a new high or low and does not exceed the swing
reversal threshold is ignored. This particular method, once the most popular, is called a 2-day or 2-period technique because it requires only two periods to identify a swing change. The sensitivity of the swing chart can be reduced by requiring that a swing change only occur after three or more days where prices reverse their direction.
CONSTRUCTING A SWING CHART USING A SWING FILTER A very popular way of creating a swing chart uses a swing filter to define the sensitivity of the swings. The swing filter can be a value per share or a percentage of the current or
Event-Driven T rends
185
average share price. The following example uses cents per share. The basic eight rules for creating this swing chart are: 1. Select a stock or futures market and decide your chart sensitivity. For a stock with
an average price of about $18, we select a swing filter of 75¢, about 4%. 2. Plot the first bar or day from the high to the low as a vertical line in the first column
of the swing chart. The top of the bar is now called the swing high and the bottom is the swing low. Assume that prices are in an upswing. If the assumption is wrong, the chart will correct itself soon. 3. Move to the next day or, if intraday, move to the next bar. 4. If prices are in an upswing, continue with Step 5, otherwise go to Step 7. 5. Prices are in an upswing, and the high of the new day is higher than the current swing
high. Extend the line higher, staying in the same column, to the point of the new high. Because prices are in an upswing, the lows of the bar are ignored. 6. Prices are in an upswing, and the high of the current bar is not higher than the cur-
rent swing high. Look at the low price. If the swing high minus the current low is less than the swing filter of 75¢, then ignore this new price data. If the swing high minus the current bar low is equal to or greater than the swing filter, then move one column to the right and draw a new vertical line starting at the previous swing high and extending down to the current bar low. Connect the top of the previous bar to the top of the current bar. Continue with Step 3. 7. Prices are in a downswing, and the low of the new day is lower than the current
swing low. Extend the line lower, staying in the same column, to the point of the new low. Because prices are in a downswing, ignore the highs of the bar. 8. Prices are in a downswing, and the low of the current bar is not lower than the cur-
rent swing low, then look at the high. If the current high minus the swing low is less than the swing filter of 75¢, then ignore the new data. If the current bar high minus the swing low is equal to or greater than the swing filter, then move one column to the right and draw a new vertical line starting at the previous swing low and extending upwards to the current bar high. Connect the bottom of the previous bar to the bottom of the current bar. Continue with Step 3.
S&P Example A good example that shows the construction of a swing chart can be seen using the S&P index, SPX, from October 1, 2010, through November 4, 2010, 25 days, shown in Figure 5.4. On the left in Table 5.1 are the high, low, and closing daily prices of the index, and on the right is the action taken. The gray areas represent the five swings identified during this period. The swing filter will be 20 big points. Starting on day 1, the chart is initialized using the high and low of the day, 1150.30 and 1139.42. On day 2 there is no new high, and the low is 18.43 points below the previous
186
TRADING SYSTEMS AND METHODS
11/4/2010
11/2/2010
10/31/2010
10/29/2010
10/27/2010
10/25/2010
10/23/2010
10/21/2010
10/19/2010
10/17/2010
10/15/2010
10/13/2010
10/9/2010
10/11/2010
10/7/2010
10/5/2010
10/3/2010
1240.00 1220.00 1200.00 1180.00 1160.00 1140.00 1120.00 1100.00 1080.00
10/1/2010
SPX Bar Chart
FIGURE 5.4 Classic bar chart showing SPX with gaps representing weekends (or any holiday).
TABLE 5.1 Day-by-Day Construction of a Swing Chart SPX Prices Date
Reversal of 20 points
High
Low
Close
Day
Action
10/1/2010 10/4/2010 10/5/2010 10/6/2010 10/7/2010 10/8/2010 10/11/2010 10/12/2010 10/13/2010 10/14/2010 10/15/2010 10/18/2010 10/19/2010
1150.30 1148.16 1162.76 1162.33 1163.87 1167.73 1168.68 1172.58 1184.38 1178.89 1181.20 1185.53 1178.64
1139.42 1131.87 1140.68 1154.85 1151.41 1155.58 1162.02 1155.71 1171.32 1166.71 1167.12 1174.55 1159.71
1146.24 1137.03 1160.75 1159.97 1158.06 1165.15 1165.32 1169.77 1178.10 1173.81 1176.19 1184.71 1165.90
1 2 3 4 5 6 7 8 9 10 11 12 13
Initialize Rev day New high Rev day New high New high New high New high New high Rev day Inside day New high Rev day
10/20/2010 10/21/2010 10/22/2010 10/25/2010 10/26/2010 10/27/2010
1182.94 1189.43 1183.93 1196.14 1187.11 1183.84
1166.74 1171.17 1178.99 1184.74 1177.72 1171.70
1178.17 1180.26 1183.08 1185.62 1185.64 1182.45
14 15 16 17 18 19
Rev day New high Rev day New high Rev day Rev day
10/28/2010
1189.53
1177.10
1183.78
20
Rev up
10/29/2010
1185.46
1179.70
1183.26
21
Inside day
11/1/2010 11/2/2010 11/3/2010 11/4/2010
1195.81 1195.88 1198.30 1221.25
1177.65 1187.86 1183.56 1198.34
1184.38 1193.57 1197.96 1221.06
22 23 24 25
Rev up New high New high New high
Price
Points
18.43 1162.76 7.91 1163.87 1167.87 1168.68 1172.58 1184.38 17.67 1185.53 25.82 23.23 1189.43 10.44 1196.14 18.42 24.44 17.83 24.11 1195.88 1198.30 1221.25
187
Event-Driven T rends
1221.25
1196.14 1185.53
1172
1159.71
1139.42
FIGURE 5.5 Swing chart of SPX.
high; therefore, the reversal criterion is not reached, and we continue with the next day. On day 3 there is a new high that establishes an upswing. On day 4 there is no new high, and the low indicates a reversal from the high of 7.91 points, far less than the amount needed to change the swing direction. This process is continued until day 13. On day 13, the swing high is 1185.53, and the new low is 1159.71, 25.82 points, triggering a new downswing. On a chart, we move one column to the right, as seen in Figure 5.5. On day 14, there is another reversal of 23.23 points from the low of the previous day to the high of day 14, and large enough to change to an upswing. Then the first swing took 12 days to complete, and the second swing lasted only one day. The swing chart corresponding to the SPX bar chart is shown in Figure 5.5. The extreme values of each swing are shown at the top and bottom of each swing. Note that there are only five columns in the swing chart, compared to 25 days in the bar chart. The swing chart ignores time; instead, it gives a schematic view of price movement, where the only relevant information are new swing highs and lows. A different view of the swing chart construction is given in Figure 5.6. In this chart, the boxes are filled with the date on which the price moved into that box. It adds a little more information. Using this form of recording swing moves, it is possible to see the origins of point-and-figure charting, which will be explained in the next section.
Percentage Swings The swing filter, which determines the swing high and low points, can be more robust if it is expressed as a percentage of price rather than as a fixed dollar per share or point value. Many markets have doubled in value—or halved—or both—over the past 10 years.
188
TRADING SYSTEMS AND METHODS
Price swings Price Up Down Up Down 1220 1215 1210 1205 1200 17 19 1195 17 19 1190 13 15 19 1185 12 13 14 19 1180 8 13 14 19 1175 8 13 14 1170 8 13 14 1165 6 13 14 1160 3 1155 3 1150 1 1145 1 1140 1 1135 1 1130
Up 25 25 25 25 25 22 22 22 22 22
FIGURE 5.6 Recording swings by putting the dates in the first box penetrated by the price.
During quiet market periods, stocks will split, causing the new share price, and the volatility, to be significantly lower than the day before. Using a fixed value for finding the swing highs and lows will cause the swing chart to be insensitive to price movement at low prices and to show frequent changes in swings at higher prices. The swing filter, expressed as a percentage p, avoids this problem. Minimum swing value
MSVt = p × pricet
This variable swing filter helps to keep the sensitivity of the swings the same over a long period, which is very helpful for backtesting of results and for more consistent trading signals. The only complication is that the minimum swing value may change daily, although gradually, and that requires you to be aware of the new value. It is always best to use the previous day’s value, MSV Vt−1, rather than today’s value, in order to be sure that you are not cheating by looking ahead one day.
Rules for Swing Trading Each vertical line on a swing chart, that is, each swing, represents a price trend. There are two sets of rules commonly used that enter positions in the trend direction: 1. (Conservative) Buy when the high of the current upswing exceeds the high of the
previous upswing. Sell when the low of the current downswing falls below the low of the previous downswing.
Event-Driven T rends
189
2. (Active) Buy as soon as a new upswing is recognized. Sell when a new downswing
is recognized. Both of these occur the first time there is a reversal greater than the swing filter. An example of a buy signal can be seen in Figure 5.5, the SPX swing chart. The first swing peaked at 1185.53 before reversing to a short-term low of 1159.71. The next upswing moved above the old high; therefore, a buy order would have been placed at 1185.54, and a long position would have been entered. The end of the chart shows a high of 1221.25 which followed the swing low of 1172. If prices were to start down and penetrate that low, the long position would be exited.
The Swing Philosophy The primary advantage of a swing method, and most event-driven trend systems, is that no action occurs if prices move sideways. We will see in the next two chapters that a trend recalculated on each bar, such as a moving average, has an agenda. That is, prices must continue to advance if the trend is to remain intact. In a swing philosophy, prices can move sideways or stand still within a trend. Prices can move up and down in any pattern as long as they do not violate the previous swing highs (if in a downtrend) or swing lows (if in an uptrend). This characteristic of event-driven systems makes them very robust at a cost of higher risk. Risk will be measured as the difference between the entry point of a trade (the price at which the old swing high or low was penetrated) and the price at which a reverse trade would be entered. This risk can be as small as a swing reversal or much larger if prices move quickly without any intermediate reversals. A significant benefit of the swing method is that it can signal a new trade at the moment of a significant event. If the news is a surprise to the market and prices move out of their current trading levels to new highs or new lows, the swing method will signal a new trade. This immediate response is a very positive feature for most traders, who want to act in a timely manner. It is very different from trend systems that use moving average or other time series calculations, which have lags. The following systems are simple variations of the swing method of charting.
The Livermore System Known as the greatest trader on Wall Street, Jesse Livermore was associated with every major move in both stocks and commodities during the 30-year period from 1910 to 1940. Livermore began his career as a board boy, marking prices on the high slate boards that surrounded the New York Stock Exchange floor. During this time, he began to notice the distinct patterns in the price movement that appeared in the columns of numbers.2 As 2
Edwin Lefèvre, Reminiscences of a Stock Operatorr (Burlington, VT: Books of Wall Street, 1980). First published by George H. Doran, 1923.
190
TRADING SYSTEMS AND METHODS
FIGURE 5.7 Livermore’s trend change rules.
Livermore developed his trading skills and eventually took his position as a professional trader, he maintained the habit of writing prices in columns headed Secondary Rally, Natural Rally, Up Trend, Down Trend, Natural Reaction, and Secondary Reaction. This may have been the basis for what is now a swing chart. Livermore’s approach to swing trading required two filters, a larger swing filterr and a penetration filterr of one-half the size of the swing filter. Penetrations were significant at price levels he called pivot points. A pivot point is defined in retrospect as the top and bottom of each new swing; the pivot points are marked with letters in Figure 5.7.3 Pivot points remain a popular way of identifying relative highs and lows. Livermore’s trading technique is a unique interpretation of the swing chart. Positions are taken only in the direction of the major trend. A major uptrend is defined by confirming higher highs and higher lows, and a major downtrend by lower lows and lower highs, and where the penetration filterr (swing filter) is not broken in the reverse direction. That is, an uptrend is still intact as long as prices do not decline below the previous pivot point by as much as the amount of the penetration filter (seen in Figure 5.7). Once the trend is identified, positions are added each time a new penetration occurs, confirming the trend direction. A stop-loss is placed at the point of penetration beyond the prior pivot point. Unfortunately, Livermore never revealed how the penetration point was calculated. It seems, however, to be a percentage (for example, 20%) of the current swing size.
3
Jesse Thompson, “The Livermore System,’’ Technical Analysis of Stocks & Commodities (May 1983).
Event-Driven T rends
191
FIGURE 5.8 Failed reversal in the Livermore method.
Failed Reversal In the Livermore system, the first penetration of the stop-loss (a swing high or low depending on the direction of the trade) calls for liquidation of the current position. A second penetration is necessary to confirm the new trend. If the second penetration fails (at point K in Figure 5.8), it is considered a secondary reaction within the old trend. The downtrend may be reentered at a distance of the swing filter below K K, guaranteeing that point K is defined, and again on the next swing, following pivot point M M, when prices reach the penetration level below pivot point L. It is easier to reenter an old trend than to establish a position in a new one.
Programming the Swing High and Low Points The swing method can be programmed in strategy development software or Excel. The good part about specialized software is that the points can be shown on a price chart to give visual confirmation, as seen in Figure 5.1. The indicator TSM Swing can be found on the Companion Website along with the Excel spreadsheet that does the same calculations.
Keltner’s Minor Trend Rule One of the classic trading systems is the Minor Trend Rule published by Keltner in his book, How to Make Money in Commodities. For many years it was followed closely by a great part of the agricultural community and should be understood for its simplicity and potential impact on markets. In today’s high-tech environment, it is important to remember that many trading decision are still made using simple tools.
192
TRADING SYSTEMS AND METHODS
Keltner defines an upward trend by the failure to make new lows (comparing today’s low with the prior day) and a downtrend by the absence of new highs. This notion is consistent with chart interpretation of trendlines by measuring upward moves along the bottom and downward moves along the tops. The Minor Trend Rule is a plan for using the daily trend as a trading guide. The rule states that the minor trend turns up when the daily trend trades above its most recent high; the minor trend stays up until the daily trend trades below its most recent low, when it is considered to have turned down. In order to trade using the Minor Trend Rule, buy when the minor trend turns up and sell when the minor trend turns down; always reverse the position. The Minor Trend Rule is a simple short-term trading tool, buying on new highs and selling on new lows with risk varying according to volatility. It is a breakout method in the style of swing trading and is the basis for a number of current technical systems that vary the time period over which prior highs and lows are established and consequently increase the interval between trades and the risk of each trade. An advantage of the Keltner approach is that, as with swing trading, it imposes no arbitrary restrictions on the size of the price move, such as a breakout of 100 points.
Pivot Points A pivot point is the high or low point of a reversal, but a much weaker condition than a swing point. It could be the center point of 3 trading days, or 5 days, or more. A 5-day pivot point means that there are 2 days on each side of the local high or low price. It also means that a 5-day pivot point has a 3-day lag because you cannot identify it until the close of the third day (the second day after the high or low point). Pivot points will be used in strategies throughout this book.
Wilder’s Swing Index Although Wilder called this the Swing Index, it is a combination of daily range measurements with trading signals generated using pivot points. However, it is clearly an eventdriven method. It was presented with trading rules in Wilder’s Swing Index System.4 Wilder determined that the five most important positive patterns in an uptrend are: 1. Today’s close is higher than the prior close. 2. Today’s close is higher than today’s open. 3. Today’s high is greater than the prior close. 4. Today’s low is greater than the prior close. 5. The prior close was above the prior open. 4
J. Welles Wilder, Jr., New Concepts in Technical Trading Systems (Greensboro, NC: Trend Research, 1978).
193
Event-Driven T rends
In a downtrend, these patterns are reversed. The Swing Index, SI, I combines these five factors, then scales the resulting value to fall between +1 and –1.
⎛ (C Ct SI t = 50 × ⎜ t ⎝ where
1
0 5 (Ct Ot ) + 0.25 0 25 (Ct ) + 0.5
Ot
1
) ⎞⎟ × ⎠
TR Rt
K M
K = the largest of H t Ct−1 and Lt Ct−1 M = the value of a limit move (more about this below) TR = the true range
True range is calculated from the following two steps (note that this is the same true range as commonly used, however, step 2 requires that you know which of the three combinations was largest): 1. First, determine which is the largest of a. H t
Ct−1
b. Lt
Ct−1
c. H t − Lt 2. Calculate R according to the corresponding formula, using (a) if the largest in step 1
was (a), or using (b) or (c), depending on which one of those was the largest in step 1. a. R
H t − Ct −1
Lt − Ctt−1
Ct
− Ot−1
b. R
Lt − Ct−1
H t − Ctt−1
Ct
− Ot−1
c. R
H t − Lt
Ct
1
− Ot−1
The SII calculation uses three price relationships: the net price direction (close-toclose), the strength of today’s trading (open-to-close), and the memory of yesterday’s strength (prior open-to-close). It then uses the additional factor of volatility as a percentage of the maximum possible move ((K/M M). The rest of the formula simply scales the results to within the range of +1 to –1. Updating the Swing Index In today’s market, M M, the limit move, is a problem. When Wilder developed this method, all markets had limit moves, that is, trading halted when prices moved to a maximum daily price change as determined by the exchange. That is no longer the case. With some markets, trading is temporarily halted when prices move to a preset limit, but after a few minutes trading begins again. For those markets, there is no clear value for M M; however, that is easily resolved. The function of M is used only to scale the index into the range +1 to –1. If we choose an arbitrary value, larger than the normal daily move, the results will be fine. Because the trading rules use only the relative highs and lows of the index, rather
194
TRADING SYSTEMS AND METHODS
FIGURE 5.9 Wilder’s Swing Index applied to Eurobund continuous futures, using TradeStation modified code.
than thresholds such as 0.90, the results will be the same, regardless of the choice of M. M In these examples M = 100. Figure 5.9 shows the daily prices for the Eurobund futures along with the values of the Swing Index for the last few months of 2010 and the beginning of 2011. SII switches from a positive bias at the beginning of the chart to a negative one as prices turn from bullish to bearish. These calculations are given in the spreadsheet, TSM Wilder Swing Index, found on the Companion Website. The Swing Index is also a built-in indicator and function in TradeStation; however, the code requires that the limit move be preset with each market. Instead, the program TSM Wilder Swing Index, provided on the Companion Website, allows you to input that value as, for example, 100. Trading Rules The daily SIIt values are added together to form an Accumulated Swing Index x (ASII), ASIIt = ASIIt−1 + SIIt which is substituted for the price and used to generate trading signals, allowing ready identification of the significant highs and lows as well as clear application of Wilder’s trading rules. The terms used in the trading rules are: HSP, High swing point—Any day on which the ASII is higher than both the previous and the following day. LSP, Low swing point—Any day on which the ASII is lower than both the previous and the following day. SAR, Stop and reverse points (three types)—Index — SAR points generated by the ASII calculation, SAR points applied to a specific price, and Trailing Index SAR, which lags 60 ASII points behind the best ASII value during a trade.
Event-Driven T rends
195
The Swing Index System rules are: 1. Initial entry: a. Enter a new long position when the ASIIt crosses above HSPt−2. b. Enter a new short position when the ASIIt crosses below LSPt−2.
Note that HSP and LSP cannot be identified until two days after it occurs. 2. Setting the SAR point: a. On entering a new long trade, the SAR is the most recent LSP; the SAR is reset to
the first LSP P following each new HSP. A trailing SAR is determined as the lowest daily low occurring between the highest HSP P and the close of the day on which the ASII dropped 60 points or more. b. On entering a new short trade, the SAR is the most recent HSP; the SAR is reset
to the first HSP P following each new LSP. The trailing SAR is determined as the highest daily high occurring between the lowest LSP P and the close of the day on which the ASII rose by 60 points or more. The program TSM Accumulated Swing Index x can be found on the Companion Website.
POINT-AND-FIGURE CHARTING There does not appear to be any record of which came first, swing charting or point-andfigure charting. Both methods are very similar; however, point-and-figure has developed a much more extensive following. Point-and-figure charting is credited to Charles Dow, who is said to have used it just prior to the turn of the twentieth century. It has three important characteristics: 1. It has simple, well-defined trading rules. 2. It ignores price reversals that are below a minimum price move as determined by the
box size. 3. It has no time factor (it is event-driven). As long as prices fail to change direction by
the reversal value, the trend is intact. When point-and-figure charting first appeared, it did not contain the familiar boxes of X Xs and Os. The earliest book containing the subject is reported to be The Game in Wall Street and How to Play it Successfully, published by Hoyle (not Edmond Hoyle, the English writer) in 1898. The first definitive work on the subject was by Victor De Villiers, who in 1933 published The Point and Figure Method of Anticipating Stock Price Movement. De Villiers worked with Owen Taylor to publish and promote a weekly point-and-figure service, maintaining their own charts; he was impressed by the simple, scientific methodology. As with many of the original technical systems, the application
196
TRADING SYSTEMS AND METHODS
FIGURE 5.10 Point-and-figure chart.
was intended for the stock market, and the rules required the use of every price change appearing on the ticker. It has also been highly popular among futures traders in the grain and livestock pits of Chicago. The rationale for a purely technical system has been told many times, but an original source is often refreshing. De Villiers said:5 The Method takes for granted: 1. That the price of a stock at any given time is its correct valuation up to the instant of purchase and sales (a) by the consensus of opinion of all buyers and sellers in the world and (b) by the verdict of all the forces governing the laws of supply and demand. 2. That the last price of a stock reflects or crystalizes everything known about or bearing on it from its first sale on the Exchange (or prior), up to that time. 3. That those who know more about it than the observer cannot conceal their future intentions regarding it. Their plans will be revealed in time by the stock’s subsequent action. The unique aspect of the point-and-figure and swing methods is that they ignore the passage of time The point-and-figure chart differs from the swing chart in that each column representing an upswing is a series of boxes containing X Xs, and each downswing is shown as a string of Os (Figure 5.10), and a mark is not placed unless a minimum price change occurs. The original figure charts were traditionally plotted on graph paper with square boxes, and only dots, or the exact price, were written in each box. The chart evolved to have prices written on the left scale of the paper, where each box represented a 5
Victor De Villiers, The Point and Figure Method of Anticipating Stock Price Movements (1933; reprint New York: Trader Press, 1966), 8.
Event-Driven T rends
197
minimum price move. Some point-and-figure chartists then used a combination of Xs X and occasional digits (usually 0s and 5s every five boxes) to help keep track of the length of a move. In some cases the top of an upswing column was connected to the start of a downswing in the next column with a crossbar, and the bottom of a downswing column was connected to the beginning of the next upswing column. This gave the point-and-figure chart an appearance similar to the swing chart. Charts using 1, 3, and 5 points per box were popular, where each point represented a minimum price move. In the 5-point method, no entry was recorded unless the price change spanned 5 points. Point-and-figure charts, which were commonly used on the floor of the Chicago Mercantile Exchange and the Chicago Board of Trade up to the late 1990s, are intended to show the greatest detail. Each box represents the minimum allowable price move, and reversals of direction use the traditional 3-box criteria. Floor traders use the charts to show only the short-term price moves, and leave a lot to the interpretation of patterns.
Plotting Prices Using the Point-and-Figure Method To plot prices on a point-and-figure chart, start with a piece of square-box graph paper and mark the left scale using a conveniently small price increment. For example, each box may be set at $0.25 for Microsoft, $0.50 for IBM, 5.0 points for S&P 500 index, $1 for gold and platinum, 4/32 for 30-year bond futures, 1¢ for soybeans and silver, and so forth (as in Figure 5.10). The choice of a box size will make the chart more or less sensitive to changes in price direction as will be seen in later examples. The smaller the box size, the more changes in direction will be seen. This also corresponds to longer and shorter trends or major and minor trends. Therefore, a point-and-figure chartist looking for a long-term price movement will use a larger box size. Box sizes are often related to the current volatility of the markets. Once the graph paper has been scaled and the prices entered along the left side, the chartist can begin. The first box is entered with the current closing price of the market. If the price of silver is 852.50 and a 1¢ (1¢ = 1.00) box is being used, a mark is placed in the box beside the value 852. An X or an O is used to indicate that the current price trend is up or down, respectively. Either an X or O may be used to begin—after that, it will be determined by the method. The rules for plotting point-and-figure charts are easily shown as a flowchart in Figure 5.11. Preference is given to price movements that continue in the direction of the current trend. Therefore, if the trend is up (represented by a column of X Xs), the new high price is tested first; if the trend is down, the low price is given preference. The opposite price is checked only if the new price fails to increase the length of the column in the direction of the current trend. The traditional point-and-figure method calls for the use of a 3-box reversal, that is, the price must reverse direction by an amount that fills 3 boxes from the most extreme box of the last column before a new column can begin (it actually must fill the fourth box because the extreme box is left blank). The importance of keeping the 3-box
198
TRADING SYSTEMS AND METHODS
FIGURE 5.11 Point-and-figure daily rules.
reversal has long been questioned by experienced point-and-figure traders. It should be noted that the net reversal amount (the box size times the number of boxes in the reversal) is the critical value. For example, a 5-point box for the NASDAQ 100 ETF (QQQ) with a 3-box reversal means that QQQ prices must reverse from the lows of the current downtrend by 15 points to indicate that an uptrend has started. The opposite combination, a 3-point box and a 5-box reversal, would signal a new trend at the same time, after a 15-point reversal. The difference between the two choices is that the smaller box size would recognize a smaller continuation of a price move by filling more boxes. Ultimately, the smaller box size will capture more of the price move; it is considered the preferable alternative. The choice of box size and reversal boxes will be considered later in more detail.
Event-Driven T rends
199
Painless Point-and-Figure Charts There are a number of graphic charting and quote systems that allow a simple bar chart to be converted to point-and-figure automatically. It is still necessary to specify the box size and the reversal size. The reason for showing the construction in detail is that none of these services provide trading signals or performance results based on point-andfigure charting. For that, it will be necessary to code the instructions into a spreadsheet or a strategy development platform.
Point-and-Figure Chart Formations It would be impossible for the average speculator to follow the original method of recording every change in price. When applied to stocks, these charts became so lengthy and covered so much paper that they were unwieldy and made interpretation difficult. In 1965, Robert E. Davis published Profit and Profitability, a point-and-figure study that detailed eight unique buy and sell signals. The study covered two stocks for the years 1914–1964, and 1100 stocks for 1954–1964. The intention was to find specific bull and bear formations that were more reliable than others. The study concluded that the best buy signal was an ascending triple top and the best sell signal was the breakout of a triple bottom, both shown in Figure 5.12 and with the other patterns studied in Figure 5.13. Plotted using daily data, futures prices do not offer the variety of formations available in the stock market. The small number of markets and the high correlation of movement between many of the index and interest rate markets make the limitations of signal selection impractical. Instead, the most basic approach is used, where a buy signal occurs when an X in the current column is one box above the highest X in the last column of X Xs, and the simple sell signal is an O plotted below the lowest O of the last descending column. The flexibility of the system lies in the size of the box; the smaller the size, the more sensitive the chart will be to price moves. In 1933, Wyckoff noted that it was advisable to use a chart with a different box size when the price of the stock varied substantially.6
FIGURE 5.12 Best formations from Davis’s study.
6
Richard D. Wyckoff, Stock Market Technique, Number One (New York: Wyckoff, 1933), 89.
200
TRADING SYSTEMS AND METHODS
(a)
(b)
FIGURE GURE 5.13 (a) Compound Co pou d point-and-fi po t a d gu gure e buy signals. s g a s (b) Co Compound pou d point-and-fi po t a d gure gu e sell signals.
201
Event-Driven T rends
FIGURE 5.14 Point-and-figure trendlines.
Point-and-Figure Trendlines Bullish and bearish trendlines are commonly used with point-and-figure charts. The top or bottom box that remains blank when a reversal occurs can form the beginning of a descending or ascending pattern at a 45° angle (diagonally through the corners of the boxes, providing the graph paper has square boxes). These 45° lines represent the major anticipated trends of the market. Once a top or bottom has been identified, a 45° line can be drawn down and to the right from the upper corner of the top boxes of Xs, or up and towards the right from the bottom of the lowest box of Os (Figure 5.14). X These trendlines are used to confirm the direction of price movement and are often used to filter the basic point-and-figure trading signals so that only long positions are taken when the 45° trendline is up and only shorts sales are entered when the trendline is down. More Point-and-Figure Studies In 1970, Charles C. Thiel, Jr., with Robert E. Davis, completed the first purely futures market point-and-figure study7 that calculated profitability of a reasonably large sample of markets by varying both the value of a box and the reversal criteria. With the standard 3-box reversal and only simple buy and sell formations, the tests showed 799 signals, of which 53% were profitable; the average net profit on all trades was $311 realized in approximately 50 days. The period studied was 1960 through 1969. In the mid-1970s, Zieg and Kaufman8 performed a computerized study using the same rules but limiting the test period to six months ending May 1974, an extremely active
7 Charles Thiel and R. E. Davis, Point and Figure Commodity Trading: A Computer Evaluation (West Lafayette, IN: Dunn & Hargitt, 1970). 8 Kermit C. Zieg, Jr., and Perry J. Kaufman, Point and Figure Commodity Trading Techniques (Larchmont, NY: Investors Intelligence, 1975). This book contains complete tabularized results of both point-and-figure tests.
202
TRADING SYSTEMS AND METHODS
market period. For the 22 commodities tested, 375 signals showed 40% of the trades were profitable; the net profit over all the trades was $306 and the average duration was 12.4 days. It is interesting to note that the most significant difference in the results of the two studies is in the average length of a trade, from 50 in the Thiel and Davis study to 12.4 days in the Zieg and Kaufman tests, indicating a change apparently induced by more volatile markets. Although the two tests varied in many of the details, the results are a strong argument for the consistency of the point-and-figure method as a trading tool. In its current role, point-and-figure differs from traditional charting because it provides a rigid set of trading rules. Many of the formations are still subject to interpretation and are frequently used that way by floor traders. For the more systematic trader, it will tell exactly what penetration of a resistance or support level is necessary to generate a buy or sell signal and exactly where the stop-loss order should be placed to limit risk. It is this well-defined nature of point-and-figure charting that allows computer testing and evaluation. A complete study of the point-and-figure method includes rules of charting, buy and sell signals, trendlines, geometric formations, and price objectives. A discussion of these features can be found in Chapter 3. They apply equally to point-and-figure charting. They have also been covered effectively in a book by Cohen and another by Zieg and Kaufman.9 The following sections cover more advanced point-and-figure topics, including its relationship to bar charting, alternate plotting rules, risk-limited trading, and varying box size. Point-and-Figure Box Size The box size used in a point-and-figure chart determines the sensitivity, or frequency of signals. The selection of the box size is critical to successful trading. For many years Chartcraft (Investors Intelligence) was the only major service that produced a full set of point-and-figure charts for the futures markets. A history of their box sizes is shown in Table 5.2. There are now a number of services providing these charts, and they can easily be found by searching the Internet for “point-and-figure charts.” Since the 1970s, every traded commodity has had at least one major price move taking it to levels often greater than twice the normal price. Sugar and silver each topped at 10 times their value in 1970. By 2000 many technology stocks had surged 20 times their 1990 value only to retreat by as much as 90% in the next few years. These moves necessitate changes in box size in order to control the impact of the increased, and later decreased, volatility. Table 5.3 shows the performance of the point-and-figure method from 2000 through 2010 for a selection of widely traded futures markets. These were created using the program TSM Point & Figure, available on the Companion Website. When testing these 9 A.
W. Cohen, How To Use the Three-Point Reversal Method of Point and Figure Stock Market Trading (Larchmont, NY: Chartcraft, 1972); and Kermit C. Zieg and Perry J. Kaufman, Point & Figure Commodity Trading Techniques (Larchmont, NY: Chartcraft, 1975).
203
Event-Driven T rends
TABLE 5.2 Point-and-Figure Box Sizes* Prior to 1975† Futures Market
Units
Year
Box Size
1975‡ Box Size
1977‡ Box Size
1977§ Box Size
1986‡ Box Size
2002–2003 Box Size
2 1 10 500 20 2
2
1 1 5 100 10 1
2 ½ 4¼ 200 20 1.5
20 20 20
10 40 75
10 100 50 100 100 10
2
Grains
Corn Oats Soybeans Soybean meal Soybean oil Wheat
cents cents cents pts pts cents
1971 1965 1971 1964 1965 1964
½ ½ 1 50 10 1
2 1 10 500 20 2
5
2
Livestock and Meats
Live cattle Live hogs Pork bellies
pts pts pts
1967 1968 1965
20 20 20
20 20 20
20 20 20
Other Agricultural Products
Cocoa¶ Coffee Cotton Lumber Orange juice Sugar
pts pts pts pts pts pts
1964
1968 1965
20 (20)† (20)† (100)† 20 5
100 100 100 100 20 20
100 100 100 100 100 20
50 50
100 100 200 200
50
20
90 170 100 16
Metals
Copper Gold Platinum Silver
pts pts pts pts
1964
20
1968 1971
200 100
100 50 100 200
200 400
50 400 400 1000
100 200 150
*All box sizes use a 3-box reversal and are in points (decimal fractions treated as whole numbers) unless otherwise indicated. †Cohen
(1972); parentheses indicate approximate values.
‡Courtesy §Chart
of Chartcraft Commodity Service, Chartcraft, Inc., Larchmont, New York.
Analysis Limited, Bishopgate, London. Values are for long-term continuation charts.
¶Cocoa
contract changed from cents/pound to dollars/ton.
markets, the first problem that surfaces is that each market needs its unique box size. For example, soybeans trading at $15/bushel will need a box size smaller than the DAX, trading at 6000. The box size reflects a sensitively to volatility during the period of the test data. To solve that problem as simply as possible, the box sizes were initialized to a percentage of the price at the beginning of the test. These centered around 1%, so that gold at $1000/oz would have a box size of $10. All gold signals used the $10 box size and a
204
46420 –39220
22460
–31900
–46300
6640
–19020
0.3
0.2
0.1
–27060
0.6
0.4
30770
0.7
0.5
32520
0.8
9620
13160
6060
20820
31090
25630
2310
–3920
–15288
–48988
18913
22263
–21313
888
–8888
11760
17290
–6380
21830
16360
22820
31980
20890
710
–9260
–6350
–9120
2840
14580
7240
14360
Bund
2400
12225
–6875
33020
19980
16080
12480
–2860
–740
9820
7175 –54538
0 –56163
0 –55688
0 –42388
–82870
–56268
–48313
–61828
–57464
–23822
–40110
–60955
–60967
–82555
–97297
22920
14340
12020
33300
–95848
–86684
–71665
–65814
23880 –118335
120
2500
1250 –13020 –1363
0 –40763
0 –46500
–55797
–10580
–22142
25513
–9213
–25863
–48463
–76950
–50163
–90025
–57213
–66838
–9175
–5150
–3488
–11725
–1263
–31538
–14363
14100
–9563
14413
–925
–27340
–23160
–25310
–14380
–5540
–16020
15010
–350
–12890
–24410
–43535
–29150
–29685
–21130
–1215
–21930
–13985
–11730
–2165
4895
16031
–4063
17813
16188
22766
1016
2078
1828
–9609
–1328
16
–1766
–2953
8328
24766
13953
34672
16484
19641
15700 –10438
14400
12875
–3950
–5575
–11325
1925
–7000
–22025
–12550
–5275
–18000
8000
10900
8650
9700
18275
650
11150
–8725
–7663
2750
–1013
2538
10063
3063
–10375
24500
16188
31063
26663
25788
20838
13350
20825
–2375
52500 –14963
60688 –24475
10875
23313 –15113
33688
2719
20219 –13225
49563 –13363
17156
–3438 –26688
26156 –32750
2906 –32288
14813 –28813
–5188 –26200
Heating Japanese Soy- 10-Year 30-Year Oil Yen NASDAQ beans Notes Bonds Wheat
25300 –122653
0 –41250 –15280
0 –37300
0 –20000
0 –25850
3450
11975 –24610
0 –11500
Gold
–6838 –10200
S&P
0 –11325
Eurodollars
55525 –19500 8012.5 –44638
51250 –17960
34075
9000
50988
47263
90063
–15975 111700
–16375 117800
0.9
–6700
46420 –33535 175338 107063
87410
1.0
92313 119838
–13150 –53080 105950 128650
1.1
89125
1.2
74125
88325
6860 –53445 123688 105038
26410 –42895
1.4
–4738
42425 104875
89763
74875
74600
54538
EUR
1.3
–34170 –47705
1.5
–9840 –45610 133513
–28630 –67010
1.7
1.6
–42370 –44990 186225
80800
–10510 –22970
1.8
31450
DAX
1.9
Cotton
3540 –12540
Crude Oil
Net Profits for the Point-and-Figure Method Initial box sizes range from 0.10% to 2.0% for a selection of futures markets, 2000–2010. Negative results are in grey, and the best results for each market are outlined.
2.0
Box (%)
TABLE 5.3a
205
285
175
0.8
0.1
141
0.9
277
139
1.0
273
117
1.1
0.2
109
1.2
0.3
91
1.3
255
79
1.4
227
83
1.5
0.4
69
1.6
0.5
65
1.7
195
71
1.8
225
61
1.9
0.6
53
2.0
0.7
Crude Oil
Box (%)
290
290
268
228
198
174
150
116
100
100
88
82
67
63
57
59
51
51
47
41
Cotton
546
520
470
418
394
358
314
276
236
188
168
152
134
126
120
106
90
80
76
74
DAX
293
275
231
186
129
101
65
49
37
33
27
23
23
19
17
11
11
11
7
9
EUR
285
187
103
61
38
26
18
14
10
10
6
8
6
6
4
2
2
2
Bund
8
4
Eurodollars
299
283
241
189
149
117
79
65
61
55
47
39
37
27
23
23
23
17
19
17
S&P
282
278
250
208
192
184
162
154
142
125
112
100
92
82
73
71
64
69
51
53
Gold
297
297
297
273
275
241
229
199
183
163
145
135
111
99
91
81
79
67
59
59
Heating Oil
293
247
179
127
92
60
50
38
32
22
20
14
14
10
12
10
6
8
4
4
Japanese Yen
TABLE 5.3b The Number of Trades Associated with the Performance in Table 5.3a
293
287
261
235
187
157
107
97
79
69
67
51
47
41
29
33
27
21
19
17
NASDAQ
307
309
309
325
325
319
307
303
313
297
273
267
251
245
231
225
221
209
203
193
Soybeans
294
239
172
120
78
52
48
38
32
24
20
18
14
14
14
8
6
4
6
4
10-Year Notes
297
289
267
217
169
130
102
76
66
54
44
42
32
24
22
24
16
18
16
16
30-Year Bonds
285
251
199
167
135
111
97
83
61
55
45
41
41
35
33
31
29
23
21
17
Wheat
206
TRADING SYSTEMS AND METHODS
3-box reversal for a total directional reversal of $30. In Table 5.3a, all negative net profits are shaded in grey, and the best results for each market are outlined. Results show inconsistency. The more trending markets, the interest rates and the euro, are generally profitable for all box sizes. The noisier markets, primarily the equity index markets, show consistent losing results. Eurodollar interest rates show few trades because a percentage of the price at 99.00 is far too big for a box size. To get the right box size, the series would need to be converted to yields. The same is true of the longer-term rates, even though both 10-year notes and 30-year bonds showed good returns. The grains were also inconsistent, with soybeans showing too many trades (see Table 5.3b) while wheat appears normal. This reflects the volatility of the individual markets. Even during this 10-year test, the volatility of each market would have changed considerably. Systems that are event driven, such as swings, point-and-figure, and breakouts, are not bothered by low volatility for moderate periods of time. They typically hold the same position until something new happens. However, if at the start of the test the volatility was much lower than at the end, there will be few trades at the beginning and much more at the end. Results will be distorted, with greater importance given to the more volatile periods. It seems reasonable to conclude that the change in price and, consequently, the change in volatility determine the most practical choice of box size. As an example, if we look at the best choice of box size for a selection of stocks and industrial groups for 2003, we get the results shown in Table 5.4. These are plotted as a scatter diagram in Figure5.14. They show a clear relationship between price level and box size. We will use this pattern to create a more dynamic point-and-figure chart. Rules for varying box sizes and risks associated with these price and volatility changes are discussed later in the section, “Point-and-Figure with Variable Box Size.”
TABLE 5.4 Point-and-Figure Box Sizes—Stocks and Sectors 2003 Market
Box Size
AMZN AMR AOL GE IBM INTC MRK XOM Aerospace Biotech Large banks Life Insurance Semiconductors
13 38 6 25 143 80 162 50 17.5 15 8 22 1.6
Average Price
25 20 13.5 27 72 17.5 52 34 1,800 700 1,000 1,450 300
207
Event-Driven T rends
Point-and-Figure Trading Techniques The basic point-and-figure trading signals are triggered on new highs and new lows: Buy when the filled column of X Xs, the current upswing, rises above the previous column of X Xs by one box. Sell when the filled column of Os, the current downswing, falls below the low of the previous column of Os by one box. Using the basic rules, you are always in the market, reversing from long to short and from short to long, unless you only trade stocks from the long side. There are alternate methods for selecting point-and-figure entry and exit points that have become popular. Buying or selling on a pullback after an initial point-and-figure signal is one of the more common system entries because it can limit risk and still maintain a logical stop-loss point. Of course, there are fewer opportunities to trade when only small risk is allowed, and there is a proportionately greater chance that the trade will be stopped out because the entry and exit points are close together. There are three approaches recommended for entering on limited risk: 1. Wait for a reversal back to within an acceptable risk, then buy or sell immediately
with the normal point-and-figure stop. Figure 5.15 shows various levels of risk in IBM with $2.00 boxes. The initial buy signal is at $150, with the simple sell signal for liquidation at $134, giving a risk of $16 per share. Instead of buying as prices reach new highs, wait for a reversal after the buy signal, then buy when the low for the day penetrates the box corresponding to your acceptable level of risk. Three possibilities are shown in Figure 5.16. Buying into a declining market assumes that the support level (at $134 in this example) will hold, preventing the stop-loss level from being reached. To increase confidence, the base of the formation should be as broad as possible. The test of a 80
Average Share Price
70 60 50 40 30 20 10 0 0
50
100
150
200
Box Size (points)
FIGURE 5.15 Point-and-figure box sizes are larger when prices are higher or volatility is greater.
208
TRADING SYSTEMS AND METHODS
Price 160 158 156 154 152 150 148 146 144 142 140 138 136 134
o o o o o o o o o o o
x x x x x x x
o o o o o o o o
x x x x x x
o o o o o o
x x x x x x x
0)
y
y
b>1
–1 < b < 0 b = –1 b < –1
b–1 0 0)
y
y
(b b < 0)
a
ae
a/e
a 0
/b
x 0 1/b y = ac bxx orr ln y = ln a + bx ln c (c)
x (d)
FIGURE 6.10 Logarithmic and exponential curves. Source:: Cuthbert Daniel and Fred S. Wood, Fitting Equations to Data: Computer Analysis of Multifactor Data, 2nd ed. (New York: John Wiley & Sons, 1980), 20, 21. Reprinted with permission of John Wiley & Sons, Inc.
257
Regression Analysis
TABLE 6.7 Log and Exponential Values for Corn and Soybeans Soybeans Corn (log) (exp)
x y y
1.00 0.54 0.84
2.00 0.94 1.02
3.00 1.30 1.24
4.00 1.64 1.50
5.00 1.96 1.83
6.00 2.26 2.22
7.00 2.56 2.70
volatile at higher levels. The curve that bends down (0 < b < 1 in Figure 6.10a) is typical of volatility measured over increasing time intervals. Each of these forms can be easily transformed into linear relationships and solved using the method of least squares. This will allow you to fool the computer into solving a nonlinear problem using a linear regression tool. To solve the logarithmic relationship, substitute ln x for x, ln a for a, and ln y for y. Instead of using a column of x-values in the spreadsheet, create a new column that has the values ln x. Create another column with ln y. Now solve the regression using ln x and ln y instead of x and y. When completed, you will have the value of b, but you will also have ln a instead of a. The value of ln a must be raised to the power of e to restore the original value of a, a = (ln a)e. The Excel function for the power of e is exp. Once you have the values a and b, the logarithmic approximation can be calculated and plotted. The significant difference in the log and exponential transformations is that the value of x is not scaled for the exponential. Taking the original corn and soybean data and performing the natural log functions ln for both log and exponential approximations results in the linear form that can be solved using least squares. Returning to the simpler cornsoybean example, selected results are shown in Table 6.7.
EVALUATION OF TWO-VARIABLE TECHNIQUES Of the three curve-fitting techniques, the curvilinear and exponential results are very similar, both curving upward and passing through the main cluster of data points at about the same incline. The log approximation curves downward after passing through the main group of data points at about the same place as the other approximations. To evaluate objectively whether any of the nonlinear methods are a better fit than the linear approximation, find the standard deviation of the errors, which gives a statistical measurement of how close the fitted line comes to the original data points. The results show that the curvilinear is best; the logarithmic, which curves downward, is noticeably the worst (see Figure 6.11). When we display system performance based on a fixed investment size, it is necessary to show the results on a log scale to be realistic; otherwise, the investment must change each day based on returns. Similarly, volatility looks more uniform over time when shown on a log scale. The use of regression analysis for forecasting the price of soybeans alone had a different conclusion. Although 27 years were used, the last 10 showed a noticeable increase in soybean prices. This rising pattern is best fitted by the curvilinear and exponential models. However, these curves show price forecasts that continue to rise at an increasing rate. Had inflation maintained its double-digit rate, these forecasts would still lead
258
P
TRADING SYSTEMS AND METHODS
FIGURE 6.11 Least-squares approximation for soybeans using linear, curvilinear, logarithmic, and exponential models.
to unrealistically high prices. The logarithmic model, which tends to flatten at the top, turned out to be the most realistic. This shows that the problem of forecasting is more complex than this naive solution. Common sense tells us that prices cannot continue to accelerate upwards. The logarithmic model, which showed the worst statistical results, provided the best forecast. The logarithmic model is similar to the square root technique that is commonly used to estimate volatility of longer time intervals using shorter interval data, as was shown in the section of Chapter 2 called “Risk and Volatility.” To avoid using the wrong solution, most analysts carefully track the major economic factors, such as interest rates, inflation, and the value of the U.S. dollar. The model must be reestimated whenever these factors change or whenever there is new data that may result in a more accurate solution. They may use a rolling calculation interval, dropping off the oldest data and adding the most recent. They may also use multivariate approximations, discussed in the next section, which evaluate more than one independent, or causal, variables.
Direct Relationships The price at which a commodity or stock trades is often dependent upon the prices of other competitive or substitute products. This can be seen for stocks where two
259
Regression Analysis
pharmaceutical companies provide the same product (such as the cholesterol drugs Lipitor and Zocor), and for airlines vying for passengers on the same route. The ability to substitute one product for another creates an opportunity for arbitrage. In general, if two physical products provide the same function, they should sell at the same price, net of transaction costs, which can include carrying charges, shipping, inspection, and commissions. These relationships are watched carefully when they move apart by more than the transaction costs; traders step in quickly to buy the cheaper one and sell short the more expensive one, causing prices to come back into alignment. In the equities markets this is the basis for pairs trading. In commodities, arbitrageurs keep the futures and cash prices together; they continually prevent the price of gold in New York, London, and Hong Kong from drifting apart. For interest rate markets, “strips” serve the purpose of preventing the large pool of 3-month rates, 5- and 10-year notes, and 30-year bonds from offering widely different returns when they revert to the same maturity. The Interbank market provides the same stability for foreign exchange markets, and the soybean crush, energy crack, and other processing margins do not stay out of line for long. Competition will keep the prices of Lipitor and Zocor together, and the addition of a generic substitute will cause all three to realign. The following nonfinancial markets have close relationships that can be found using regression analysis. Commodity Product Relationships
Reason
All crops Grains Livestock and feedgrains All livestock Sugar and corn Hogs and pork bellies
Income for farmers based on per acre yields Protein value used for feed Cost of feed affects the cost of livestock Consumer purchases influenced by price Commercial sweetener substitution Product dependency: bacon prices depend on hog prices
Silver, gold, and platinum Interest rates and stock markets
Investor’s inflation hedge Investors continually choose between stocks and interest rates
Interest rates and foreign exchange
Investors worldwide move money to seek the best returns and protect against inflation
MULTIVARIATE APPROXIMATIONS Regression analysis is most often used in complex economic models to find the combination of two or more independent variables that best explain or forecast prices. A simple application of annual production and distribution of soybeans will determine whether these factors are significant in determining the price of soybeans. Because the demand for soybeans and its products is complex, we should not expect a very accurate model using only two independent variables. However, the method of solution is the same when you add other factors. The first example will use a small sample of data, shown
260
TRADING SYSTEMS AND METHODS
in Table 6.8; at the end of this section the same method will be applied to wheat using a much longer set of data. Applying the method of least squares which was used for a simple linear regression, the equation for two independent variables is y = a0 + a1 x1 + a2 x2 where
y = the resulting price, in this case soybeans x1 = the total production (supply) x2 = the total distribution (demand) a0, a1, a2 = constants, or weighting factors, to be calculated
As in the linear approximation, the solution to this problem will be found by minimizing the sum of the squares of the errors at each point, where yˆ i is the approximation for the ith data item, and yi is the actual price. N
∑( y
S
i
− yi
i =1
)2
Substituting yˆ from the previous equation, N
∑( y − (a
S
+a x +a x
i
i =1
))
2
The solution to the multivariate problem of two independent variables x1 and x2 requires the following three least-squares equations: a0 N + a1
∑x
1
a0
∑x
1
a1
∑x
a0
∑x
2
a1
∑x x
2 1
+ a2
+ a2
1 2
∑x = ∑y 2
∑x x ∑x y
+ a2
1 2
1
∑x ∑x y 2 2
2
The procedure for solving the three simultaneous equations is the same as the curvilinear method of coefficient elimination. The sums are calculated in Table 6.8, then substituted into the last three equations: 12.00a0 + 13.546a1 + 12.58a2 = 44.4 13.55a0 + 15.980a1 + 14.75a2 = 53.28 12.58a0 + 14.756a1 + 13.86a2 = 49.264
261
Regression Analysis
TABLE 6.8 Totals for Multivariate Solution Soybeans
y
1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 Σ
1 2 3 4 5 6 7 8 9 10 11 12
Supply
Demand
x1
x2
2
2
x1
(Billions)
x2
x1x2
(Billions)
x1y
x2y
(Millions)
2.67 2.88 2.98 2.93 2.69 2.63 2.63 3.08 3.24 6.22 6.12 6.33
0.700 0.845 0.928 0.976 1.107 1.133 1.127 1.176 1.271 1.547 1.215 1.521
0.677 0.738 0.839 0.874 0.900 0.946 1.230 1.258 1.202 1.283 1.435 1.200
0.490 0.714 0.861 0.953 1.225 1.284 1.270 1.383 1.615 2.393 1.476 2.313
0.458 0.545 0.704 0.764 0.810 0.895 1.513 1.583 1.445 1.646 2.059 1.440
0.474 0.624 0.779 0.853 0.996 1.072 1.386 1.479 1.528 1.985 1.744 1.825
1.869 2.434 2.765 2.860 2.978 2.980 2.964 3.622 4.118 9.622 7.436 9.628
1.808 2.125 2.500 2.561 2.421 2.488 3.235 3.875 3.894 7.980 8.782 7.596
44.40
13.546
12.582
15.977
13.862
14.745
53.276
49.265
The coefficient matrix solution is4 ⎛ 12.00 13.55 12.58 44.40 ⎞ ⎜ 13.55 15.98 14.74 53.28 ⎟ ⎜ ⎟ ⎜⎝ 12.558 14.74 13.86 49.26 ⎟⎠ ⎛ 1 1.239 1.048 3.700 ⎞ ⎜ 0 .6798 .5451 3.145 ⎟ ⎜ ⎟ ⎜⎝ 0 .5451 .6720 2.714 ⎟⎠ ⎛ 1 0 .1429 −1.5240 ⎞ ⎜ 0 1 .8018 4.6264 ⎟ ⎜ ⎟ ⎜⎝ 0 0 .2349 .1922 ⎟⎠ ⎛1 0 0 1.641⎞ ⎜ 0 1 0 3.9703 ⎟ ⎜ ⎟ ⎜⎝ 0 0 1 .8183 ⎟⎠
4
Matrix elimination is the necessary solution to the multivariate problem. Appendix 2 contains the computer programs necessary to perform its operation.
262
TRADING SYSTEMS AND METHODS
The results show a0 = –1.641, a1 = 3.9703, and a2 = 0.8183, so that the multiple linear approximation of the price is yˆ Where
1.641 + 3.9703 x1 + 0.8183 x2
x1 = the production of soybeans in billions of bushels x2 = demand in billions of bushels
The coefficient of supply is much larger than the coefficient of demand; therefore it is the principal factor in the determination of price. Had either coefficient of x1 or x2 been small, it would have indicated a lack of significance. The selection of which data to use when determining price components is not always obvious and may result in a number of small coefficients. In this example, supply-and-demand figures were used to determine price, but perhaps supply and inflation or demand and inflation would have been better. Further, this method will always give an answer, even when the choice of data is erroneous. To find out which sets of data are best, each combination would have to be tested and the variance of the estimated values compared with the actual prices. The best fit and the best choice should be the one with the smallest variance, provided you have used sensible inputs. As with the least-squares and polynomial solutions, user-friendly software as well as fully programmable platforms are available. This makes solutions available to everyone. If we look at a longer set of data for wheat, available from the Commodity Research Bureau Yearbook (published annually by John Wiley & Sons), we can take the supply as World Production and calculate the demand by subtracting the Ending Stocks from the Production, giving us Usage. Finally, the cash price in Chicago is selected as the value to be forecast. The data was available from 1971 to 2000, but only the first few years are shown in Table 6.9. The full spreadsheet and the forecasted results are available on the Companion Website as Wheat supply and demand.
TABLE 6.9 The First Few Years of Wheat Data Used for the Multivariate Solution, along with the Forecasted Price Crop Year
1970–1971 1971–1972 1972–1973 1973–1974 1974–1975 1975–1976 1976–1977 1977–1978 1978–1979
World Production
306.5 344.1 337.5 361.3 355.2 352.6 414.3 377.8 438.9
Ending Stocks
80.5 89.2 74.9 82.4 81.4 86.7 127.4 109.2 134.8
Usage
Chicago Cash
Forecast
226 254.9 262.6 278.9 273.8 265.9 286.9 268.6 304.1
1.33 1.34 1.73 3.95 4.09 3.55 2.73 2.33 2.97
2.42 2.71 3.02 3.15 3.09 2.91 2.64 2.63 2.78
263
Regression Analysis
Multivariate Solution for Wheat 5 4 3.5 3
Chicago Cash
2.5
Forecast
2
2000–2001
1998–1999
1996–1997
1994–1995
1990–1991
1992–1993
1986–1987
1988–1989
1984–1985
1982–1983
1980–1981
1978–1979
1976–1977
1974–1975
1
1972–1973
1.5 1970–1971
Wheat Price ($/bu)
4.5
FIGURE 6.12 Multivariate solution for wheat.
The solution to the equation Cash pricei = a0 + a1 × production + a2 × usage gives a0 = 0.290926, a1 = –0.01399, and a2 = 0.028385. A chart of the forecast values compared to the actual cash prices is shown in Figure 6.12. The forecast is reasonably close to the cash prices, moving in the same direction most years but with generally lower volatility. Perhaps a better estimate of world demand, rather than relying on final U.S. stocks, would make this more accurate, then an estimate of supply and demand would result in a reasonably good estimate of the price. Recently, neural networks and genetic algorithms have been used to find solutions to complex problems of supply and demand. Both have the advantage of providing a nonlinear solution. That is, the multivariate answer to the soybean problem says that the effect of supply is always four times greater than the effect of demand; but the neural net solution may qualify that answer by giving a larger weight to supply during years when supply is threatened by bad weather. Both genetic algorithms and neural nets are discussed in Chapter 20.
Selecting Data for an S&P Model The stock market is driven by a healthy economy and lower interest rates. A good economy means that there is high employment and consumers are actively buying homes, durable goods, services, and frivolous items with their disposable income. Low interest rates increase corporate profitability by reducing the cost of debt and provide lower mortgages for homeowners. Economic growth and controlled inflation are delicately orchestrated by the central bank of each country; in the United States, it is the Federal Reserve.
264
TRADING SYSTEMS AND METHODS
To create a robust S&P model, one that explains the change in S&P prices using economic data, it is necessary to select the most meaningful data. The following was suggested by Lincoln5 to be used for a 6-month S&P forecast:6 • S&P prices, the closing prices of the Standard & Poor’s S&P 500 cash index. • Corporate bonds/Treasury bonds, the BAA corporate bond yield divided by the 30-year Treasury bond yield, normalized by subtracting the historical mean. • Annual change in the U.S. dollar, the 12-month change in the dollar, minus 1, which might be based on the Dollar Index traded on the New York Futures Exchange (discussed in Chapter 2), or a weighting of major currencies. • Annual change in federal funds rate, the 12-month change in the fed funds rate, minus 1. • Federal funds rate/Discount rate, the Fed funds rate divided by the discount rate, normalized by subtracting the historical mean. • Money supply, M1 money supply, not seasonally adjusted. • Annual Consumer Price Index, the 12-month change in the CPI, minus 1. • Inflation/Disinflation index, the annualized 1-month change in the CPI divided by the 12-month change in the CPI, minus 1. • Leading economic indicators, the 12-month change in the leading economic indicators, minus 1. • One-month versus 10-month oscillator for the S&P cash index, the difference between the monthly average and the past 10 months, approximately 200 days. • Inflation-adjusted commercial loans, the inflation-adjusted 12-month growth in commercial loans. Lincoln used 20 years of monthly values to forecast the S&P price six months ahead. Some of this data is available on a weekly basis and might be adapted to a shorter time frame; however, it is unreasonable to think that an accurate daily forecast is possible using weekly or monthly data. It is also likely that the use of more frequent S&P price data is inconsistent with the monthly statistics and will introduce more noise and make the results less reliable. One element that is missing from the 11 items listed is a volatility adjustment. There has been a 600% increase in the S&P price over 20 years and volatility is clearly much higher. A simple percentage relationship may not describe this change adequately, but may be used until a better one is found. Therefore, those items that become more or less volatile as prices move higher and lower must be corrected using a volatility-normalizing factor. For example, if we consider the initial volatility when the S&P was 100 at the beginning of the data as normal, then when the price is 1400 we divide the current volatility by 5
Thomas H. Lincoln, “Time Series Forecasting: ARMAX,” Technical Analysis of Stocks & Commodities (September 1991). 6 Note that the “minus 1” in the data list refers to the calculation of returns, final value divided by starting value, minus 1.
265
Regression Analysis
14 to normalize, or use some volatility stabilization adjustment. This type of adjustment would apply to nearly all the items except money supply and the inflation/disinflation index. Remember that, where applicable, yields must always be used for interest rates, not prices.
Generalized Multivariate Solution In general, the relationship between n independent variables is expressed as y = a0 + a1 x1 + a2 x2 + + an xn The solution to this equation is the natural extension of the problem in two and three variables. The n + 1 equations in n + 1 variables are created by summing the n + 1 equations developed from the general equation by multiplying the second equation by x1, the third by x2, and so on: a0 n + a1
∑x
1
a1
∑x
2
a1
a0 a0
∑x
1
∑x
2 1
+ a2
∑x x
1 2
+ a2
∑x
2
+
+ an
∑x x
an
∑x
an
+ a2
1 2 2 2
∑x = ∑y n
∑x x = ∑x y 1
n
∑x x = ∑x y 2
n
a0
∑x
n
a1
∑x x
1 n
+ a2
∑x x
2 n
an
∑x = ∑x 2 n
ny
It is not practical to solve this system of equations manually, but it can be done quickly using a single program found in a math software library such as IMSL, ProStat, MatLab, or even using Excel matrix functions (see a more detailed example in Appendix 2). Those with only a little experience in regression analysis should remember that the model is most accurate within the range of the data points; when projecting outside the bounds of the sample data, the predictive qualities of the regression formula decrease with time. It is most likely that a good solution will be found for interest rates and grain prices, which are trading at the same levels as previous years, but may not be reliable for index markets or gold that have made erratic new highs over the years. Many dependent variables (xi) may be used to increase the possibility of finding a good fit. The predictive quality of this solution will depend on the relevance of the independent variables. It is best to start with the obvious components of a time series, such as inflation, then add standard economic statistics, including the Consumer Price Index and Industrial Product, as well as supply and demand information specific to the market being evaluated. For both grain and energy markets, the accumulation of inventory, or stocks, is a strong influence on price; these factors also have an expected
266
TRADING SYSTEMS AND METHODS
seasonal variation, which is represented in terms of an index of adjustment. Using monthly data means that you must have a strong tolerance for risk because even the best models do not account for the price fluctuations during the month. Measuring the error of the estimates will help determine whether additional factors are necessary. When done, look at the values of a. Those that are very small should be discarded. The fewer inputs the better.
Least-Squares Sinusoidal When you know that there is a seasonal or cyclic pattern to price movement, you can use the trigonometric functions, sine and cosine, as a special case of multiple linear equations. Observing periodic peaks and valleys in a price series suggests that a cyclic pattern may be present. One of the more well-known uses of cyclic analysis was performed by Hurst in The Profit Magic of Stock Transaction Timing, in which there is an interesting example of Fourier analysis applied to the Dow Jones Industrial Averages. A full discussion of cyclic analysis and trigonometric estimations can be found in Chapter 11. The equation for the approximation of a periodic movement is yt = a0 + a1t + a2
2π t 2π t + a3 siin + a4 t P P
2π t 2π t + a5 t sin P P
which is a special case of the generalized multivariate approximation y = a0 + a1 x1 + a2 x2 + a3 x3 + a4 x4 + a5 x5 where
P = the number of data points in each cycle x1 = t, the incremental time element x2 = cos(2π t / P ), a cyclic element x3 = sin(2π t / P ), a cyclic element x4 = t s(2π t / P ), an amplitude-variation element x5 = t sin(2π t / P ), an amplitude-variation element
The number of data points, P, in each cycle would be 12 if you were calculating seasonality using monthly data. If you believe that there is a cycle, then you can find the average number of data points between major price peaks. The term a1t will allow for the linear tendencies of the sequence. The term 2π refers to an entire cycle and 2πt/P is a section (1/P /P) of a specific cycle t; this in turn adds weight to either the sine or cosine functions at different points within a cycle. The solution is calculated in the tabular manner of the other methods, using simultaneous linear equations derived in the same way as the generalized multivariate equation, substituting from the table of sums and solving the coefficient matrix for a0, . . . ,a5 using the techniques in Appendix 2.
267
Regression Analysis
ARIMA An Autoregressive Integrated Moving Average (ARIMA ( ) model is created by a process of repeated regression analysis over a moving time window, resulting in a forecast value based on the new fit. An ARIMA process automatically applies the most important features of regression analysis in a preset order and continues to reanalyze results until an optimum set of parameters or coefficients is found. In Chapter 21, the selection and testing of individual parameters within a trading strategy are discussed. This involves approximating their initial value and identifying a testing range. An ARIMA model does all of this as part of its special process. Because it is used to recalculate the best fit each time a new piece of data appears, it may be thought of as an adaptive process. G. E. P. Box and G. M. Jenkins refined ARIMA at the University of Wisconsin,7 and their procedures for solution have become the industry standard. This technique is often referred to as the Box-Jenkins forecast. The two important terms in ARIMA are autoregression and moving average. Autoregression refers to the use of the same data to selfpredict, for example, using only gold prices to arrive at a gold price forecast. Moving average refers to the normal concept of smoothing price fluctuations, using a rolling average of the past n days. The moving average and popular variations are discussed thoroughly in Chapters 7 and 8. This process uses an exponential smoothing technique, which is convenient for computation. In the ARIMA process, the autocorrelation is used to determine to what extent past prices will forecast future prices. In a first-order autocorrelation, only the prices on the previous day are used to determine the forecast. This would be expressed as pt = a × pt where
1
+e
pt = the price being forecast (dependent variable) pt−1 = the price being used to forecast (independent variable) a = the coefficient (constant factor) e = the forecast error
In a second-order autoregression, the previous two prices are used, pt = a × pt
1
+ a2 × pt
2
+e
where the current forecast pt is based on the two previous prices pt−1 and pt−2; there are two unique coefficients and a forecast error. The moving average is used to correct for
7
G.E.P. Box and G.M. Jenkins, Time Series Analysis: Forecasting and Control, 2nd ed. (San Francisco: Holden-Day, 1976).
268
TRADING SYSTEMS AND METHODS
the forecast error, e. There is also the choice of a first- or second-order moving average process,
where
First-order:
Et
et − bet −1
Second-order:
Et
et − b1 et
1
− b et − 2
Et = the approximated error term et = today’s forecast error et–1 and et–2 = the two previous forecast errors b1 and b2 = the two regression coefficients
Because the two constant coefficients, b1 and b2, can be considered percentages, the moving average process is similar to exponential smoothing. The success of the ARIMA model is determined by two factors: high correlation in the autoregression and low variance in the final forecast errors. The determination of whether to use a first- or second-order autoregression is based on a comparison of the correlation coefficients of the two regressions. If there is little improvement using the second-order process, it is not used. The final forecast is constructed by adding the moving average term, which approximates the errors, back into the autoregressive process p′t′ = pt + Et + e ′ where
pt′ = the new forecast e′ = the new forecast error
The moving average process is again repeated for the new errors e′, added back into the forecast to get a new value p″″ and another error e″. When the variance of the errors becomes sufficiently small, the ARIMA process is complete. The contribution of Box and Jenkins was to stress the simplicity of the solution. They determined that the autoregression and moving average steps could be limited to first- or second-order processes. To do this, it was first necessary to detrend the data, thereby making it stationary. Detrending can be accomplished most easily by differencing the data, creating a new series by subtracting each previous term pt–1 from the next pt. Of course, the ARIMA program must remember all of these changes, or transformations, in order to restore the final forecast to the proper price notation by applying these operations in reverse. If a satisfactory solution is not found in the Box-Jenkins process, it is usually because the data are still not stationary and further differencing is necessary. With the three features just discussed, the Box-Jenkins forecast is usually shown as ARIMA ((p, d, q), where p is the number of autoregressive terms, d is the number of differences, and q is the number of moving average terms. The expression ARIMA (0,1,1)
269
Regression Analysis
is equivalent to simple exponential smoothing, a common technique discussed in the next chapter. In its normal form, the Box-Jenkins ARIMA process performs the following steps: 1. Specification. Preliminary steps for determining the order of the autoregression
and moving average to be used: • The variance must be stabilized. In many price series, increased volatility is directly related to increased price. In stocks, the common assumption is that this relationship is log-normal, that increasing volatility takes the shape of a logarithmic curve. A simple test for variance stability, using the log function, is checked before more complex transformations are used. • Prices are detrended. This uses the technique of first differences; however, a second difference (or more) will be performed if it helps to remove further trending properties in the series (this is determined by later steps). • Specify the order of the autoregressive and moving average components. This fixes the number of prior terms to be used in these approximations (not necessarily the same number). In the Box-Jenkins approach, these numbers should be as small as possible; often one value is used for both. Large numbers require a rapidly expanding amount of calculation, even for a computer. The number of terms is a critical part of the ARIMA solution. The object of this last step is to find the fewest terms necessary to solve the problem. All ARIMA programs will print a correlogram, a display of the autocorrelation coefficients. The correlogram is used to find whether all the trends and well-defined periodic movements have been removed from the series by differencing. Figure 6.13 shows the output from ProStat for 15 lags using the
0.03 0.02
Correlation
0.01 0 –0.01 –0.02 –0.03 –0.04 –0.05 –0.06 –0.07
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Lags
FIGURE 6.13 ARIMA correlograms from autocorrelations. Lags shown along the bottom give correlations at the left. None of them are significant (output from ProStat based on gold futures).
270
TRADING SYSTEMS AND METHODS
first differences of 20 years of gold futures prices. If any of the correlations had been significant (for example, over 0.40), the data would be differenced again. The correlogram is one way of visualizing serial correlation, the dependence of current data on previous data. This same objective will be accomplished differently using a Monte Carlo process to estimate investment risk, discussed in Chapter 23. 2. Estimation: determining the coefficients. The previous step was used to reduce the number of autoregressive and moving average terms necessary to the estimation process. The ARIMA method of solution is one of minimizing the errors in the forecast. In minimization, it will perform a linear or nonlinear regression on price (depending on the number of coefficients selected), determine the errors in the estimation, and then approximate those errors using a moving average. It will next look at the resulting new error series, attempt to estimate and correct the errors in that one, and repeat the process until it cannot improve results further. To determine when an ARIMA process is completed, three tests are performed at the end of each estimation pass: 1. Compare the change in the coefficient value. If the last estimation has caused little
or no change in the value of the coefficient(s), the model has successfully converged to a solution. 2. Compare the sum of the squares of the error. If the error value is small or if it stays
relatively unchanged, the process is completed. 3. Perform a set number of estimations. Unless a maximum number of estimations is
set, an ARIMA process might continue indefinitely. This safety check is necessary in the event the model is not converging to a solution. Once completed, the errors can be examined using an O-statistic to check for any trend. If one exists, an additional moving average term may be used to eliminate it.
Forecast Results Once the coefficients have been determined, they are used to calculate the forecast value. These forecasts are most accurate for the next day and should be used with less confidence for subsequent days (see Figure 6.14). What if the forecast does not work? First, the process should be checked to be certain that it was performed properly. Be sure that any data transformations were reversed. Pay particular attention to the removal of trends using the correlogram. Next, check the data used in the process. If the data sample is changing (which can be observed on a price chart), select either a shorter or longer period that contains more homogeneous data, that is, data similar to the current market period.
271
Regression Analysis
FIGURE 6.14 ARIMA forecast becomes less accurate as it is used further ahead.
ARIMA Trading Strategies In the article that originally piqued the interest of traders,8 Anon uses a 5-day-ahead forecast. If the ARIMA process forecasts an uptrend and prices fall below the forecast value, the market can be bought with added confidence (expecting lower risk and more profit by buying at a price that is below estimated value). This technique of selecting better entry points may compensate for some of the inaccuracies latent in any forecasting method. The danger of this approach is that prices may continue to move counter to the forecast. Following the Trend Use the 1-day-ahead forecast to determine the trend position. Hold a long position if the forecast is for higher prices, and take a short position if the process is expecting lower prices. Mean-Reverting Indicator Use the ARIMA confidence bands to determine overbought/oversold levels. Not only can a long position be entered when prices penetrate the lowest 95% confidence band, but they can be closed out when they return to the normal 50% level. Although mean reversion trades are tempting, they always carry more risk than trend trading. A conservative trader will enter the market only in the direction of the ARIMA trend forecast. As shown in Figure 6.14, if the trend is up, only the penetrations of a lower confidence band will be used to enter new long positions.
8
Louis J. Anon, “Catch Short-Term Profits with ARIMA,” Commodities Magazine (December 1981).
272
TRADING SYSTEMS AND METHODS
Use of Highs and Lows The implied highs and lows, as well as the independently forecasted highs and lows, can be the basis for other interesting strategies.9 The following two are used with intraday prices. 1. Using confidence bands based on the closing prices, buy an intraday penetration of the
expected high or sell short a penetration of the expected low, and liquidate the position on the close. Use a stop-loss. Take positions only in the direction of the ARIMA trend. 2. Using the separate ARIMA models based on the daily high and low prices, buy a
penetration of the 50% level of the high and sell a penetration of the 50% level of the lows. Liquidate positions on the close. Use a stop-loss. Slope The 1-day-ahead forecast suggested in “Following the Trend” a few paragraphs earlier is essentially a projection of the slope of the trendline. The purpose of directional analysis, whether regression or moving averages, is to uncover the true direction of prices by discarding the noise. Therefore, the slope of the trendline, or the direction of the regression forecast, is the logical answer. The popular alternate for triggering a new directional signal is a price penetration of an envelope or band value. Using regression analysis, that band can be replaced by a confidence level. While it is true that the number of random, or false, penetrations declines as the confidence band gets farther away from the trendline, so does the total number of penetrations. At any band distance, there are still a large number of erroneous signals. The slope itself should be viewed as the best approximation of direction.
Kalman Filters Kalman offers an alternative approach to ARIMA, allowing an underlying forecasting model (message model) to be combined with other timely information (observation model). The message model may be any trading strategy, moving average, or regression approach. The observation model may be the specialist’s or floor broker’s opening calls, market liquidity, or earlier trading activity in the same stock or index market on a foreign exchange—all of which have been determined to good candidate inputs for forecasting. Assume that the original forecast (message) model can be described as
( )
M pt = c f pt
+ met
and the observation model as
( )
O pt = c pt + oet where me and oe are the message and observation model errors, respectively 9
John F. Kepka, “Trading with ARIMA Forecasts,” Technical Analysis of Stocks & Commodities (August 1985).
273
Regression Analysis
The combined forecast would then use the observation model error to modify the result pt′+ = c f pt′ + K t +1 oet where K is the Kalman gain coefficient,10 a factor that adjusts the error term.
BASIC TRADING SIGNALS USING A LINEAR REGRESSION MODEL A linear regression, or straight-line fit, could be the basis for a simple trading strategy similar to a moving average. For example, an n-day linear regression, applied to the closing prices, can produce a 1-day-ahead forecast price, Ft+1, a projection of the slope. We can use this with the following rules for trading: • Buy when tomorrow’s closing price (C Ct+1) moves above the forecasted value of tomorrow’s close (F (Ft+1). • Sell short when tomorrow’s closing price (C Ct+1) moves below the forecasted value of tomorrow’s close (F (Ft+1).11
Adding Confidence Bands Because the linear regression line passes through the center of price movement during a steady period of rising or falling prices, these rules would produce a lot of buy and sell signals. To reduce the frequency of signals and avoid changes of direction due to market noise, confidence bands are drawn on either side of the regression line. A 90% confidence band is simply 1.65 times the standard deviation of the residuals ((Rt, the difference between the actual prices and the corresponding value on the regression line as of time t, the most recent price). A 95% confidence band uses a multiplier of 1.96; however, most people use 2.0 simply for convenience. The new trading rules using a 95% confidence band would then become • Buy when tomorrow’s closing price (C Ct+1) moves above the forecasted value of tomorrow’s close (F (Ft+1) + (2.0 × Rt). • Sell short when tomorrow’s closing price (C Ct+1) moves below the forecasted value of tomorrow’s close (F (Ft+1) – (2.0 × Rt). An important difference between a model based on linear regression and one founded on a moving average is the lag. Both methods assume that prices will continue to move according to the pattern identified using the last price data available. If prices continue 10
For a more complete discussion, see Andrew D. Seidel and Philip D. Ginsberg, Commodities Trading (Englewood Cliffs, NJ: Prentice-Hall, 1983), or R. E. Kalman, “A New Approach to Linear Filtering and Prediction Problems,” Journal of Basic Engineering (March 1960). 11 These rules were used by Frank Hochheimer and Richard Vaughn in Computerized Trading Techniques 1982 (New York: Merrill Lynch Commodities, 1982).
274
TRADING SYSTEMS AND METHODS
Regression at time 3
Confidence bands Linear regression L sell signal
Regression at time 2
Moving average M sell signal
Moving average
Regression at time 1
FIGURE 6.15 Linear regression model. Penetration of the confidence band turns the trend from up to down. When prices move steadily up, the regression model will signal a change of direction faster than a moving average.
higher at the same rate, a moving average system will initially lag behind, then increase at the same rate. The lag creates a safety zone to absorb some minor changes in the direction of prices without indicating that the trend has changed. (See Chapter 7 for a complete discussion of moving averages, and Chapter 8 for a comparison of a linear regression slope trading system with five other popular trending methods.) A regression model, however, identifies a change of direction sooner by measuring tomorrow’s actual price against the projected future price (a straight-line projection for a linear regression). Confidence bands around the straight-line projection will decide the size of the price move up or down needed to change the trend direction. Figure 6.15 shows the changing direction of a rolling linear regression at three points in time compared to a moving average. At the most recent period on the chart the reversal point for the trend direction is much closer using the confidence bands of the regression than the lagged moving average. This may not be the case during the intervals where price changes direction at the bottom of the chart. The Companion Website has a spreadsheet, Bund regression with bands, that produces trading signals and performance using regression bands. It also compares the results with the slope method described in the next section. In general, the use of regression lines works well for finding the price trend, although actual trading signals differ from moving average and breakout strategies. As with most trending systems, performance tends to improve as the calculation period increases, capturing the largest economic trends.
Regression Analysis
275
FIGURE 6.16 IBM trend using the slope and R.
Using the Linear Regression Slope The slope of the linear regression line, the angle at which it is rising or falling, is an effective way to simplify the usefulness of the regression process. The slope shows how quickly prices are expected to change over a unit of time. The unit of time is the same as the period of data used to find the regression values. When you use a longer calculation period, the slope of the regression line changes slowly; when you use only a few days in your calculation, the slope changes quickly. Using only the slope, you can trade with the following rules: • Buy when the value of the slope is positive (rising). • Sell when the value of the slope is negative (falling). When using the slope, there is less need for a confidence band because the longer calculation periods smooth out erratic price movement. The scale of the slope is different from the prices; therefore it will be seen in a separate panel on a chart (the middle panel in Figure 6.16). The linear regression slope will be compared to other trending techniques in Chapter 8 and its performance is competitive.
Adding Correlations The slope is a practical substitution for the regression line and confidence bands, but it can also be misleading. It is possible to have the same slope value while prices are moving higher in both a smooth pattern or in a very noisy, erratic one. Using the correlation coefficient, R2, will provide a measurement of the consistency of the price movement.12 See Rudy Tesco, “LRS + R-Squared = the 95% Solution,” Technical Analysis of Stocks & Commodities (February 2003). 12
276
TRADING SYSTEMS AND METHODS
Instead of R2, which is always positive, R will be used. And, instead of using the usual price differences (or return differences), the actual prices will be used and correlated against a series of sequential numbers. This should give us a better value for whether the prices are trending. If R becomes negative then prices are trending down. This can be seen in the bottom panel of Figure 6.16. A 60-day moving average of prices is shown at the top, a corresponding 60-day slope is in the middle, and a 60-day R is at the bottom along with a 30-day (R-period ( d/2) trend of R. The trading rules for the slope are normally the same as those for a moving average: a long position is entered when the trendline or slope turns up and a short sale begins when the trendline turns down; however, the slope today can be less than yesterday but still positive, which means that the trend is still up. Then another rule would be to buy when the slope turns positive and sell short when it turns negative. Figure 6.16 shows that using the moving average trend is good, but has the greatest lag. The slope is much faster but less stable. Adding R gives a different view of where the trends change and can complement either method.
Forecast Oscillator Tuschar Chande used the regression forecast and its residuals to create trend-following signals called the Forecast Oscillator.13 Using a 5-day regression, find the residuals and calculate the percentage variation from the regression line. A buy signal occurs when the 3-day average of the residuals crosses above the regression line; a short sale is when the 3-day average of the residuals crosses below the regression line. If %
t
×
yˆ t
yt yt
and % Ft(3) is the 3-day moving average of %F, F then buy when % Ft(3) crosses above yˆ t sell short when % Ft(3) crosses below yˆ t This makes the assumption that the residuals have a trending quality.
MEASURING MARKET STRENGTH One of the natural applications of the linear regression is to measure and compare the strength of one market against another. For example, we might want to ask, “Which market is leading the other, Hewlett Packard or Dell? The slope of the linear regression, 13
Tushar S. Chande and Stanley Kroll, The New Technical Traderr (New York: John Wiley & Sons, 1994).
277
Regression Analysis
70
Actual Prices
60 50 40
AMGN
30
JNJ
20
MRK
10
PFE 1/31/2011
12/31/2010
11/30/2010
10/31/2010
9/30/2010
8/31/2010
7/31/2010
6/30/2010
5/31/2010
4/30/2010
3/31/2010
2/28/2010
1/31/2010
12/31/2009
FIGURE 6.17 Prices of four pharmaceutical companies, 2010 through January 2011.
115 110 105 100 95
AMGN
90
JNJ
85
MRK
80
PFE 1/31/2011
12/31/2010
11/30/2010
10/31/2010
9/30/2010
8/31/2010
7/31/2010
6/30/2010
5/31/2010
4/30/2010
3/31/2010
2/28/2010
1/31/2010
75 12/31/2009
Index Price, 12/31/2009=100
measured over the same calculation period, is the perfect tool for comparing, or ranking, a set of markets. Figure 6.17 shows the prices of four pharmaceutical companies, Amgen (AMGN), Johnson & Johnson (JNJ), Merck (MRK), and Pfizer (PFE). Which of them is the strongest during the last 60 days? No doubt it’s PFE, the line at the bottom. But the weakest is not as clear. In order to rank these correctly, it is best to index the stock prices, starting at 100 on the same date. For only stocks, indexing is not necessary, but if you are mixing stocks and futures, or just using futures, indexing will be needed to put the trading units into the same notation. Figure 6.18 shows the indexed stocks beginning at the value of 100. Once indexed, apply a rolling linear regression slope to each market using the same calculation period, 60 days in this example. Figure 6.19 shows that that PFE was the most
FIGURE 6.18 Indexed stocks beginning at 100 give a better view of relative performance.
278
TRADING SYSTEMS AND METHODS
0.300 0.200 0.100 Slope
0.000 –0.100
AMGN
–0.200
JNJ
–0.300
MRK
–0.400
PFE 1/31/2011
12/31/2010
11/30/2010
10/31/2010
9/30/2010
8/31/2010
7/31/2010
6/30/2010
5/31/2010
4/30/2010
3/31/2010
2/28/2010
1/31/2010
12/31/2009
–0.500
FIGURE 6.19 Rolling linear regression slope, using a 60-day calculation period, shows that each market changes from stronger to weaker over the 1-year period.
volatile because the slope varied from much higher to much lower than the others, while each stock had its turn at being the strongest and weakest. At the right side of the chart, PFE finishes the strongest followed by AMGN, MRK, and JNJ. In Chapter 13 this technique will be used to create a classic market neutral strategy. The basis of the strategy is to either buy the strongest stocks and sell short the weakest, or sell short the strongest and buy the weakest. In either case, strongest and weakest are determined by the slope of the regression rather than a moving average trend.
CHAPTER 7
Time-Based TrendCalculations
T
he purpose of all trend identification methods is to remove the underlying noise in the market, those erratic moves that seem to be meaningless, and find the current direction of prices. But trends are somewhat dependent upon your time horizon. There may be more than one trend at any one time, caused by short-term events and longterm policy, and it is likely that one trader will search for the strongest, or most dominant trend, while another will seek a series of shorter-term moves. There is no “right” or “wrong” trend but a choice of benefits and compromises. The technique that is used to uncover a particular trend can depend upon whether any of the underlying trend characteristics are known. Does the stock or futures market have a clear seasonal or cyclic component, such as the travel industry or coffee prices; or does it respond to long-term monetary policy based on the cost of servicing debt or interest income? If you know more about the reasons why prices trend, you will be able to choose the best method of finding the trend and the calculation period. Chapter 6 used regression to find the direction of a single price series (based on one market and time), the relationship between two markets, and the ranking of both similar and diverse markets. Once you know that there is a fundamental relationship between data, a formula can be found that expresses one price movement in terms of the other prices and economic data. The predictive qualities of these methods are best when applied to data that have been seen before, that is, prices that are within the range of historic data. Forecasting reliability decreases when values are extrapolated outside the previous range of value. The most popular trend models, discussed in this chapter, ignore the reasons why trends exist and generalize the process of smoothing prices in order to find a trend’s direction.
FORECASTING AND FOLLOWING There is a clear distinction between forecasting the trend and finding the current trend. Forecasting, predicting the future price, is much more desirable but very complex. As 279
280
TRADING SYSTEMS AND METHODS
shown in the previous chapter, it involves combining those data that are most important to price change and assigning a value to each one. The results are always expressed with a confidence level, the level of uncertainty in the forecast. There is always lower confidence as you try to forecast further into the future. The techniques most commonly used for evaluating the direction or tendency of prices both within prior ranges or at new levels are called autoregressive functions. Unlike forecasting models, they are only concerned with evaluating the current price direction. This analysis concludes that prices are moving in an upward, downward, or sideways direction, with no indication of confidence. From this simple basis, it is possible to form rules of action and develop complex trading strategies. All of these techniques make the assumptions that past data can be used to predict future price movement, and that the direction of prices today is the most likely forecast of the direction of prices tomorrow. For the most part, these assumptions have proved to be true. From a practical viewpoint, these trending methods are more flexible than the traditional regression models, but to achieve success they introduce a lag. A lag is a delay in the identification of the trend. Great effort has been spent trying to reduce this lag in an attempt to identify the trend sooner; however, the lag is the zone of uncertainty that allows the technique to ignore most of the market noise. In an autoregressive model, one or more previous prices determine the next sequential price. If pt represents today’s price, pt–1 yesterday’s price, and so on, then tomorrow’s expected price will be pt+1 = a0 + a1pt + a2 pt–1 + . . . + at p1 + e where each price is given a corresponding weight ai and then combined to give the resultant price for tomorrow pt+1 + e (where e represents an error factor, usually ignored). The simplest example is the use of yesterday’s price alone to generate tomorrow’s price: pt+1 = a0 + a1 pt–1 + e which you may also recognize as the formula for a straight line, y = a + bx, plus an error factor. The autoregressive model does not have to be linear; each prior day can have a nonlinear predictive quality. Then each expected price pt+1, could be represented by a curvilinear expression, pt+1 = a0 + a1 pt + a2 p2t–1 + e, or by an exponential or logarithmic formula, ln pt+1 = a0 + a1 ln pt + a2 ln pt–1 + e, which is commonly used in equity analysis. Any of these expressions could then be combined to form an autoregressive forecasting model for pt+1. In going from the simple to the complex, it is natural to want to know which of these choices will perform best. Theoretically, the best method will be the one that, when used in a strategy, yields the highest return for the lowest risk; however, every investor has a personal risk preference. The answer can only be found by applying and comparing different methods, and experiencing how they perform when actually traded. It turns out that the best historic results often comes from overfitting the data, and is a poor choice for trading. At the end of Chapter 8 there is a comparison of popular trending systems,
281
Time-Based TrendCalculations
and Chapter 21 will show testing methods that are most likely to lead to robust results. Throughout the book there will be comparisons of systems and methods that are similar.
Least-Squares Model The least-squares regression model is the same technique that was used in the previous chapter to find the relationship between two markets—Barrick Gold and cash gold, corn and soybeans—or to find how price movement could be explained by the main factors influencing them, supply and demand. Most trading systems depend only on price; therefore, we will look again using the least-squares model with time as the independent variable and price as the dependent variable. The regression results will be used in an autoregressive way to forecast the price n-days ahead, and we will look at the accuracy of those predictions. The slope of the resulting straight line or curvilinear fit will determine the direction of the trend.
Error Analysis A simple error analysis can be used to show how time works against the predictive qualities of regression, or any forecasting method. Using 10 years of General Electric (GE) prices, ending February 15, 2010, the slope and y-intercept are calculated for a rolling 20 days. The 1-, 2-, 3-, 5-, and 10-day ahead forecast is found by projecting the slope by that number of days. The forecast error is the difference between the projected price and the actual price. Figure 7.1 shows the price for GE from December 31, 2010, through February 15, 2011, along with the five forecast prices. Even though the price move seems to be increasing steadily, the forecasts get farther away as the days ahead become larger. This result is typical of forecasting error, regardless of the method, and argues that the smallest forecast interval is the best.
General Electric Price
24 23 GE actual price
22
1-day 21
2-day
20
3-day 5-day
19
2/14/2011
2/7/2011
1/31/2011
1/24/2011
1/17/2011
1/10/2011
1/3/2011
10-day 18
FIGURE 7.1 General Electric price from December 31, 2010, through February 15, 2011. Forecast accuracy decreases as the forecast period increases.
282
n n+1 n+2 n+3 n+4 n+5 n+6 n+7 n+8 n+9 n + 10
Seq
Date
20.80 20.71 20.75 20.56 20.87 21.28 21.31 21.27 21.33 21.50 21.46
GE Close
0.118 0.131 0.141 0.144 0.146 0.152 0.156 0.157 0.152 0.150 0.140
Slope
−351.689 −390.484 −422.673 −432.439 −440.206 −458.803 −471.628 −471.985 −459.262 −452.185 −419.686
Intercept
Regression
20.438 20.673 20.886 21.019 21.166 21.367 21.544 21.675 21.769 21.879 21.914
1-day
20.556 20.804 21.027 21.162 21.313 21.519 21.700 21.831 21.921 22.029 22.054
2-day
20.675 20.934 21.168 21.306 21.459 21.672 21.857 21.988 22.074 22.180 22.193
3-day
Forecast
20.911 21.195 21.449 21.594 21.752 21.976 22.169 22.301 22.379 22.480 22.473
5-day
21.502 21.848 22.154 22.314 22.484 22.738 22.952 23.084 23.141 23.231 23.173
10-day
General Electric Analysis of Regression Error Based on a 20-Day Rolling Calculation Period
2/1/2011 2/2/2011 2/3/2011 2/4/2011 2/7/2011 2/8/2011 2/9/2011 2/10/2011 2/11/2011 2/14/2011 2/15/2011
TABLE 7.1
2-day
−0.669 −0.420 −0.194 0.244 0.157 −0.118 0.003 0.249 0.370 0.331 0.461
1-day
−0.616 −0.272 −0.077 0.326 0.149 −0.114 0.057 0.274 0.345 0.269 0.419
−0.769 −0.478 −0.354 0.115 0.064 −0.112 −0.004 0.189 0.342 0.357 0.528
3-day
−1.128 −0.791 −0.535 −0.128 −0.262 −0.369 −0.115 0.179 0.264 0.252 0.516
5-day
Forecast error
−1.404 −1.406 −1.657 −1.616 −1.588 −1.615 −1.301 −0.957 −0.654 −0.566 −0.322
10-day
283
Time-Based TrendCalculations
The method of finding the forecast error is shown in Table 7.1 (the full spreadsheet can be found on the Companion Website as TSM General Electric regression error forecast). Only the closing prices are needed, and they appear in column 3. The slope and intercept use the sequential numbers in column 1 for X, and the GE prices for Y. The n-day ahead forecast is yt+n = Interceptt + Slopet × Pricet + n × Slopet The standard deviations of the five forecast errors (Table 7.2), taken over the entire 10 years, shows the error increasing as the days-ahead increase. This confirms the expectation that forecasting accuracy decreases with time and that confidence bands will get wider with time. For this reason, any forecasts used in strategies will be 1-day ahead.
Limiting the Forecast to Direction To be profitable trading a trending system, it is only necessary to be correct in one of the following two cases: 1. In more than 50% of the days you are correct in predicting whether prices will go up
or down and the average up move is equal to the average down move. 2. Your forecast accuracy is less than 50% but the size of the correct moves is greater
than the size of the incorrect moves. Unfortunately, there is no way to prove that a particular method of forecasting, moving average, regression, or other techniques will be accurate over all calculation periods. The fact is that some calculation periods are profitable and others are not. Those that are profitable must satisfy one of the two conditions stated above. Therefore, the answer is it’s true when it works and not true when it doesn’t work. Experience shows that the best choice of trending method will be the one that is profitable over most markets and most calculation periods. Even then, shorter calculation periods have no trend (this was discussed in Chapter 1), so we need to restrict our statement to longer periods. The methods discussed in the remainder of this chapter are all intended to identify the direction of prices based on past data. The trading systems that use them all assume that there is a better chance of prices continuing in that direction the next day. If the systems are profitable then the assumption was correct. There is sufficient performance history for macrotrend funds that justify this conclusion. These systems will be discussed in the next chapter.
TABLE 7.2
The Standard Deviation of Errors for Different “Days Ahead” Forecasts
Days Ahead Stdev of Errors
1 1.137
2 1.336
3 1.519
5 1.860
10 2.672
284
TRADING SYSTEMS AND METHODS
PRICE CHANGE OVER TIME The most basic of all trend indicators is the change of price over some period of time. This is written as Mt = pt – pt–n where M is called momentum, t is today, and n is the number of days. Sometimes this is called rate of change, but both momentum and rate of change are incorrect names. In mathematics, this is the first difference, and in physics it is speed (distance covered over time). The next chapter will discuss this and many variations of momentum. If the change in price is positive, we can say that the trend is up, and if negative, the trend is down. Of course, this decision is based only on two data points, but if those points are far enough away from each other, that is, if n is large, then the trend as determined by this method will be very similar to a simple moving average, discussed in the next section. The simplest method can often be the most robust; therefore, as you read about many other approaches to analyzing price, keep asking, “Is it better than the simple change in price?”
THE MOVING AVERAGE The most well-known of all smoothing techniques, used to remove market noise and find the direction of prices, is the moving average (MA). Using this method, the number of elements to be averaged remains the same, but the time interval advances. This is also referred to as a rolling calculation period. Using a series of prices, p0, p1, p2, . . . , pt, a moving average measured over the most recent n of these prices, or data points, at time t would be MAt =
pt− n +1 + pt− n +2 + + pt 1 t = ∑ i =t− n +1 pi , n ≤ t n n
Then today’s moving average value is the average (arithmetic mean) of the most recent n data points. For example, using three points (n = 3) to generate a moving average starting at the beginning of the data: MA3 = ( p1 + p2 + p3 ) / 3 MA4 = ( p2 + p3 + p4 ) / 3 MAt = ( pt−2 + pt−1 + pt ) / 3 If pt represents a price at a specific time t, the moving average would smooth the price changes. When more prices, n, are used in the average, each price will be a smaller part of the average and have less effect on the final value. Using five successive prices is called a 5-day moving average. When the next sequential price is added and the oldest
285
Time-Based TrendCalculations
is dropped off, the prior average is changed by ½ of the difference between the old and the new values. If MA5 = (p1 + p2 + p3 + p4 + p5)/ 5 and MA6 = (p2 + p3 + p4 + p5 + p6)/5 then c = p2 + p3 + p4 + p5 can be substituted for the common part of the moving average. MA6, the most recent value, can be solved in terms of MA5, the previous value, to get MA6 = MA5 + (pt – pt–n)/5 This also gives a faster way to calculate a moving average. It can be seen that the more terms in the moving average, the less effect the addition of a new term will have: MAt = MAt–1 + (pt – pt–n)/n The selection of the number of terms, called the calculation period, is based on both the predictive quality of the choice (measured by the error but more often by the profitability) or the need to determine price trends over specific time periods, such as a season. For outright trading, the calculation period is chosen for its accuracy in identifying trend and the risk tolerance of the trader. Slower trends, using longer calculation periods, are usually better indicators of price direction, but involve larger risk. The stock market has adopted the 200-day moving average as its benchmark for direction; however, traders find this much too slow for timing buy and sell signals. The length of a moving average can be tailored to specific needs. A 63-day moving average, ¼ of 252 business days in the year, would reflect quarterly changes in stock price, minimizing the significance of price fluctuations within a calendar quarter. A simple yearly calculation period, 252 days, would ignore all seasonality and emphasize the annual growth of the stock. Any periodic cycle that is the same length as the moving average length is lost; therefore, if a monthly cycle has been identified, then a moving average of less than 10 days (half the cycle length) would be best for letting the moving average show that cycle. Using a moving average to find seasonal and cyclic patterns is covered in Chapters 10 and 11. At this point it is sufficient to remember that if there is a possibility of a cyclic or seasonal pattern within the data, care should be taken to select a moving average that is out of phase with that pattern (that is, not equal to the cycle period). The length of the moving average may also relate to its commercial use. A jeweler may purchase silver each week to produce bracelets. Frequent purchases of small amounts keeps the company’s cash outlay small. The purchaser can wait a few extra days during a week while prices continue to trend downward but will buy immediately when prices turn up. A 6-month trend cannot help him because it gives a long-term answer to a shortterm problem; however, a 5-day moving average may give the trend direction within the jeweler’s time frame.
286
TRADING SYSTEMS AND METHODS
User-Friendly Software Fortunately, we have reached a time when it is not necessary to perform these calculations the long way. Spreadsheet programs and specialized testing software provide simple tools for performing trend calculations as well as many other more complex functions discussed in this book. The notation for many of the different spreadsheets and software is very similar and self-explanatory: Function
Spreadsheet Notation
TradeStation Notation
Sum Moving average Standard deviation Maximum value Minimum value
=sum(list) =average(list) =stdev(list) =max(list) =min(list)
summation(value, period) average(value, period) stddev(value, period) highest(value, period) lowest(value, period)
In the spreadsheet notation, list is a series of rows. For example, (D11:D30) would be 20 rows in column D, and in TradeStation notation, period is the calculation period and value is the closing daily price series, close or C.
What Do You Average? The closing or daily settlement is the most common price applied to a moving average. It is generally accepted as the “true” price of the day and is used by many analysts for calculation of trends. It is the price used to reconcile brokerage accounts at the end of the day, create the Net Asset Value (NAV) for funds, and for futures trading it is called marked-to-market accounting. A popular alternative is to use the average of the high, low, and closing prices, representing some sort of center of gravity. You may also try the average of the high and low prices, ignoring the closing price entirely. Another valid component of a moving average can be other averages. For example, if p1 through pt are prices, and MAt is a 3-day moving average on day t, then MA3 = (p1 + p2 + p3)/3 MA4 = (p2 + p3 + p4)/3 MA5 = (p3 + p4 + p5)/3 and MA′5 = ( MA3 + MA4 + MA5 ) / 3 where MA′5 is a double-smoothed moving average, which gives added weight to the center points. Double smoothing can be very effective and is discussed later in this chapter. Smoothing the highs and lows independently is another technique that creates a representation of the daily trading range, or volatility. This has been used to identify normal and extreme moves, and is also discussed in Chapter 8.
287
Time-Based TrendCalculations
Types of Moving Averages Besides varying the length of the moving average and the elements that are to be averaged, there are a great number of variations on the simple moving average. In the methods that follow, the notation assumes that the most recent day is t and the average is found over the past n days. The Simple Moving Average The simple moving average is the average (mean) of the most recent n days. It has also been called a truncated moving average, and it is the most well-known and commonly used of all the methods. Repeating the formula from earlier in this chapter, MAt =
pt− n +1 + pt− n +2 + + pt 1 t = ∑ i =t− n +1 pi , n ≤ t n n
The main objection to the simple moving average is its abrupt change in value when an important old piece of data is dropped off, especially if only a few days are used in the calculation. We also know that, if the new data, pt, is greater than the oldest data item that will be dropped off, pt−n, then the new average, MAt will be greater than the previous average, MAt–1. Average-Modified or Average-Off Method To avoid the end-off problem of the simple moving average, each time a new piece of data is added the previous average can be dropped off. This is called an average-modified or average-off method. It is computationally convenient because you only need to keep the old average value rather than all the data that was used to find the average. In general, the average-off method is AvgOfft =
( n − 1) × AvgOfft−1 + pt n
The substitution of the moving average value for the oldest data item tends to smooth the results even more than a simple moving average and dampens the end-off impact. Weighted Moving Average The weighted moving average opens many possibilities. It allows the significance of individual or groups of data to be changed. It may restore perceived value to parts of a data sample, or it may incorrectly bias the data. A weighted moving average is expressed in its general form as n
Wt =
w1 P t− n +1 + w2 P t− n + 2 +… + wn −1 P t−1 + wn P t = w1 + w2 +… + wn
∑w P i
t − i+1
i=1
n
∑w
i
i=1
The weighted moving average at time t is the average of the previous n prices, each price having its own weighting factor wi. There is no restriction on the values used as
288
TRADING SYSTEMS AND METHODS
FIGURE 7.2
A comparison of moving averages. The simple moving average, linearly weighted average, triangular weighted, and average off methods are applied to the S&P, April through December 2010.
weighting factors; that is, they do not have to be percentages that all total to 1. The most popular form of this technique is called front-loaded because it gives more weight to the most recent data (n) and reduces the significance of the older elements. For the frontloaded weighted moving average (see Figure 7.2) w1 ≤ w2 ≤ ≤ wn The weighting factors wi may also be determined by regression analysis, but then they may not necessarily be front-loaded. A common modification to front-loading is called step-weighting in which each successive wi differs from the previous weighting factor wi–1 by a fixed increment c = wi – wi–1 The most common 5-day front-loaded, step-weighted average would have weighting factors increasing by c = 1 each day, w1 = 1, w2 = 2, w3 = 3, w4 = 4, and w5 = 5. In general, for an n-day frontloaded step-weighted moving average: wt–n+1 = 1 : wt–1 = n – 1 wt = n A TradeStation program for calculating an n-day, front-loaded, linearly weighted moving average is called waverage. If simple linear step-weighting is not what you want, then a percentage relationship a between wi elements can be used, wi–1 = a × wi
289
Time-Based TrendCalculations
If a = 0.90 and w5 = 5, then w4 = 4.5, w3 = 4.05, w2 = 3.645, and w1 = 3.2805. Each older data item is given a weight of 90% of the more recent value. This is similar to exponential smoothing which will be discussed later in this chapter. Weighting by Group Prices may also be weighted in groups. If every two consecutive data elements have the same weighting factor, and pt is the most recent price, n is the calculation period (preferably an even number), and there are n/2 number of weights, then Wt =
w1 pt−n+1 + w1 pt−n+2 + w2 pt−n+3 + w2 pt−n+4 + + wn /2 pt−1 + wn /2 pt 2 × ( w1 + w2 + + wn /2 )
For two or more data points using the same weighting, this formula can be regrouped as Wt =
w1 ( pt−n+1 + pt−n+2 ) + w2 ( pt−n+3 + pt−n+4 ) + + wn /2 ( pt−1 + pt ) 2 × ( w1 + w2 + + wn /2 )
Any number of consecutive data elements can be grouped for a step-weighted moving average. If the purpose of weighting is to reproduce a pattern that is intrinsic to price movement, then either the geometric average, G = (p1 × p2 × p3 . . . pn)1/n, discussed in Chapter2, or exponential smoothing, explained later in this chapter, may be a better tool.
Triangular Weighting While the simple moving average or linear regression treats each price equally, exponential smoothing and linear step-weighting put greater emphasis on the most recent data. There is an entire area of study in which the period of the dominant cycle is the basis for determining the best trend period. Triangular weighting or triangular filtering1 attempts to uncover the trend by reducing the noise in both the front and back of the calculation window, where it is expected to have the greatest interference. Therefore, if a 20-day triangular weighting is used, the 10th day will have the greatest weight, while days 1 and 20 will have the smallest. To implement triangular weighting, begin with the standard formula for a weighted average, calculated for n days as of the current day t, n
∑w P i
Wt =
t − n+1
i=1
n
∑w
i
i=1
1
J. J. Payne, “A Better Way to Smooth Data,” Technical Analysis of Stocks & Commodities (October 1989).
290
TRADING SYSTEMS AND METHODS
where n is also called the size, or width, of the window. For triangular weighting, the weighting factors wi will increase linearly from 1 to the middle of the window, at n/2, then decrease to the end at n. This has a slightly different form when the period is odd or even, wi = i, n − i + 1, n − i,
for i = 1 to int((n + 2)/2) for i = int((n + 2)/2) + 1 to n (even values of n) for i = int((n + 2)/2) + 1 to n (odd values of n)
where int is a function that returns the integer portion by truncation. For odd values of n, the weighting factor has the value i, where i ranges from 1 to n/2 (rounded up with the help of the function int) and the value of n – i from n/2 to n. Instead of a triangular filter, which climbs in equal steps to a peak at the middle value, a Gaussian filter can be used, which weights the data in a form similar to a bell curve. Here, the weighting factors are more complex, but the shape of the curve may be more appealing, wi = 10 x and x =
3 ⎛ 2i ⎞ × ⎜1 − ⎟ n⎠ 2 ⎝
2
Triangular weighting is often used for cycle analysis. Two techniques that use this method successfully, Hilbert and Fischer transforms, can be found in Chapter 11.
Pivot-Point Weighting Too often we limit ourselves by our perception of the past. When a weighted moving average is used, it is normal to assume that all the weighting factors should be positive; however, that is not a requirement. The pivot-point moving average uses reverse linear weights (e.g., 5, 4, 3, . . .) that begin with a positive value and continue to decline even when they become negative.2 In the following formula, the pivot point, where the weight is zero, is reached about 2 3 through the data interval. For a pivot-point moving average of 11 values, the eighth data point is given the weight of 0: PPMAt (11) = (–3pt–10 – 2pt–9 – 1pt–8 + 0pt–7 + 1pt–6 + 2pt–5 + 3pt–4 + 4pt–3 + 5pt–2 + 6pt–1 + 7pt) / 22 The intent of this pattern is to reduce the lag by front-loading the prices. The divisor is smaller than the usual linear weighted average (where the sum of 1 through 11 is 66) because it includes negative values. The general formula for an n-day pivot-point moving average is3 PPMAt( n ) = 2 Patrick
n 2 (3 i − n − 1) P i ∑ n( n + 1) i=1
E. Lafferty, “End-Point Moving Average,” Technical Analysis of Stocks & Commodities (October 1995). 3 Don Kraska, “Letters to S&C,” Technical Analysis of Stocks & Commodities (February 1996), 12.
Time-Based TrendCalculations
291
FIGURE 7.3 S&P continuous futures, April through December 2010, with examples of the simple moving average, standard deviation average, geometric average, and exponential smoothing, all with calculation periods of 40 days.
A computer program and indicator that calculates and displays the pivot-point moving average, both called TSM Pivot Point Average, are available on the Companion Website. The negative weighting factors actually reverse the impact of the price move for the oldest data points rather than just give them less importance. For a short interval this can cause the trendline to be out of phase with prices. This method seems best when used for longer-term cyclic markets, where the inflection point, at which the weighting factor becomes zero, is aligned with the cyclic turn or can be fixed at the point of the last trend change.
Standard Deviation Moving Average A unique trend calculation technique uses the standard deviation of prices.4 This method creates a comparatively smooth trendline, StdAvg, by modifying the moving average value with a percentage of the standard deviation of prices. The following instructions are from the program TSM Stdev Mvg Avg, available on the Companion Website. It uses 5% of a 30-period standard deviation, and a 15-period moving average; however, each of these values can be changed. The result is shown for S&P futures in Figure 7.3. SD = StdDev(close,30); SDV = (SD – SD[1]) / SD; StdAvg = Average(close,15) + .05*SDV;
4
Robert T. H. Lee, Power Tools for Traders (Hong Kong: MegaCapital Limited, 1997).
292
TRADING SYSTEMS AND METHODS
GEOMETRIC MOVING AVERAGE The geometric mean is a growth function that is very applicable to long-term price movement. It was introduced in Chapter 2. It is especially useful for calculating the components of an index. The geometric mean can also be applied to the most recent n points at time t to get a geometric average similar in function to a moving average Gt = ( pt− n+1 × pt− n+ 2 × × pt−1 × pt )
(1/ n )
⎛ n ⎞ = ⎜ ∏ pt− i+1 ⎟ ⎝ i=1 ⎠
(1/ n )
The daily calculation is more complicated but, as shown in Chapter 2, could be rewritten as ln pt− n+1 + ln pt− n+ 2 + + ln pt−1 + ln pt n ⎞ 1⎛ n = ⎜ ∑ ln pt− i+1 ⎟ ⎠ n ⎝ i=1
ln Gt =
This is similar in form to the standard moving average based on the arithmetic mean and can be written in either spreadsheet or program code as GA = average(log(price),n)
Note that some software will use the function log although the calculation is actually the natural log, ln. Other programs will allow the choice of log(value) or ln(value). A weighted geometric moving average, for n days ending at the current day t, would have the form ln Gt =
w1 ln pt− n+1 + w2 ln pt− n+ 2 + + wn−1 ln pt−1 + wn ln pt w1 + w2 + + wn n
=
∑ w ln p
t − i +1
i
i =1
n
∑w
i
i =1
The geometric moving average itself would give greater weight to lower values without the need for a discrete weighting function. This is most applicable to long data intervals where prices had a wide range of values. In applying the technique to recent index or stock prices, this distinction is not as apparent. For example, if the historical index values vary from 10 to 1000, the simple average of those two values is 505, and the geometric average is 100, but for the three sequential prices of 56.20, 58.30, and 57.15, the arithmetic mean is 57.2166, and the geometric is 57.1871. A 5-, 10-, or 20-day moving average of stock prices, compared to geometric averages of the same intervals, show negligible differences. The geometric moving average is best applied to long-term historic data with wide variance, using yearly or quarterly average prices.
293
Time-Based TrendCalculations
ACCUMULATIVE AVERAGE An accumulative average is simply the long-term average of all data, but it is not practical for trend following. One drawback is that the final value is dependent upon the start date. If the data have varied around the same price for the entire data series, then the result would be good. It would also be useful if you are looking for the average of a ratio over a long period. Experience shows that price levels have changed because of inflation or a structural shift in supply and/or demand, and that progressive values fit the situation best.
RESET ACCUMULATIVE AVERAGE A reset accumulative average is a modification of the accumulative average and attempts to correct for the loss of sensitivity as the number of trading days becomes large. This alternative allows you to reset or restart the average whenever a new trend begins, a significant event occurs, or at some specified time interval, for example, at the time of quarterly earnings reports or at the end of the current crop year.
DROP-OFF EFFECT Many rolling trend calculations are distinguished by the drop-off effect, a common way of expressing the abrupt change in the current value when a significant older value is dropped from the calculation. Simple moving averages, linear regressions, and weighted averages all use a fixed period, or window, and are subject to this. For an n-period moving average, the importance of the oldest value being dropped off is measured by the difference between the new price being added to the calculation, t, and the one being removed, t–n, divided by the number of periods, Drop-off effect = (pt – pt–n)/n A front-weighted average, in which the oldest values have less importance, reduces this effect because older, high volatility data slowly become a smaller part of the result before being dropped off. Exponential smoothing, discussed next, is by nature a front-loaded trend that minimizes the drop-off effect as does the average-off method.
EXPONENTIAL SMOOTHING Exponential smoothing may appear to be more complex than other techniques, but it is only another form of a weighted average. It can also be more accurately called percentage smoothing, and has the added advantage of only needing the current price, pt, the last exponentially smoothed value Et−1, and the smoothing constant a (a percentage), to
294
TRADING SYSTEMS AND METHODS
compute the new value. The technique of exponential smoothing was developed during World War II for tracking aircraft and missiles and projecting their positions: the immediate past is used to predict the immediate future. The terms of the geometric progression a0, a1, a2, a3, ... , an become the weighting factors of a weighted moving average Wt =
w1 pt− n+1 + w 2 pt− n+ 2 + … + wn−1 pt−1 + wn pt w1 + w 2 + … + w n
in reverse order, where wn is assigned the value a, wn−1 = a2, wn−2 = a3, and so forth. If a = ½, which is also called 50% smoothing, the resulting sequence of weighting factors is 1, ½, ¼, ½8, . . . , (½)n where a0 = 1 and a1 = a. This shows the rapidly decreasing importance of each older price. Substituting the geometric progression into the equation for the weighted moving average gives the exponential solution Et =
a n P t− n +1 + a n −1 P t− n +2 + … + a 2 P t−1 + apt a n + a n −1 + … + a 2 + a
The Common Form of Exponential Smoothing The common use of exponential smoothing takes a much simpler form, Et = Et–1 + a (pt – Et–1) where Et and Et–1 = today’s and yesterday’s exponential smoothing values pt = today’s price a = the smoothing constant, 0 ≤ a ≤ 1. It may be easier to visualize the effect of the smoothing process with a = 0.10 by thinking of it as moving the exponential trendline closer to the current price by 10% of the distance between the price and the previous trendline value. In Figure 7.4, using a smoothing constant of 0.10, the distance from the new price pt and the previous trendline value Et–1 is pt – Et–1. The new trendline value is 10% closer to the price because the distance between pt and Et–1 is reduced by 0.10 – (pt – Et–1). Therefore, New exponential value = Previous exponential value + a % of (Today’s price – Previous exponential value) The smoothing process is started by letting E1 = p1 and calculating the next value: E2 = E1 + a × (p2 – E1)
295
Time-Based TrendCalculations
FIGURE 7.4 Exponential smoothing. The new exponential trendline value, Et, is moved closer to the new price, pt, by 10% of the distance between the new price and the previous exponential trendline value Et–1.
Even though the calculations are initialized with the closing price, a longer-term smoothing, where the constant is small, will take more data for the smoothed line, Et, to reach a stable value.
The Smoothing Constant Expressed in Days The standard conversion from the number of days to a smoothing constant c was given by Hutson5 as c=
2 n +1
where n is the equivalent number of days in the standard (linearly weighted) moving average. A, 2nd- or 3rd-order exponential smoothing, based on the weighting of the past 2 or 3 days’ prices, is the exponential equivalent of step-weighting. Its general form is 1
2 ⎞p ⎛ cp = 1 − ⎜ 1 − ⎟ ⎝ n + 1⎠ A comparison of the standard moving average days with 1st-, 2nd-, and 3rd-order exponential smoothing is shown in Table 7.3. Using the Hutson conversion does not give you the real exponential smoothing equivalent of the moving average because it ignores the lag, which can be substantial. This can be seen in Tables 7.3 and 7.4 as well as in Tables 7.5 and 7.6. Most software development 5
Jack K. Hutson, “Filter Price Data: Moving Averages vs. Exponential Moving Averages,” Technical Analysis of Stocks & Commodities (May/June 1984).
296
TRADING SYSTEMS AND METHODS
TABLE 7.3
Comparison of Exponential Smoothing Values
Moving Average Days (n)
3 5 7 9 11 13 15 17 19 21
1st-Order p=1
2nd-Order p=2
3rd-Order p=3
0.500 0.333 0.250 0.200 0.167 0.143 0.125 0.111 0.100 0.091
0.293 0.184 0.134 0.106 0.087 0.074 0.065 0.057 0.051 0.047
0.206 0.126 0.091 0.072 0.059 0.050 0.044 0.039 0.035 0.031
TABLE 7.4 Comparison of Exponential Smoothing Residual Impact N
2/(n + 1)
RI (%)
10% RI
5% RI
5 10 15 20
0.333 0.182 0.125 0.095
13.17 13.44 13.49 13.51
0.369 0.206 0.142 0.109
0.451 0.259 0.181 0.139
platforms only allow the input of days for the calculation period, rather than the smoothing constant itself. This results in smoothing constants that have large jumps equivalent to the integer number of days. The program TSM Exponential Smoothing, available on the Companion Website, allows the specific smoothing constant to be entered.
Estimating Residual Impact The primary difference between the standard moving average and exponential smoothing is that all prices remain as part of the exponentially smoothed value indefinitely. For practical purposes, the effect of the oldest data may be very small. A general method of approximating the smoothing constant c for a given level of residual impact is given by c = 1 − RI 1/ n where
n = the number of moving average days that is equivalent to the smoothing constant RI = the level of residual impact expressed as a percentage (e.g., 0.05, 0.10, 0.20).
A lower percent implies more residual impact.6 6
Donald R. Lambert, “Exponentially Smoothed Moving Averages,” Technical Analysis of Stocks & Commodities (September/October 1984).
297
10.0
.10
1.00 .90 .80 .70 .60 .50 .40 .30 .20 .10
Weighting (%)
9.0
9.0 16.0 21.0 24.0 25.0 24.0 21.0 16.0
—
2
8.1
.9 3.2 6.3 9.6 12.5 14.4 14.7 12.8
—
3
7.3
— .6 1.9 3.8 6.3 8.6 10.3 10.2
—
4
6.6
— — .6 1.5 3.1 5.2 7.2 8.2
—
5
5.9
— — — .6 1.6 3.1 5.0 6.5
—
6
5.3
— — — — .8 1.9 3.5 5.2
—
7
4.8
— — — — — 1.1 2.5 4.2
—
8
4.3
— — — — — .7 1.7 3.3
—
9
3.9
— — — — — — 1.2 2.7
—
10
100.0 90.0 80.0 70.0 60.0 50.0 40.0 30.0 20.0 10.0
1
— 99.0 96.0 91.0 84.0 75.0 64.0 51.0 36.0 19.0
2
— 99.9 99.2 97.3 93.6 87.5 78.4 65.7 48.8 27.1
3
— — — 99.2 97.4 93.8 87.0 76.0 59.0 34.4
4
— — — 99.8 99.0 96.9 92.2 83.2 67.2 41.0
5
— — — — 99.6 98.5 95.3 88.2 73.8 46.8
6
— — — — — 99.3 97.2 91.8 79.0 52.2
7
— — — — — — 98.3 94.2 83.2 57.0
8
— — — — — — 99.0 96.0 86.6 61.3
9
3.5
— — — — — — .8 2.1
—
11
3.1
— — — — — — — 1.7
—
12
2.8
— — — — — — — 1.4
—
13
— — — — — — — — 89.3 65.1
10
— — — — — — — — 91.4 68.6
11
— — — — — — — — 93.1 71.8
12
— — — — — — — — 94.5 74.6
13
— — — — — — — — 95.6 77.1
14
15
16
17
18
1.7
— — — — — — — —
—
18
— — — — — — — — — 85.0
1.8
— — — — — — — —
—
17
— — — — — — — — — 83.3
2.1
— — — — — — — —
—
16
— — — — — — — — — 81.5
2.3
— — — — — — — .9
—
15
— — — — — — — — 96.5 79.4
2.5
— — — — — — — 1.1
—
14
Total Inclusion through nth Day
Evaluation of Exponential Smoothing—Significance of Prior Data
90.0 80.0 70.0 60.0 50.0 40.0 30.0 20.0
TABLE 7.6
100.0
.90 .80 .70 .60 .50 .40 .30 .20
1
Past Number of Days
Evaluation of Exponential Smoothing—Significance of Prior Data
1.00
Weighting (%)
TABLE 7.5
— — — — — — — — — 86.5
19
1.5
— — — — — — — —
—
19
— — — — — — — — — 87.8
20
1.3
— — — — — — — —
—
20
— — — — — — — — — 89.1
21
1.2
— — — — — — — —
—
21
— — — — — — — — — 90.1
22
1.1
— — — — — — — —
—
22
— — — — — — — — — 91.1
23
1.0
— — — — — — —
23
298
TRADING SYSTEMS AND METHODS
The approximation for the smoothing constant, given in the previous section as 2/(n + 1), can be shown to have a consistent residual impact of between 13 and 14%. The use of the preceding formula, as shown in Table 7.4, would allow the specific adjustment of residual impact; however, eliminating all the residual impact would transform exponential smoothing to a weighted average.
Relating Exponential and Standard Averages It is much easier to visualize the amount of smoothing in a 10-day moving average than with a “10%” exponential smoothing, where a = 0.10. Although we try to relate the speed of both techniques, the simple moving average is equally weighted and the exponential is front weighted; therefore, they produce very different results. Because the exponential smoothing never completely discards the old data, a 10% smoothing is slower than a 10-day moving average, and a 5% smoothing is slower than a 20-day moving average. To illustrate the difference in the trend patterns, a series of numbers from 1 through 15 and back to 1 will be used to compare a 5-day moving average with an “equivalent” 20% exponential smoothing. Figure 7.5 and Table 7.7 show the relationship between the moving average and exponential smoothing. During the period of constant increase and decrease of at least 5 consecutive days, the 5-day moving average stabilizes and follows the price series with constant lag of 1, equal to the price change (seen in column 4 of Table 7.7). During the same period of constant rise the exponential smoothing approaches the lag of 1 but only gets as close as 0.95. Had the steady rise been longer, it could have “theoretically” reached 1. The increased lag due to the residual values can be seen when the exponential trend changes direction four prices after the peak. The moving average changes direction three prices after the peak. In Figure 7.5 it is clear that the standard moving average has no memory of the previous price moves. The exact values can be seen in Table 7.7.
Calculated Trend Values
16 14 12 10 8 6 4 2 0 1
3
5
7
9
11
13
15
13
11
9
7
5
3
Price
Price
Moving average
20% Smoothing
FIGURE 7.5 Comparison of trend lag. Exponential smoothing never quite reaches a constant lag and changes direction one period after the moving average trendline.
1
299
Time-Based TrendCalculations
TABLE 7.7
Comparison of Lag between Standard and Exponentially Smoothed Averages Change
Price
Standard 5-Day
5-Point 20% Exp
Standard 20% Exp
5-Day
1 2
— —
1 1.2
1 1.2
— —
3
—
1.56
1.56
—
— 3 4 5 6 7 8 9 10 11 12 13 13.6 13.8 13.6 13 12 11 10 9 8 7 6 5 4 3
2.05 2.64 3.64 4.64 5.64 6.64 7.64 8.64 9.64 10.64 11.64 12.64 13.24 13.52 13.54 13.36 12.36 11.36 10.36 9.36 8.36 7.36 6.36 5.36 4.36 3.36
2.05 2.64 3.31 4.05 4.84 5.67 6.54 7.43 8.34 9.27 10.22 11.17 11.74 11.99 11.99 11.79 11.43 10.95 10.36 9.69 8.95 8.16 7.33 6.46 5.57 4.65
4 5 6 7 8 9 10 11 12 13 14 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
5–20% Exp
— —
— —
Not enough data
— — 1 1 1 1 1 1 1 1 1 1 0.6 0.2 –0.2 –0.6 –1 –1 –1 –1 –1 –1 –1 –1 –1 –1
20% Exp
— 1 1 1 1 1 1 1 1 1 1 0.6 0.28 0.02 –0.18 –1 –1 –1 –1 –1 –1 –1 –1 –1 –1
— — — 0.67 0.74 0.79 0.83 0.87 0.89 0.91 0.93 0.95 0.95 0.57 0.25 0 –0.20 –0.36 –0.48 –0.59 –0.67 –0.74 –0.79 –0.83 –0.87 –0.89 –0.92
Figure 7.6 relates the fully calculated exponential smoothing (within 1%) to the standard moving average. Find the smoothing constant on the left scale, and the equivalent number of days in a standard moving average will be along the bottom. Observe in the following summary that, if you perform an optimization with equally spaced exponential smoothing constants, there is more sensitivity at the low end and little at the high end. Equating Standard Moving Averages to Exponential Smoothing
Smoothing constant Standard (n-day average)
0.10 20
0.20 10
0.30 6
0.40 4
0.50 3
0.60 2.25
0.70 1.75
0.80 1.40
0.90 1.15
300
TRADING SYSTEMS AND METHODS
Exponential Smoothing Constant
% of Calculation Completed
A Number of Days Used in Calculating
Moving Average Number of Days B
FIGURE 7.6 Graphic evaluation of exponential smoothing and moving average equivalents.
If equally distributed smoothing constants are used for testing, half of the tests will analyze moving averages of three days or less. If the process is reversed, and equally spaced days are used, then the smoothing constants are very different, shown in the next summary. It turns out that equally spaced smoothing constants is a better test distribution than equally spaced days. The distribution of calculation periods used for testing will be important when finding robust system parameters, and is discussed in Chapter 21. Equating Exponential Smoothing to Standard Moving Averages
Standard (n-day average) Smoothing constant
2 4 6 8 0.65 0.40 0.30 0.235
10 0.20
12 0.165
14 0.14
16 0.125
18 0.11
20 0.10
301
Time-Based TrendCalculations
The distribution of smoothing constants is very close to logarithmic and is plotted on a log scale in Figure 7.6. This can be seen because the line representing the relationship between the smoothing constant and the moving average days, in the lower section, is nearly straight.
Correcting for the Lag If the lag is considered the forecast error et in the exponential smoothing calculation, then et = pt – Et where Et is the exponential trendline value (the smoothed value) corresponding to the most recent price pt. The same smoothing technique can be applied to the lag, the pattern of increasing or decreasing errors, to get ERRt = ERRt–1 + a × (et – ERRt–1) The difference between the original smoothing value and this 2nd-order smoothing of the errors ERRt is added back into the approximation to get an adjusted trendline EEt = Et + ERRt If the new error, the difference between the 1st-order exponential Et and the 2nd-order approximation EEt, is smaller than the original error et, then EEt is an improvement in the forecast. This process can be continued to 3rd-order smoothing by applying the same method to the difference between the current price and the 2nd-order trend EEt. This is similar to the method used by ARIMA discussed in Chapter 6.
Double Smoothing In order to make a trendline smoother, the period of a moving average may be increased or the exponential smoothing constant decreased. This succeeds in reducing the shortterm market noise at the cost of increasing the lag. An alternative to increasing the calculation period is double smoothing; that is, the trend values can themselves be smoothed. This will slow down the trendline, but gives weight to the previous values in a way that may be unexpected. A double-smoothed 3-day moving average, MA, would take the most recent 3 moving average values, calculated from prices, and use them in another 3-period average to get a double-smoothed moving average, DMA: MA3 = (p1 + p2 + p3)/3 MA4 = (p2 + p3 + p4)/3 MA5 = (p3 + p4 + p5)/3
302
TRADING SYSTEMS AND METHODS
then DMA5 = (MA3 + MA4 + MA5)/3 By substituting the original prices, p1, . . . , p5, into the equation for DMA5 we find out that DMA5 = (p1 + 2p2 + 3p3 + 2p4 + p5)/9 This shows that double smoothing puts weight on the center values and for a 3-day average the results look the same as triangular weighting. For longer calculation periods, the end values have decreasing weight but all other values have the same weight. For a 5-day double-smoothed average, the three end values would have declining weights. For exponential smoothing the result is also different. Because the most recent value in exponential smoothing receives the full weight of the smoothing constant, a, the double smoothing DEt = DEt–1 + a × (Et – DEt–1) causes the nearby value t to be smoothed twice by a, or a × a, and older values as well. Therefore, the net effect of using a constant of a = 0.10 for exponential double smoothing will result in a weighting that is much closer to using the square root of a, approximately 0.031. Figure 7.7 and Table 7.8 give an example of this method using the standard conversion of a smoothing constant from the number of days. Prices for Microsoft are shown along with a single 0.20 smoothing, a double smoothing, and a single error correction. The error correction positions the trendline in the middle of the price move and may be a good candidate for mean reversion trading.
29.00
Share Price
28.50 28.00 MSFT 27.50
Single Exp Dbl Exp
27.00
Single Err Cor
12
/3
1/
20
10 1/ 7/ 20 11 1/ 14 /2 01 1 1/ 21 /2 01 1 1/ 28 /2 01 1 2/ 4/ 20 11 2/ 11 /2 01 1 2/ 18 /2 01 1
26.50
FIGURE 7.7 Comparison of exponential smoothing techniques applied to Microsoft shows a single 0.20 smoothing (Exp), a double-smoothed series (Dbl Exp), and a single smoothed series with the forecast error corrected (Single Err Cor).
303
Time-Based TrendCalculations
TABLE 7.8
Comparison of Exponential Smoothing Techniques Applied to Microsoft Exp
Dbl Exp
Sm Err
Date
MSFT
0.10
0.10
Exp Err
0.10
Corr Exp
1/19/2011 1/20/2011 1/21/2011 1/24/2011 1/25/2011 1/26/2011 1/27/2011 1/28/2011 1/31/2011 2/1/2011 2/2/2011 2/3/2011 2/4/2011 2/7/2011 2/8/2011 2/9/2011 2/10/2011 2/11/2011 2/14/2011 2/15/2011
28.31 28.19 27.86 28.22 28.29 28.62 28.71 27.59 27.57 27.83 27.78 27.49 27.61 28.04 28.12 27.81 27.34 27.09 27.07 26.96
27.994 28.013 27.998 28.020 28.047 28.105 28.165 28.108 28.054 28.031 28.006 27.955 27.920 27.932 27.951 27.937 27.877 27.798 27.726 27.649
27.54046 27.58775 27.62879 27.66793 27.70586 27.74573 27.78766 27.81965 27.84307 27.8619 27.87634 27.88417 27.88777 27.89221 27.89809 27.90196 27.89948 27.88938 27.873 27.85061
0.316 0.177 −0.138 0.200 0.243 0.515 0.545 −0.518 −0.484 −0.201 −0.226 −0.465 −0.310 0.108 0.169 −0.127 −0.537 −0.708 −0.656 −0.689
0.453338 0.425662 0.369289 0.352333 0.341376 0.358787 0.377402 0.287906 0.210735 0.169519 0.129939 0.07048 0.032414 0.039955 0.052865 0.034893 −0.02231 −0.09093 −0.1474 −0.20156
28.44713 28.43908 28.36736 28.3726 28.38862 28.4633 28.54247 28.39546 28.26454 28.20094 28.13622 28.02513 27.9526 27.97212 28.00382 27.97175 27.85486 27.70753 27.57821 27.44749
Exp Chg
Dexp Chg
Down Down Up
Up
Down
Down
Up
Up
Down
Down
Double Smoothing of Price Changes To reduce the compounded lag produced by double smoothing yet take advantage of the smoother trendline, William Blau has substituted the price changes, pt – pt–n, for the price itself,7 a process that makes the data more sensitive to change. The first smoothing is then performed on this accelerated price series and acts to restore the speed of the series back to normal. When n = 1, the price changes are called the first differences, or speed. In effect, the first smoothed series does not have a lag so that the second smoothing results in one lag, the same as a normal moving average. Blau found this to be a successful proxy for long-term trends, where the first smoothing may be as long as 250 days, and the second a much shorter 5 days. The only disadvantage of this is that the scale is no longer the same as the price so that it cannot be plotted along with prices. To calculate the double smoothing of price change (in the following chapters the price change is also called momentum), follow the same method as exponential smoothing. First calculate the smoothed momentum, SMt, substituting the price change, pt – pt–n, for the price, pt, normally used. Next, perform another exponential smoothing using the smoothed momentum instead of price. The result is the double-smoothed momentum, DSMt. SMt = SMt−1 + a((pt – pt−n) – SMt−1) DSMt = DSMt−1 + a(SMt – DSMt−1) 7
William Blau, Momentum, Direction, and Divergence (New York: John Wiley & Sons, 1995).
304
TRADING SYSTEMS AND METHODS
FIGURE 7.8 Double smoothing applied to Microsoft, June 2010 through February 2011. (Top panel) the price of Microsoft along with an exponential double smoothing of 10 and 20 days. (Second panel) Blau’s double smoothing of 20/20 days. (Third panel) Blau’s smoothing of 5/40 days. (Bottom panel) The 5-day difference before applying double smoothing of 5/20 days.
As an example of this approach, start with the 5-day momentum, M (5)t = pt – pt–5, and smooth the momentum values using the 5-day period equivalent, 0.166. Smooth the resulting values again using the 20-day smoothing constant equivalent, 0.0555. The result is shown in the bottom panel of Figure 7.8 applied to Microsoft. The trendline is no longer in the same units as price; therefore, it cannot be plotted in the same panel as Microsoft prices. However, the double-smoothed trendline is very smooth, and the points at which the trends turn show less lag than any of the other methods. Trading signals should be generated from the trendline only, that is, buying when the trendline turns up and selling when it turns down. These methods are discussed in detail in Chapter 9 under the headings “True Strength Index” and “Double-Smoothed Stochastics.”
Comparison of Exponential Smoothing Methods The single and double exponential smoothing methods, including error corrections, can be entered into a spreadsheet and compared. A piece of that spreadsheet is shown in Table 7.8, and the entire spreadsheet is available on the Companion Website as TSM Comparison of exponentials MSFT. The methods are applied to Microsoft from August 1998 through February 2011. The first calculation in column 3 is the single exponential smoothing (Exp), followed by the double smoothing in column 4 (DblExp). The error for the single smoothing, the current price minus the corresponding exponential value, is in column 5 (Exp Err), followed by an exponential smoothing of those error values (Sm Err). The seventh column shows the single exponential with the smoothed errors
Time-Based TrendCalculations
305
added back (Corr Exp). In order to see the difference in the single smoothing and the error-corrected method, the last two columns indicate when the trends turn up or down based on the trendline changing direction. The error-corrected method is most sensitive to changing prices.
Regularization An interesting form of double smoothing is given by Mills and called exponential regularization.8 REMAt = where
REMAt−1 × (1 + 2 × w) + α × ( pt − REMAt−1 ) − w × REMAt−2 1+ w
p = price α = smoothing constant w = weighting factor
Nominally, both α and w are set to 9. A comparison of a 9-day standard exponential and the 9-day exponential regularization is shown in Figure 7.9, applied to weekly S&P data, 2007 through 2010. The regularized trendline is much smoother. The program TSM Exponential Regularization can be found on the Companion Website.
FIGURE 7.9 Comparison of a 9-day exponential smoothing with a 9-day exponential regularization (the smoother line), applied to the weekly S&P, 2007–2010.
8
Mark Mills, “Regularization” (in “Traders’ Tips”), Technical Analysis of Stocks & Commodities (July 2003).
306
TRADING SYSTEMS AND METHODS
FIGURE 7.10 The Hull Moving Average (slower trend in the top panel), compared with a double-smoothed 16-week simple moving average (top panel) and a double-smoothed exponential (20- and 5-week) in the bottom panel.
Hull Moving Average A double-smoothed method that uses linearly weighted averages and modified calculation periods, all applied to weekly data, is the Hull Moving Average (HMA).9 Beginning with the suggested period, p, of 16 weeks, three weighted averages use the original period, the square root of the period, and half the period, with the goal of shorting the period and reducing the lag. The calculation can be written as WAVG1 = WAVG (close, p) WAVG2 = WAVG (close, int(p/2)) HMA = WAVG(2 × WAVG2 – WAVG1, int(sqrt(p)) where
close = weekly closing prices p = calculation period WAVG = weighted average function (data series, period) int = integer portion function sqrt = square root function
The 16-week HMA can be compared with a traditional double smoothing, using a 20-week exponential smoothing followed by a 5-week smoothing, as shown in Figure 7.10. Applied to the S&P emini from December 2007 through July 2011, both of these are very
9 “The
Hull Moving Average,” The Technical Analyst, (July–September 2010).
307
Time-Based TrendCalculations
similar (the HMA is the slower trend in the top panel and the double smoothed average is at the bottom). A double-smoothed 16-week simple moving average is much more sensitive to price changes, as seen in the top panel. A program, TSM Hull Moving Average, can be found on the Companion Website.
PLOTTING LAGS AND LEADS
28.9 28.7 28.5 28.3 28.1 27.9 27.7 27.5 27.3 27.1 26.9
MSFT MA(20) Lead 2 Lead 4 Lag 2
1 01 /2 14 2/
20
11
1 7/ 2/
/2
01
1 31 1/
24
/2
01
1 01 1/
/2 17 1/
/2 10 1/
20 3/ 1/
01
1
Lag 4
11
Share Price
Moving averages, as well as any trend calculation, can be plotted with leads and lags, that is, forward or backward on a chart, each having a major impact on the interpretation. The conventional plot places the moving average value MAt directly above or below the last price pt used in the calculation. Any averaging or smoothing technique is said to be lagging actual price movement. When prices have been trending higher over the calculation period, the value MAt will be lower than the most recent price pt; therefore, it will be plotted below the actual prices. When prices are declining, the trendline will be plotted above the prices. Using a simple moving average as an example, the trend values can be plotted so they lead or lag the most recent price used in the calculation. If it is to lead by 3 days, the value MAt is plotted three periods ahead on the chart, on day t + 3; if it is to lag by 2 days, it is plotted at t – 2. In the case of leading moving averages, the analysis attempts to compensate for the time delay by treating the average as an n-day-ahead forecast rather than a concurrent statement of direction. A penetration of the forecasted line by the price may be used to signal a change of direction. The lag technique may serve the purpose of phasing the moving average, putting it in tune with a specific cycle. A 10-day moving average, when lagged by 5 days, will be plotted in the middle of the actual price data. This technique is covered later. Figure 7.11 shows Microsoft with a simple 1-day moving average plotted 2 and 4 days ahead as well as 2 and 4 days lagged.
FIGURE 7.11 Plotting a moving average lag and lead for a short period of Microsoft.
CHAPTER 8
T rend Systems
T
he previous chapters developed the tools for calculating trends—a traditional moving average, various weighted averages, exponential smoothing, and regression. To profit from identifying the trend requires the use of trading rules and the selection of specific parameters that define the trend speed and an acceptable level of risk, among other factors. This chapter first discusses those rules that are necessary to all trading strategies and then gives examples of actual systems. The selection of trend speed is handled only briefly here but is continued with a detailed analysis of these and other systems throughout the book, and especially in Chapter 21. It is most important to find trends that are robust, that is, that work across many markets and under varied economic conditions. At the same time they must satisfy an investor’s risk tolerance. It is a difficult balance. Trend systems are the preferred choice of Commodity Trading Advisors (CTAs). Some advisors are reported to be using the same systems devised in 1980. Barclay Hedge (BarclayHedge.com) reports that hedge funds had a total of $1,762.9 billion under management as of the first quarter of 2012, and managed futures totaling $328.9 billion. Investments from both institutions and individuals have been flowing into the industry at an increasing rate, up almost 500% since 2002.
WHY TREND SYSTEMS WORK Trend analysis is the basis for many successful trading programs, some with audited performance published for more than 30 years. Being able to identify the trend is also important if you are a discretionary trader looking to increase your chances for success by trading on “the right side of the market.” Trend systems work because • Long-term trends capture large price moves caused by fundamental factors. Economic trends are most often based on government interest rate policy, which is both slow to develop and persistent. In turn, interest rates directly affect foreign exchange, the trade balance, mortgage rates, carrying charges, and the stock market. 309
310
TRADING SYSTEMS AND METHODS
• Prices are not normally distributed but have a fat tail. The fat tail means that there is an unusually large number of directional price moves that are longer than would be expected if prices were randomly distributed. The fat tail will generate exceptional trend profits, which are essential to a trend system’s long-term success. • Money moves the markets. Most trends are supported by the flow of investor funds. While this causes short-term noise, it also delivers the long-term trends. As trends become clearer to the general public, additional money flows in to continue the trend. Trend trading works when the market is trending. It doesn’t work in markets that are not trending. There is no magic solution that will generate profits for trending strategies when prices are moving sideways, and there is no one trending technique that is always best. You’ll find that most trending methods have about the same returns over time but with different risk profiles. It is the risk profile and the trading frequency that distinguish one method from another, and those features will be discussed throughout this chapter.
How Often Do Markets Trend? Is there a way to measure how often markets trend? One analyst defines a trend as 10 consecutive closes in the same direction, but that seems arbitrary and a small window. What if there were nine days up and one small down day? A trend is a relative concept. It is relative to the trader’s time horizon, and it is relative to the amount of noise and price swings that are acceptable within the trending period. Ultimately, a trend exists if you can profit from the price moves using a trending strategy.
The Fat Tail The fat tail is a statistical phenomenon caused by a combination of market fundamentals and supported by human behavior. The net effect is that prices move in one direction much longer than can be explained by a random distribution. As a simple example, consider coin flipping as a classic way to produce a random distribution. In 100 coin tosses, • • • • • •
50 will be a head or a tail followed by the opposite head or tail. 25 will be two heads or two tails in a row. 12½ (if we could have halves tosses) will be three heads or three tails in a row. About 6 will be four heads or four tails in a row. About 3 will be five in a row. 1 or 2 will be six in a row of either heads or tails.
If price moves are substituted for coin flips, then heads would be a move up and tails a move down. If the pattern of up and down price moves follows a random distribution (and the up and down moves were of the same amount), then it would not be
311
T rend Systems
Random versus Actual Price Distribution 100 90 80 70
There are fewer runs at tthe e sshort ote end do of the distribution
60 50 40 30
The "fat tail" shows actual runs are longer than expected p
20 10 0 1
2
3
4
5
6
Random
7
8
9
10
11
12
Actual
FIGURE 8.1 Distribution of runs. The shaded area shows the normal distribution of random runs. The solid dark line represents the distribution when there is a fat tail. In the fat tail distribution, there are fewer short runs and an unusually large number of longer runs or a single exceptionally long run.
possible to profit from a trend system. But prices are not normally distributed. Price runs have a fat tail, which means that, instead of one run of 6 out of 100 days of trading, we may see a run of 12, or 3 runs of 6. That distribution is enough to make trend trading profitable. Another factor is that these long runs translate into very large trading profits. It is not necessary to have every day go in the same direction in order to profit, only that the downward reversals during an uptrend not be large enough to change the direction of the trend and end the trade. The more tolerance for the size of the interim reversals, the more likely the fat tail can be captured. If there are more runs of longer duration for every 100 daily price moves, what is the shape of the rest of the distribution? Figure 8.1 gives a theoretical representation of an actual price distribution compared to a random distribution. The extra movement that goes into creating the fat tail comes from the frequency of short runs. There are fewer runs of 1 and 2 and more runs greater than 6. The total remains the same. Readers interested in this subject should read the section “Gambling Techniques—The Theory of Runs” in Chapter 22.
Distribution of Profits and Losses As a trader, you would want to know “How often is there a profit from a fat tail?” To find the answer, we’ll apply the most basic trending system, a simple moving average that buys when the trendline turns up and sells short when it turns down. This will be
312
TRADING SYSTEMS AND METHODS
60 50 40 30 20
18750
17500
16250
15000
13750
12500
11250
8750
10000
7500
6250
5000
3750
2500
1250
–1250
–2500
–3750
10 –5000
Frequency of Occurrence
70
Starting Value of Bin
FIGURE 8.2 Frequency distribution of returns for S&P futures using a 40-day simple moving average strategy. Results show a fat tail to the right.
discussed in more detail in the next sections. For now we need to know that results depend on both the market and the calculation period. Applying a simple 40-day moving average strategy to five diverse futures markets, 30-year bonds, the S&P, the euro currency, crude oil, and gold, the results of individual trades can be collected and displayed as a histogram (frequency distribution). The results of the S&P are shown in Figure 8.2. In the frequency distribution, the bottom axis shows the starting value of the bins that hold the size of the profitable or losing trades, and the left scale shows the number of trades that fall into that bin. If the distribution was normal, then the shape would be a bell curve. This distribution is clearly extended far to the right, with one very large profit showing in the $18750 bin. That one profit offsets more than 30 losses in the largest bar marked −$1250. But the S&P is not the only market with this distribution; actually, the S&P has relatively smaller fat tails than other markets. Table 8.1 shows the distribution sample. The tails to the right are very long and those to the left very short. It is important to remember that a pure trend strategy needs this distribution to be profitable.
TABLE 8.1 Frequency Distribution for a Sample of Five Diverse Markets, Showing the Fat Tail to the Right and a Short Tail to the Left Bin
1
2
Bonds S&P Euro Crude Gold
0 2 1 0 0
2 2 0 3 1
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
8 17 53 27 6 12 58 17 2 4 4 7 26 75 20 22 92 2 0 4 4 8 20 70 16
3 2 2 0 4
2 3 2 1 0
3 1 3 0 2
1 0 1 0 0
0 0 0 0 3
0 1 2 0 0
1 1 1 0 0
1 0 1 0 0
0 0 0 0 0
0 0 0 0 0
0 0 2 1 1
1 0 0 0 0
0 1 0 0 0
T rend Systems
313
Time Intervals, Market Maturity, and Trends Trends are most easily seen using long-term charts, weekly rather than daily data, or daily T rather than hourly data. The farther you step back from a chart, the clearer the trend. If you display a daily chart, there will be some obvious trending periods and some equally clear sideways moves. Change that to a weekly chart, and the trends will seem much clearer. Change that to an hourly chart, and you’ll see mostly noise. Lower frequency data translate into better performance when using longer-term trends. While there are always fast trends that show profits in backtesting, they tend to be less stable and inconsistent in their returns. Trends using longer calculation periods are more likely to track economic policy, such as the progressive lowering of interest rates by the central bank or a plan to allow the currency to weaken in order to stimulate exports and reduce debt. Diverse markets may have very different trending qualities. Interest rate futures, money markets, and utility stocks are among the many investment vehicles closely tied to government rate policy and reflect the same long-term trend; this trend can persist for years. Foreign exchange is more complex and is constrained by monetary policy. Governments are more accepting of changes in the exchange rates if they occur slowly, but they will work hard to keep them within a target range. Most foreign exchange markets show clear but shorter trends compared to interest rates. The stock market presents another level of difficulty. Individual stocks are driven by many factors, including earnings, competition, government regulation, management competence, and consumer confidence. Because the volume of trading in individual shares may vary considerably from day to day, these factors do not often net out as a clear trend. Stock prices may run up sharply on anticipation of better earnings or approval of a new drug, and reverse just as quickly within a few days. Liquidity, or volume, is an important element in the existence of a steady trend. Individual stocks are also affected by concurrent trading in the index markets. When the S&P futures or the ETF SPY is bought and sold, all stocks within that index are bought and sold. If one company in the S&P 500 has just announced the loss of a major contract, but the overall market is strong, the share price of the suffering company may be dragged higher by arbitrage due to massive buying of the S&P index. This behavior makes for erratic price patterns in individual stocks. Emerging markets are the exception. The introduction of a new market, such as the fictitious East European Stock Index, would be lightly traded but may be very trending. Initial activity would be dominated by commercials, such as banks, all of which would have a similar opinion on the economy of Eastern Europe. A small number of traders with the same opinion will cause very clear trends in the price. As the general public starts to participate, it adds liquidity while it also introduces noise, which in turn makes the trends less clear. Finding the trend then requires a longer time interval. Readers interested in this process should review the discussion of noise in Chapter 1. When using a trending strategy, select both the markets and the time frame that work with you. Longer calculation periods, lower frequency data, and markets that are more closely linked to their underlying fundamentals will all perform better.
314
TRADING SYSTEMS AND METHODS
BASIC BUY AND SELL SIGNALS Trends are based on the average always lagging price movement. It is the advantage and the disadvantage of the method. As the calculation period gets larger, the average lags further. Figure 8.3 shows Amazon prices from April 2010 through February 2011 with a 40-day moving average. Clearly, the moving average smoothes prices. The basic idea behind using the moving average as a trend signal is to be long when prices are above the average and short when below. The rules are stated as • Buy when prices cross above the trendline. • Sell short when prices cross below the trendline. Even with these simple rules, there are important choices to be made. Do you buy at the moment rising prices cross the trendline during the trading session, or do you wait for the price to close above the trendline? As seen in Figure 8.3, prices may cross back and forth through the trendline before settling on a final direction. If you subscribe to the belief that the closing price of the day is the most reliable price, then the number of trading signals can be reduced by using the rules: • Buy when prices close above the trendline. • Sell short when prices close below the trend line. Another school of thought prefers the average of high and low prices, or the average of the high, low, and closing prices. A buy or short sale signal occurs when the (high + low)/2 or (high + low + close)/3 crosses above or below the current trendline value. In both of these cases, the averages could not be calculated until the end of the trading session because none of the three component values would be known until then.
FIGURE 8.3 Amazon (AMZN) with a 40-day moving average.
315
T rend Systems
Using the Trendline for Signals The trendline represents the netting of all prices. Its purpose is to remove the price noise and show you the underlying price direction. Then it seems more reasonable to use the trendline to generate the trading signal. The change in the value of the trendline from the previous calculation to the current one is its direction—up, down, or unchanged. The direction of the trendline is a candidate for generating trading signals. • Buy when the change in the trendline is up. • Sell short when the change in the trendline is down. The penalty for using the trendline as a trading signal is its lag. Figure 8.3 shows that, using a 40-day moving average, prices cross above the trendline during July a few days ahead of the point where the trendline turns up. The benefit using the trendline signal is that the trend turn is clear and more stable. During July and November, prices crossed back and forth through the trendline, but the trendline did not change direction; therefore, the trading signal remained the same.
Comparing Basic Trading Signals The main differences between using a price penetration or the trendline to generate signals is that the trendline produces fewer trading signals, and those signals are delayed. If Amazon prices are used as an example, both methods of entry can be compared for a sample of calculation periods to see if one approach is consistently better than the other. Although this is a single example, it represents the general case. As shown in Table 8.2, five calculation periods are used beginning with 5 days and doubling the period for each test. This maintains the percentage change in the calculation period and gives a better distribution sample (this is discussed further in Chapter 21). The two columns headed Number of Trades show that the trendline method has from
TABLE 8.2 Comparison of Entry Methods for 10 Years of Amazon (AMZN) Signals using the trendline direction are shown on the left, and price penetration on the right. Signal Using Trendline
Signal Using Price Cross
Trend Calculation Period
Total Profit/ Loss
Profit Factor
Number of Trades
Total Profit/ Loss
Profit Factor
Number of Trades
Increase in Trades
80 40 20 10 5
48.24 94.42 111.97 (87.67) (90.31)
1.34 1.46 1.45 0.81 0.84
84 120 196 292 439
57.16 32.21 (7.31) (90.82) (49.15)
1.31 1.12 0.98 0.82 0.92
106 164 252 370 597
26% 37% 29% 27% 36%
316
TRADING SYSTEMS AND METHODS
26% to 37% fewer trades and, for the most part, better performance. The Profit Factorr is the performance ratio used by TradeStation equal to the gross profits divided by the gross losses. While not as good as the information ratio or Sharpe ratio, the results allow you to compare performance. It appears that using the trendline signals is always better, but that is not necessarily the case. To be certain, you would need to compare a wide range of diverse markets rather than just Amazon. Even if these results seem compelling, it is always necessary to confirm the numbers to be confident of the answers and to be sure that you understand the process. While it seems convincing that the trendline is best for the slower trends, it is not as clear for faster trading. For the case using a 5-day moving average, both methods netted a loss, but the price penetration shows a smaller loss. It is very possible that, for faster trading, the lag in the trendline is too much of a burden to overcome and the price penetration is better. This will be discussed further in Chapter 16, Day Trading.
Anticipating the Trend Signal Consistency is important. The system that is tested and the one that is traded should be the same. In this book, the closing price is used for most of the calculations; however, any combination of open, high, low, and close could be substituted. The normal process for generating a trading signal is to wait until prices close, then calculate the new moving average or trendline value, then see whether a crossing occurred or the direction of the trendline changed according to the basic buy and sell rules. But using the closing price for the calculation of the entry signal implies that you could enter on the close. The process of waiting for the close price to perform the necessary calculations and generate a signal requires that orders be placed in the after-hours market or on the next open. While the trading system is indicating a new buy or sell signal as of the close of trading, you are entering the market significantly late. You are not following the system as it was tested. A practical solution to this dilemma is to record the prices shortly before the close, generate the trading signals, then enter the buy and sell orders for execution on the close. Occasionally, the order will be wrong because prices changed direction in the last few minutes of trading, but the cost of exiting the trade will usually be small compared to the improvement in overall execution. The other alternative is to calculate, in advance, the closing price that will generate a signal using either the trendline method or the price crossing method. For an n-day moving average the calculation is simple—the new moving average value will be greater than the previous value if today’s price is greater than the price dropped off n-days ago. Because all of the other values in the average remain the same except for the first and last, the answer only needs those two values. If a 40-day average is used and the oldest price pt−0 was 30.25, then any price greater than 30.25 today would cause the trendline to move up, and any price greater than 30.25 would also cause an upwards price penetration. Then an order can be placed in advance to buy at 30.26 stop.
T rend Systems
317
How important is this? A lot depends on the trending nature of the market. In Chapter 1, the discussion of market noise showed that the short-term interest rates had the lowest amount of noise, and the equity index markets had the most noise. Using the Eurodollar interest rates and the S&P 500 futures as the extremes, the method that enters using the trendline was compared when entries were taken on the current close, the next open, and the next close to assess the sensitivity of the total profits to entry delays. Table 8.3 shows the results. All Eurodollar results show a profit for trades entered on the close of the day that a signal occurred. Longer trend periods were generally more profitable, confirming the premise that trends are more dominant in the long term due to government policy. When entries were delayed to the next open or next close, the results were worse. This is best seen in the profit factors, which measure reward to risk rather than only total profits. The S&P is also clear but not as clean as Eurodollars. Equity index markets are noisy; that is, prices moving up are not expected to continue up for any sustained number of days. A new buy signal will usually happen on a day when prices are moving higher, but waiting until the next open or the next close could be better because of the noise. This was true for all calculation periods except 5 days. As for the calculation period, there was no particular pattern, although absolute losses were smaller as the trend period got longer, a modest confirmation that longer trends are better. We know from other tests and other markets that this limited example is generally true, but market characteristics always create exceptions.
Profile of a Simple Moving Average System Using the moving average trendline as the basis for system signals, we chose a 40-day calculation period because it tends to be the fastest one that also identifies the major price trends. The profile of results is typical of any moving average system. Figure 8.4 shows the NASDAQ 100 for one year, ending February 2011. Buy and sell signals are generated from the direction of the trendline; there were no transaction fees. The trading signals in Figure 8.4 show that the major upwards move is captured, but not before there are a number of false signals due to the trendline changes during sideways price periods. However, given enough tries, the trend surfaces, and the system gains a large profit, similar to the fat tail discussed at the beginning of this chapter. The profile of this NASDAQ example, shown in Table 8.4, is typical of longer-term trend-following systems. Of the 150 trades over 10 years, only 52 of them were profitable, about 35%. However, the average winning trade was much larger than the average losing trade, with a ratio of 2.22, and winning trades were held much longer than losing trades, supporting the adage “cut your losses and let your profits run.” Finally, there were more consecutive losses than consecutive profits, but that follows because there are many more losses. The performance picture is that trend following gets in and out quickly when it has a loss but holds the trade whenever trends and profits develop. This category of strategy is called conservation of capital, referring to the feature that cuts losses quickly.
318
Total Profit or Loss
16150 9603 7745 10773 3368
Calculation Period
80 40 20 10 5
2.87 1.61 1.37 1.40 1.09
Profit Factor
Today’s Close
16325 9050 6258 8765 (1715)
Total Profit or Loss
2.89 1.55 1.29 1.31 0.96
Profit Factor
Next Open
15630 9383 3850 1165 (870)
2.75 1.61 1.16 1.04 0.98
Profit Factor
Next Close Total Profit or Loss
Eurodollar Interest Rates
(12325) (29138) 13088 (27925) (21725)
Total Profit or Loss
0.87 0.75 1.12 0.83 0.90
Profit Factor
Today’s Close
(10463) (26013) 13900 (22738) (19588)
Total Profit or Loss
0.89 0.78 1.13 0.86 0.91
Profit Factor
Next Open
S&P 500
16363 5013 22738 (12550) (56350)
Total Profit or Loss
1.20 1.05 1.20 0.93 −0.76
Profit Factor
Next Close
Results vary with the trending nature of the market. Analysis uses 10 years of S&P and Eurodollar interest rate futures, back-adjusted, ending in February 2011.
TABLE 8.3 Comparison of Entries on the Close, Next Open, and Next Close
319
T rend Systems
FIGURE 8.4 A trend system for NASDAQ 100. Applying a 40-day moving average and taking the trading signals from the direction of trendline results gives a typical trend system profile.
We can generalize the trend-following profile as: • The percentage of profitable trades is low—often less than 30%. • The average winning trade must be significantly larger than the average losing trade; actually, given only 30% profitable trades, the ratio must be greater than 100:30 to be profitable. • The average winning trades are held much longer than losses. • There is a high frequency of losing trades; therefore, there are also long sequences of losing trades. There are many analysts that have a lifetime goal of improving these statistics, that is, capturing the long-term trend but improving the percentage of profitable trades. Some TABLE 8.4 Performance Statistics for NASDAQ Futures, 10 Years Ending February2011 Total profit Number of trades Number of winning trades Percentage of winning trades Average winning trade Average losing trade Win/loss ratio
$11,880 150 52 34.7% 1424.71 −41.28 2.22
Average bars in winners Average bars in losers
31.65 6.64
Consecutive winner Consecutive losses
6 10
320
TRADING SYSTEMS AND METHODS
small amount of success is possible but not without changing the risk characteristics of trend-following systems. For example, if you add profit-taking (discussed throughout the book) or stop-losses (Chapter 23), then you reduce or eliminate the chance of capturing the fat tail, which has been shown to be necessary for a long-term profit. Still, many traders do not like the idea of holding the trades for such a long time and giving back so much of the unrealized profits when the major trend changes direction. Different traders make different choices. A program to test the entry rules and execution options, including long-only, is TSM Moving Average, available on the Companion Website.
BANDS AND CHANNELS A good way to improve the reliability of signals without altering the overall trend profile is by constructing a band, or channel, around the trendline. It can be used to effectively slow down trading without sacrificing the biggest profits. If we accept the premise that the point of trend change is also the time of greatest indecision, then a simple way to avoid frequent false signals is by using a band.
Bands Formed by Highs and Lows The most natural band is one formed from the daily high and low prices. Instead of applying the n-day moving average to the closing prices, it is applied separately to the highs and lows. Long positions are entered when today’s high crosses the average of the highs and short sales when today’s low crosses the average of the lows. To get a broad view of whether this is an improvement to entry points, the two most extreme markets (the Eurodollar considered the trendiest and the S&P the noisiest) are tested for 10 years with the five calculation periods used in an earlier example. Results are shown in Table 8.5.
TABLE 8.5 Results of Using a Moving Average of the Highs and Lows, Compared to the Closes Eurodollar Interest Rates Close Crossing
S&P 500
High-Low
Close Crossing
High-Low
Calculation Period
Total Profit or Loss
Profit Factor
Total Profit or Loss
Profit Factor
Total Profit or Loss
Profit Factor
Total Profit or Loss
Profit Factor
80 40 20 10 5
16320 16035 10172 2727 7812
2.94 2.18 1.44 1.08 1.20
13842 15000 5167 3667 (337)
2.18 2.02 1.20 1.11 0.99
30027 (10337) 5987 (49000) (106950)
1.54 0.91 1.05 0.76 0.64
36443 12402 16512 (33751) (43760)
1.74 1.14 1.15 0.82 0.81
321
T rend Systems
For a highly trending market, such as the Eurodollar interest rates, entering later, on a penetration of either the highs or lows, is not as good as entering on a price penetration of the close. If this had not been determined from the noise study in Chapter 1, these results would cause us to draw the same conclusion. Just the opposite is seen in the S&P results. Waiting longer to enter improves results noticeably, and, in the case of the 40-day trend, it turns a loss into a profit. We can conclude that a band can be a profitable variation to a simple trend system, but not for all markets. The next question is “Are there other bands that work better?”
Keltner Channels One of the original band calculations was by Keltner,1 which goes as follows: (Average daily price) (10-day moving average) (Upper band) (Lower band)
APt = (H (Ht + Lt + Ct)/3 MAt = average(C Ct,10) UBt = MAt + APt LBt = MAt + APt
These days we would tend to use true range, rather than the high-low range as a better representation of volatility.
Percentage Bands Another simple construction is a percentage band, formed by adding and subtracting the same percentage of price from the trendline based on the closing prices. If c is the percentage to be used (where c = 0.03 means 3%), then (Upper band) BU = (1 + c) × MAt (Lower band) BL = (1 − c) × MAt where
MAt = today’s moving average value
Therefore, if the moving average value for Merck (MRK) is $33, and the band is 3%, then the upper band is 33.99 and the lower band is 32.01. Because the moving average is much smoother than the price series, the band will be uniform around the moving average, narrowing and widening slightly as prices decline and rise. The band can be more sensitive to change if the current price pt is used to calculate the band instead of the moving average trendline. The bands are then (Upper band) BU = (1 + c) × pt−1 + MAt (Lower band) BL = (1 − c) × pt−1 + MAt 1
Chester W. Keltner, How to Make Money in Commodities (Kansas City, MO: The Keltner Statistical Service, 1960).
322
TRADING SYSTEMS AND METHODS
The band is still oriented around the moving average trendline to prevent it from jumping up and down too often. Using the price to generate the band also requires that yesterday’s price be used; otherwise the band would never be penetrated. Using a percentage band would work for stocks but not for futures. Most futures analysis uses backadjusted data, and if the carry is mostly negative, then the oldest back-adjusted data could actually become negative. That doesn’t affect a moving average trading signal, but it does make any percentage price calculation wrong. Back-adjusted historic prices are simply not correct. If only a small buffer zone is needed, rather than one that adjusts over time, then a band based on absolute point value could be used. For example, stocks trading between $20 and $40 could have a $1 band. If your goal is to avoid a few very small variations around the time of trend change, then an absolute point value band may be a simple alternative solution.
Volatility Bands To the degree that volatility increases as prices increase, the percentage band is a volatility band; however, that relationship is both long term and not as good as actually measuring the individual volatility for many stocks and futures markets. Regardless of the method, creating a band that is responsive to volatility may improve the reliability of trend signals. The independent smoothing of the high and low prices over any calculation period forms a natural volatility band. Although it may be practical to use the same smoothing technique or the same calculation period as the underlying trend (e.g., 10-day or 10% smoothing constant) for the high, low, and closing prices, it is not a requirement. If the same smoothing criterion is used, the band will be uniform with respect to the moving average of the closing price; if not, all three trendlines may weave around one another, which creates some practical problems. There are many choices for measuring volatility and creating a band around the trendline. All of the methods of forming bands are subject to scaling. Scaling is accomplished by using a constant value as a multiplier or scaling factor; it increases or reduces the sensitivity of the band. If s is a scaling factor and c is a fixed percentage, then the following bands can be constructed: Bt = MAt ± s × c × MAt Bt = MAt ± s × c × pt Bt = MAt ± s × ATRt−1 × MAt Bt = MAt ± s × stdevt−1 × MAt
(Percentage of trendline) (Percentage of price) (Average true range) (Standard deviation)
When s = 1, the scaling effect is nullified; for s > 1, the width of the band is increased; and for s < 1, the band width is reduced. In the choices above, MA was used to indicate a moving average, but any method of calculating the trend can be substituted, such as an exponential smoothing or a regression. Figure 8.5 shows the four types of bands applied to the S&P futures. All use a scaling factor of 2, which may be too close for some methods
323
T rend Systems
(c) Moving Average
(a)
(d) (b)
FIGURE 8.5 Four volatility bands around a 20-day moving average, based on, (a) 2% of trendline, (b) 2% of price, (c) 2 × average true range, and (d) annualized 20-day volatility.
and too far for others. The purpose of the chart is to show the relative shape of the bands and distance from the prices. In Figure 8.5 the center line is a 20-day moving average. The first two methods of calculating bands, the percentage of trendline and percentage of price, are almost identical, very smooth, and are the farthest from the center. The next band closer to the moving average is the average true range. It moves slightly farther apart when prices are more volatile. The band closest to the trendline is the annualized volatility, which is most sensitive to price changes. Because the same scaling factor produces bands that are different for each method, it is difficult to compare them without finding the scaling factors that come closest to average band width for each technique. The bigger decision is whether it is more sensible to use a very smooth band or one that reacts to changes in price volatility. That decision is up to each trader. It may be convenient to have separate exit and entry bands, the entries less sensitive than the exits so that the strategy exits quickly but enters slowly. Or, if the entry occurs on a penetration of the band, but the exit is based on the trendline, then trades are not reversed from long to short. That improves slippage because only half the number of shares or contracts are traded on each order, and may avoid some false signals.
Bollinger Bands Perhaps the simplest and most robust measurement of price volatility is the standard deviation of the prices themselves, calculated over recent price history. This was the last method listed in the previous section. John Bollinger has popularized the combination of a 20-day moving average with bands formed using 2 standard deviations of the price changes over the same 20 day period. They are now frequently called
324
TRADING SYSTEMS AND METHODS
FIGURE 8.6 Bollinger bands applied to Ford.
Bollinger bands.2 Because the standard deviation represents a confidence level, and prices are not normally distributed, the choice of two standard deviations equates to an 87% confidence band (if prices were normally distributed, two standard deviations would contain 95.4% of the data). In their normal use, Bollinger bands are combined with other techniques to identify extreme price levels. These are discussed later in this section. Figure 8.6 shows Ford (F) plotted with a traditional Bollinger band. One of the characteristics of this band is that, once the price moves outside either the upper or lower band, it remains outside for a number of days in a row. This type of pattern was typical of what used to be called high momentum. Note that the width of the band varies considerably with the volatility of prices and that a period of high volatility causes a “bubble,” which extends past the period where volatility declines. These features and more about volatility will be discussed in Chapter 20. Figure 8.6 was created using the TradeStation indicator Bollinger Bands, which lets you vary both the calculation period for the trend and the number of standard deviations. But then, if it’s not a 20-day average and 2 standard deviations, it’s not a Bollinger band. Bollinger bands can also be applied effectively to multiple time frames. An excellent example that uses a combination of weekly and daily data applied to the S&P 500 is seen in Figure 8.7. The price pattern follows the weekly Bollinger band higher, where the daily and weekly prices come together during the week of July 14. Modified Bollinger Bands One of the significant problems with Bollinger bands, as well as any volatility measure based on historic data, is that the bands will expand after increasing volatility but are 2
John A. Bollinger, Bollinger Capital Management, Inc. P.O. Box 3358, Manhattan Beach, CA 90266, www.bollingerbands.com. Also Bollinger on Bollinger Bands (New York: McGraw-Hill, 2001).
325
T rend Systems
FIGURE 8.7 Combining daily and weekly Bollinger bands. Source:: Chart created using The Fibonacci Trader by Robert Krausz. Used with permission from Fibonacci Trader Corporation, St. Augustine, FL. www.fibonaccitrader.com.
slow to narrow as volatility declines. An excellent correction3 for this requires the following calculations for the center line, D, Mt = α × Ct + (1 − α) × Mt−1 Ut = α × Mt + (1 − α) × Ut−1 ( 2 − α ) × Mt − Ut Dt = 1−α where C is the closing price and α is the smoothing constant, set to 0.15 to approximate a 20-day moving average. In order to correct the bulge in the bands following a volatile period, the upper and lower bands (BU ( U and BL) are calculated as mt = α × Ct
Dt + (1 − α ) × mt −1
ut = α × mt + (1 − α) × ut−1 3
Dennis McNicholl, “Better Bollinger Bands,” Futures (October 1998).
326
TRADING SYSTEMS AND METHODS
FIGURE 8.8 Modified Bollinger bands shown with original bands (lighter lines), applied to gold futures, February–August 2009.
dt =
( 2 − α ) × mt − ut
1−α BU Ut = Dt + f × dt BLt = Dt − f × dt where f is the multiplier for the width of the band, suggested at 2.5 compared to Bollinger’s 2.0. Figure 8.8 shows the modified Bollinger bands along with the original (lighter lines) for gold futures during the first part of 2009. While the new bands do not remove the bulge, they are faster to correct and more uniform in the way they envelop prices. Programs to calculate and display the original and modified bands are TSM Bollinger bands and TSM Bollinger Modified, available on the Companion Website.
Rules for Using Bands Regardless of the type of band that is constructed, rules for using bands to generate trading signals are limited. The first decision to be made is whether the trading strategy is one that is always in the market (a reversal strategy), changing from long to short and back again as the bands are penetrated. If so, the following rules apply: • Buy (close out shorts and go long) when the prices close above the upper band. • Sell short (close out longs and go short) when the prices close below the lower band. This technique is always in the market with a maximum risk (without execution costs) equal to the width of the band, which changes each day (see Figure 8.9). Alternately, you may prefer to exit from each trade when prices move into the zone between the bands or when prices cross the original trendline.
327
T rend Systems
FIGURE 8.9
Simple reversal rules for using bands.
• Buy (go long) when prices close above the upper band. Close out longs when prices reverse and close below the moving average value (the center of the band). • Sell short when prices close below the lower band. Cover your shorts when prices close above the moving average value. The band is then used to enter into new long or short trades, and the actual trendline at the center of the band is used for liquidation. If prices are not strong enough to penetrate the opposite band on the close of the same day, the trade is closed out but not reversed. The next day, penetration of either the upper or lower band will signal a new long or short trade, respectively. This technique allows a trade to be reentered in the same direction in the event of a false trend change. If a pullback occurs after a close-out while no position is being held (as shown in Figure 8.10), an entry at a later date might be at a better price. It also reduces
CLOSE-OUT
BUY d
an
rB
e pp
U
SELL
ge
ra ve
gA
vin
Mo
L
d
an
rB
e ow
Stay neutral
FIGURE 8.10 Basic rules for using bands.
328
TRADING SYSTEMS AND METHODS
the order size by 50%, which is likely to improve the execution price and add liquidity for large traders. The disadvantage is when the price changes direction and moves so fast that both the close-out and the new signal occur on the same day. Reversing the position immediately would be better in a fast market. The high and low of the day may also be used as penetration criteria. Again using the outer bands for entry and the moving average for exit, apply the following rules: • Buy when the high of the day penetrates the upper band, and close out longs when the low of the day penetrates the moving average. • Sell short when the low of the day penetrates the lower band, and cover shorts when the high penetrates the moving average. Using the trendline as an exit, risk is limited to half of the full band width. If the bands are narrow, there is a greater chance that an entry on an intraday high might also see an exit below the trendline on the close of the same day.
Timing the Order The type of execution order placed when following a system will affect its results over the long term. The use of a moving average band identifies a change of trend when a breakout occurs. Buying at the point of the upside breakout or selling during a downside breakout often results in poor entry prices, and has been known to place the trader in a new trend at the point where prices are ready for a technical correction. In an attempt to overcome these problems, a number of rules can be used: • • • • •
Buy (or sell) on the close after an entry (intraday) signal has been indicated. Buy (or sell) on the next day’s open following a signal. Buy (or sell) with a delay of 1, 2, or 3 days after the signal. Buy (or sell) after a price retracement of 50% (or some other value) following a signal. Buy (or sell) when prices move to within a specified risk level relative to a reversal or exit point.
The object is to enter a new position and see an immediate profit, or reduce risk. Some of these rules can be categorized as timing and others as risk management. If intraday prices are used to signal new entries and exits, a rule may be added that states: Only one order can be executed in one day; either the liquidation of a current position or an entry into a new position. While better entry points will improve overall performance, an entry rule that is contingent on price action, such as a pullback, risks the possibility of not entering at all. A contingent order that is missed is guaranteed to be a profit. It might be better to combine the entry order, for example, Buy (or sell) after prices reverse by 0.50 × ATR or enter on the next close.
T rend Systems
329
Once you have decided on a timing rule, you must test it carefully. The perception of improvement does not always live up to expectations. In tests on trend-following systems conducted over many years, positions calculated on the close but delayed until the next open improved execution prices about 75% of the time but resulted in smaller overall total profits. Why? Fast breakouts that never retrace result in missed trades. Therefore, while three out of four executions returned a better price by a small amount, those improvements were often offset by the profitable breakouts that were never entered.
The Compromise between Reliability and Delay As with most trading techniques, the benefits of one approach can also have negative factors. The use of a band around a trendline improves the reliability of the trading signal and reduces the total number of signals. The wider the band, the fewer signals. Both of these characteristics are significant benefits. But wider bands mean delayed entries; therefore, you cannot capture as much of the trend, and the average profits will be smaller. If the bands are too wide, then the average profits can decline to zero. The use of wider bands also means greater risk on each trade. It will be necessary to trade smaller positions or capitalize the account with a larger investment. These are serious choices that must be made with every trading program. Although there are classic solutions to this problem discussed in Chapters 23 and 24, traders must choose the methods that complement their risk preference.
Bollinger on Bollinger Bands While most trading strategies buy when there is an upwards penetration of the top band and sell when prices move below the lower band, the use of Bollinger bands is usually mean-reverting, or counter to the price direction. However, this can be unnecessarily risky, especially when prices are volatile. Bollinger recommends confirming a downside penetration using other indicators, primarily those based on volume and market breadth. If prices are moving lower but volume is not increasing and negative breadth is not confirming the downward move, then a buy signal is realistic.4 Bollinger uses the concept that volatility is cyclic, but without a regular period. He sees very low volatility as a forecast for high volatility and very high volatility forecasting low volatility, similar to the way traders use the CME Volatility Index (VIX). Based on this, a major price rally with dramatically higher volatility, that expands the bandwidth to extremes, should be sold when the bandwidth begins to narrow. This only applies to upwards price moves.
4
John Bollinger, “John Bollinger of Bollinger Bands Fame,” Technical Analysis of Stocks & Commodities (May 2002).
330
TRADING SYSTEMS AND METHODS
Combining Bollinger with Other Indicators Williams5 suggests that a number of indicators can be combined to capture volatile moves after a price contraction, using: 1. A standard 20-day, 2-standard deviation Bollinger band 2. A 20-day Keltner Channel 3. A 21-day Chaikin Oscillator to monitor the flow of funds
To enter a long position, the following conditions must be satisfied: • The Bollinger bands constrict to inside the Keltner Channel while the Chaikin Oscillator is below zero. • The Chaikin Oscillator crosses above the zero line. For shorts, • The Bollinger bands constrict to inside the Keltner Channel while the Chaikin Oscillator is above zero. • The Chaikin Oscillator crosses below the zero line.
APPLICATIONS OF A SINGLE TREND For any trend technique, the selection of the calculation period—the interval over which you will define the trend—is the most important decision in the ultimate success of the trading system. Entry rules and timing improve performance but are considered refinements. The calculation period determines the frequency of trading and the nature of the underlying trend that will be targeted. Deciding the calculation period is more important than the method of identifying the trend. You can be profitable using a simple moving average, regression, breakout, or any other technique—if you can settle on the right time interval. The previous sections have used examples of calculation periods without any claim that one time interval was better than another. We have discussed that the long-term trend mimics government policy of interest rates or economic growth; therefore, there is good reason to choose a longer calculation period. We also saw that the trends were clearer when looking at a weekly chart rather than at a daily, and it was not clear that an intraday chart had any persistent trends. But for most traders, the risk of using this long time frame is unacceptable; they prefer smaller profits and smaller losses associated with
5
Billy Williams, “Biting Off Profits with the Rattlesnake Breakout Method,” Futures (October 2010).
T rend Systems
331
faster trading. There is now strategy development software that makes it easy to test a range of calculation periods to find the one that performed best in the past. This technique is called optimization and is discussed in Chapter 21. But the power of the computer is not always as good as simple human reasoning and common sense. The computer is best for validating an idea, not for discovering one. Before the computer, analysts struggled with the same problem of finding the best calculation period. At first, the trend period was based on multiples of calendar periods, such as a week or a month, expressed as trading days. When these techniques were limited to a small group of analysts, these approaches were very successful. Many traders still subscribe to the idea that certain time intervals have value. The most popular calculation periods have been: 3 days, the expected duration of a short price move; 5 days, a trading week; 20 to 23 days, a trading month; 63 days, a calendar quarter; and of course, 252 days, a calendar year. Implied volatility calculations traditionally use 20 days. It is not clear where the 200-day moving average, used for stocks, came from. More recently, a class of adaptive trends has appeared. These techniques attempt to change the speed of the trend based on a characteristic of price movement, such as volatility or noise. These techniques are another alternative to optimization and are discussed in Chapter 17. The following sections include classic examples of well-known systems that use one trend, as well as a comparison of trading performance of the most popular single-trend techniques over a broad range of calculation periods.
A Simple Momentum m System In Chapter 7 the n-day momentum was defined as the change in price over n days. It’s not actually “momentum” but that is the term commonly used by the industry. The simplest trend system is the one that buys when the n-day change is positive and sells when the n-day change is negative. For large values of n, the results will be surprisingly similar to a simple moving average system; therefore we will not give examples here. Keep in mind that momentum can be very effective even as it is very simple.
A Step-Weighted Moving Average In 1972, Robert Joel Taylor published the “Major Price Trend Directional Indicator” (MPTDI), which was reprinted in summary form in the September 1973 Commodities Magazine (now Futures). The system was promoted and implemented through Enterex Commodities in Dallas and was tested in 1972 on historical data provided by Dunn and Hargitt Financial Services in West Lafayette, Indiana. It was one of the few welldefined published systems and served as the basis for much experimentation for current technicians and aspiring analysts. MPTDI is a moving average with a band. Its unique feature is that the calculation period and band width change based on price volatility, the current trading range. Because
332
TRADING SYSTEMS AND METHODS
TABLE 8.6 MPTDI Variables for Gold* Average Trading Range
Number of Days in Calculation
WeightingFactors Progression
50–150 150–250 250–350 350–450 450+
2–5 days 20 days 15 days 10 days 5 days
TYPE A TYPE B TYPE C TYPE D TYPE E
Entry Signal Penetration
100 200 250 350 450
pts pts pts pts pts
Approximate Stop-Loss Point
150 300 350 450 550
pts pts pts pts pts
*100 points = $1 per ounce.
the method has distinct trading range thresholds (called steps), the method is called a step-weighted moving average. It is unique in its complete dependence on incremental values for all aspects of the system: the moving average, entry, and stop-loss points. For example, Table 8.6 shows what conditions might be assigned to gold. If gold were trading in an average range of 250 to 350 points each day ($2.50 to $3.50 per ounce, but remember this was 1972), the weighting factor for the moving average would be TYPE C, indicating medium volatility (TYPE A is lowest). Using TYPE C with a 15-day moving average, the most recent 5 days are given the weight 3, the next 5 days 2, and the last 5 days are weighted by 1. The entry signals use the corresponding penetration of 250 points above the moving average for a buy and 250 below for a sell. The intraday highs or lows are used to trigger the entry based on values calculated after the close of trading on the prior day. A stop-loss is fixed at the time of entry equal to the value on the same line as the selected volatility. The penetration of the stop-loss will cause the liquidation of the current trade. A new signal in the reverse direction will serve as both the exit for the current trade and the entry for a new trade. There is a lot to say in favor of the principles of MPTDI. It is individualized with respect to markets and self-adjusting to changing volatility. The stop-loss serves to limit the initial risk of the trade and allow the coordination of a money management approach. The fixed risk differs from moving averages using standard bands because a moving average and its band can back away from system entry points if there is a gradual reversal of the price trend. But there are some rough edges to the system. The incremental ranges for volatility, entry points, and stops seem to be a crude measure. Even if they are accurate in the center of the range, they must get less accurate at the extremes where volatility causes an abrupt change in parameter values when it moves from one range to another. MPTDI sets the groundwork for a smoother, more adaptive process. Before such a process can be developed, however, it is necessary to study price movement at discrete levels, such as those shown in MPTDI. From discrete relationships it is possible to generalize a continuous relationship. These methods are covered in Chapter 17.
333
T rend Systems
The Volatility System Another method that includes volatility and is computationally simple is the Volatility System.6 Signals are generated when a price change is accompanied by an unusually large move relative to average volatility. If the average volatility measured over n days is Vt =
1 t ∑ TRRi n i=t− n +1
where TRi is the true range on day i and Vt is the called the average true range on day t (defined in Chapter 5). Trading rules are given as • Sell if the close drops by more than k × V( V n)t−1 from the previous close. • Buy if the close rises by more than k × V( V n)t−1 from the previous close. The value of k is generally about 3.0. Note that the current price change is always compared to the previous volatility calculation.
The 10-Day Moving Average Rule The most basic application of a moving average system was proposed by Keltner in his 1960 publication, How to Make Money in Commodities. Of three mechanical systems presented by Keltner, his choice of a moving average was based on performance and experience. The system itself is quite simple, a 10-day moving average using the average of the daily high, low, and closing prices, with a band on each side formed from the 10-day moving average of the high-low range (similar to a 10-day average true range). A buy signal occurs on penetration of the upper band and a sell signal when the lower band is broken; positions are always reversed. The 10-Day Moving Average Rule is basic, but it does apply the fundamental volatility principle by using the high-low range as a band, and serves as an early example of moving averages. Keltner expresses his preference for this particular technique because of its identification of minor rather than medium- or long-term trends, and there are some performance figures that substantiate his conclusion. As an experienced trader, he prefers the speed of the 10-day moving average, which follows the market prices with more reasonable risk than slower methods. A side benefit to the selection is that the usual division required by a moving average calculation can be substituted by a simple shift of the decimal place; in an era before the pocket calculator, who knows how much impact that convenience had on Keltner’s choice. The history of prices now shows us that price movement was much smoother up to the end of the 1970s and has been getting noisier ever since. A 10-day moving average, supplemented by a volatility band, was truly the state-of-the-art technology. While the 6
Richard Bookstaber, The Complete Investment Book (Glenview, IL: Scott, Foresman, 1984), 231.
334
TRADING SYSTEMS AND METHODS
shorter calculation periods are not generally successful for current price moves, the use of volatility to create bands has held up well over time.
TRIX, X Triple Exponential Smoothing A triple exponential smoothing technique was first described by Hutson as another approach to trend following7 and over the years has gained in popularity. Called TRIX, X it first takes the log of the price to account for growth and then applies an exponential smoothing three times using the same smoothing constant. A buy signal is generated when the triple-smoothed trendline rises for two consecutive days; a sell signal followed a 2-day decline in the trendline. The exponential smoothing process usually starts by setting the initial trend value E10 = p0, but in this case E10 = ln p0. The rest of the process is E1t = E1t−1 + s × (ln pt − E1t−1) E2t = E2t−1 + s × (E ( 1t − E2t−1) E t = E3 E3 E t−1 + s × (E ( 2t − E1t−1) TRIX = (E (E3t − E3 E t−1) × 10000 This original approach has seen some variations over the years. The most significant is not using the log of prices, but changing the final step to a percentage change. The percentage change at the end speeds up the process. In all cases, the smoothing constant should represent a short time period, less than 20 days, but recommended as 6 days. The number of days is converted to a smoothing constant using s = 2/(n + 1). The alternative calculation is E1t = E1t−1 + s × ( pt − E1t−1) E2t = E2t−1 + s × (E ( 1t − E2t−1) E t = E3 E3 E t−1 + s × (E ( 2t − E1t−1) TRIX Xt = (E (E3t − E3 E t−1)/E / t−1 A signal line is created by taking the 3-day moving average of the most recent TRIX values. A buy occurs when TRIX crosses above the signal line and a sell when it crosses below the signal line. Using a signal line is a technique that will be seen with other momentum indicators. A 9-day TRIX is shown in the lower part of Figure 8.11 corresponding to the price of the EURUSD (euro currency). The final step that takes the difference between the current and previous TRIX value shifts the indicator so that it does not have the lag that would be expected, yet it is still smooth. The effect of the weighting on price data caused by double and triple smoothing was discussed in Chapter 7. Readers that are interested in similar methods should refer to Blau’s True Strength Index x and True Directional Movement.
7 Jack
K. Hutson, “Good TRIX,” Technical Analysis of Stocks & Commodities (July 1983).
335
T rend Systems
FIGURE 8.11 A 9-day TRIX based on euro futures shows that a triple smoothing does not create the lag that would be expected.
Raschke’s First Cross Although we usually trade a trend from the beginning to end based on some smoothing method, Linda Bradford Raschke has shown that a selected piece of the trend move can be a very reliable trade. It is also necessary to introduce the idea of momentum, which will be the subject of the next chapter. Her First Cross system enters a trend trade on the first pullback after an initial trend signal based on a faster momentum indicator. Momentum will be used here as the difference between two trends. To create this strategy we need slowMA fastMA osc trend
Slow moving average Fast moving average Moving average oscillator Moving average of oscillator
The oscillatorr is the difference between the fast- and slow-moving averages osc = fastMA − slowMA
A buy or sell entry signal is a 3-step process (comments on right): B1. B2. B3. S1. S2. S3.
osct−1 > trendt and osct lowt−1 Buy osct−1 < trendt and osct closet−2 closet < closet−1 Exit long
previous close turns up (confirms trend) the current close turns down
Raschke’s idea is an excellent example of selectivity. First, you recognize that the beginning of a trend is unique event. As traders recognize a change of direction, the move strengthens. Because most systems lag the market, they are often too late in capturing initial profits. As an alternative, this technique waits for the first move to be exhausted and then enters in anticipation of another surge as the new trend reasserts itself. Once these early moves are over, the general trend move may not be as easy to work with, and you may find yourself trying to enter as the trend comes to an end.
COMPARISON OF MAJOR TREND SYSTEMS Trend strategies dominate the world of algorithm trading and managed futures in particular. But which method is the best? As we will see later in this book, there are many rules that can be added to a basic trend strategy including stop-losses, profit-taking, and entry timing, that change both the returns and the risk profile. There are cases where an underlying losing strategy can be turned profitable by risk management or clever timing rules; however, it is always best to start with a sound trend-following method that has the risk characteristics most acceptable to you. This chapter will not draw conclusions about which trending method is best. It may be that there is no best strategy, only trade-offs between risk and reward, fast or slow. By testing a small sample of markets for the same time period and a selection of calculation periods, we can understand how the major trending methods differ. The most popular approaches, two event-driven (discussed in Chapter 5) and four time-driven are: 1. M, M N N-day momentum 2. MA, Simple moving average 3. EXP, Exponential smoothing 4. NDB, N N-day breakout 5. SWG, Swing breakout 6. LRS, Linear regression slope
The markets used will be IBM, Ford, and Bank of America representing the equities, and Eurodollar interest rates, the S&P 500, the euro currency (EURUSD), and crude oil
T rend Systems
337
futures markets. The data for equities has been adjusted for splits, and the futures are continuous, back-adjusted. Neither of these data adjustments affects the trend calculations or trading signals. The time period will be the most recent 20 years. For the timebased systems, the calculation periods will begin at 5 and test every 5-day interval up to 160. If it wasn’t so easy to do this in a test platform, we could get a representative sample by starting at 5 and doubling in order to keep the percentage change the same, such as 5, 10, 20, 40, 80, and 160. That would also remove the distortion if we were to look at average results, because the longer calculation periods, which are very similar, would outweigh the shorter periods. For the swing method, a varying percentage swing size will be used, starting at 0.25% and doubling to 4%. The data used was from CSI and the testing was done using TradeStation. All tests begin trading on the same date, even though the 5-day test needs less data to start the calculations than the 160-day test.
Trading Rules To see the characteristics of each system, the trading rules will be as simple as possible. Only the basic buy and sell signals will be used (where sell is both exiting longs and selling short). All six systems are always in the market. That is, once they enter a long or short position, they always reverse on a new signal, going from long to short, or short to long. There are no stop-losses or other risk controls; therefore, each system will show its own, natural risk profile. All entries and exits are done at the closing price. A $20 transaction charge was applied to each futures trade, and $0.01 per share for each stock trade to cover commissions and slippage. Without a transaction charge, the very fast trading systems will show much better results than they can achieve in real trading. The following is a brief description of the type of system, calculation method, and trading rules. Note that, for MA, EXP, and LRS, the trading signal is based on the direction of the trendline. 1. M, M N N-day momentum a. Buy when closet > closet−n b. Sell when closet < closet−n 2. MA, Simple moving average a. Buy when MAt > MAt−1 b. Sell when MAt < MAt−1 3. EXP, Exponential smoothing. a. Buy when Expt > Expt−1 b. Sell when Expt < Expt−1 4. NDB, N N-day breakout a. Buy when hight > highest(high,t−1,n) and closet > closet−1 b. Sell when lowt < lowest(low,t−1,n) and closet < closet−1
338
TRADING SYSTEMS AND METHODS
5. SWG, Swing breakout a. Buy when the current swing high > previous swing high b. Sell when the current swing low < previous swing low 6. LRS, Linear regression slope a. Buy when Slope(close,t,n) > 0 b. Sell when Slope(close,t,n) < 0
In the rules described above, the functions highest and slope use the parameters ((price, current day, calculation period), then highest(high, t−1, n) will return the highest high for the n days ending on the previous day, t−1.
Spreadsheet Example A spreadsheet is an easy way of seeing the returns of all but the swing method. The function OFFSET T allows the calculation period (located in F3) to be changed, resulting in all calculations and returns changing. It is a simple way of allowing different calculation periods to be tested. The calculations for the other five can be done in a single column, using the following setup and instructions: 1. Column A is the date. 2. Columns B, C, D, and E are the open, high, low, and closing prices. 3. F3 has the calculation period that will be used for all five strategies. 4. Column F calculates the momentum as = E163 − OFFSET(E163, −$F$3,0). Calculations
begin in row 163 because there will be a maximum of 160 days allowed. 5. Column G is the moving average = AVERAGE(E163: OFFSET(E163, −$F$3,0)). 6. Column H is the exponential smoothing, = H162 + $H$3*(E163 − H162). Cell $H$3 =
2/(F2 + 1), the standard conversion from days to smoothing constant. 7. Column I is the regression slope = SLOPE(E163:OFFSET(E163, −$F$3,0),A163:
OFFSET(A163,−$F$3,0)). 8. Column J records if the most recent breakout is up (+1) or down (−1) = IF(E163 >
MAX(E162: OFFSET(E162, −$F$3,0)),1,IF(E163 < MIN(E162: OFFSET(E162, −$F$3,0)), −1,“”)). The next five columns, K–O, show the continuous trend direction (+1 or −1) based on the calculations in F–J. Once there is an initial direction, the cells are either +1 or −1. The breakout strategy, column J, takes 77 days before the first trend can be identified. The last five columns give the cumulative profit or loss in points; that is, there is no conversion to dollars. For the Eurodollar interest rates, the futures market conversion is $2500 per big point, making a move from 97.00 to 98.00 worth $2,500. No commissions are used, although those costs could significantly affect the comparison. Results for Eurodollars, the S&P, and IBM can be found in three spreadsheets, TSM Trend Systems Comparisons ED/SP/IBM, M available on the Companion Website.
339
T rend Systems
Cumulative Returns in Points
Eurodollar Rates Trend Comparison, 160-day period 30 25 20
Mom
15
MovAvg
10
Exp
5
Slope
N-Day BO
10
08 1/
2/
20
06 1/
2/
20
04 1/
2/
20
02 1/
2/
20
00 1/
2/
20
98 1/
2/
20
96 1/
2/
19
94 1/
2/
19
92
19
1/
2/
19 2/
1/
1/
2/
19
90
–5
FIGURE 8.12 Cumulative returns of Eurodollar futures for the five spreadsheet strategies.
Spreadsheet Results of Eurodollars, the S&P, and IBM Figure 8.12 shows the cumulative returns of the Eurodollar futures using the 160-day calculation period, the longest to be tested. Over the 20-year test period, the moving average performed the best, with the n-day breakout second and the n-day momentum at the bottom. The best returned about 26 points and the worst about 11 points. In dollars, that would range from a simple return of $3250 to $1375 per year. For an investment of three times the typical initial margin of $1500, that gives a return of 72% and 30% per annum. Of course, there is no commission and no slippage used, and Eurodollars have the most trending characteristics, so this should not be taken as representative of all performance. A more complete review will follow in the next section. By observing the performance pattern of the five systems, we can draw some interesting and valuable conclusions: • Long-term trend following can be profitable. • All basic trending strategies are profitable if the market trends. • When adding other features to a system, it needs to be proved that those features improve the results, because the simple approach seems to be very good. S&P The S&P is a much noisier market than Eurodollars, which shows in the Figure 8.13 performance. Again, the moving average leads with the momentum showing the only outright loss over the test period. The jump in the moving average performance was the result of entering a short sale on April 24, 2007, and holding it until October 16, 2008. While this shows the advantage of the long-term trend, most traders would find it difficult to watch the weekly and monthly fluctuations in their equity over this holding period.
340
TRADING SYSTEMS AND METHODS
5000 4000 3000
Mom
2000
MovAvg
1000
Exp
Slope
–1000
N-Day BO
10
08 1/
2/
20
06 1/
2/
20
04 1/
2/
20
02 1/
2/
20
00 1/
2/
20
98 1/
2/
20
96 1/
2/
19
94 1/
2/
19
92
19 2/
1/
2/
2/
1/
1/
19
90
–2000
19
Cumulative Returns in Points
S&P emini Trend Comparison, 160-day period
FIGURE 8.13 Comparative trend results for the S&P emini futures.
IBM The last example in Figure 8.14 is IBM, which should bear some relationship to the S&P, given that it is a high-cap stock and must also be a relatively noisy market. In fact, these results show that all returns are worse than the S&P index, with the moving average the only profitable method. It is likely that the index smoothes out the erratic moves of individual stocks. But a brief look at the results using only one calculation period doesn’t show the whole picture.
Comparative Results For comparison, four futures markets will be used, Eurodollar interest rates (ED), euro currency (CU), the S&P (SP), and crude oil (CL), and three stocks, IBM, Bank of America
400 300 200
Mom
100
MovAvg
Exp
–100
Slope
–200
N-Day BO
3/
2 8/ 00 0 3/ 2 8/ 00 1 3/ 2 8/ 00 2 3/ 2 8/ 00 3 3/ 2 8/ 00 4 3/ 2 8/ 00 5 3/ 2 8/ 00 6 3/ 2 8/ 00 7 3/ 2 8/ 00 8 3/ 2 8/ 00 9 3/ 20 10
99 8/
3/
8/
3/ 8/
19
98
–300
19
Cumulative Returns in $/share
IBM Trend Comparison, 160-day period
FIGURE 8.14 Comparative trend results for IBM from August 1998 through February 2011.
341
T rend Systems
Moving Average Net Profits—Stocks Net Profits in $/share
300 200 100 0
IBM
–100
BAC F
–200 –300 5 15 25 35 45 55 65 75 85 95 105 115 125 135 145 155 Calculation Period
FIGURE 8.15a
Moving average net profits for futures markets, 20 years ending February 2011.
Moving Average Net Profits—Futures Net Profits in $/contract
250000 200000 150000 100000
ED
50000
CU
0 –50000
SP
–100000
CL
–150000
5 15 25 35 45 55 65 75 85 95 105 115 125 135 145 155 Calculation Period
FIGURE 8.15b
Moving average net profits, 12 years ending February
2011.
(BAC), and Ford (F). The test results will be shown as charts because visualization makes it easier to understand. The first comparison is net profit because everyone wants to know how much each system and each market will return. Looking only at the moving average tests (Figure 8.15b), Eurodollars, the euro, and crude oil are profitable to different degrees across most of the calculation periods, but tend to lose in the very short-term. The S&P generates mostly losses but more in the short-term. The three stocks show losses for nearly all periods (see Figure 8.15a). In terms of consistency, the Eurodollar interest rates stand out as very stable from 25 to 160 days compared to the other six tests. This can be attributed to its relatively low noise compared to all other markets, as discussed in Chapter 2. Because equity markets are at the other end of the noise spectrum, trends are more likely to fail. Is this conclusion the same over all trending methods, or is one better than another for specific markets?
342
TRADING SYSTEMS AND METHODS
Different Trend Philosophies The moving average, exponential, and linear regression are traditional time-series processes, that is, the price of one day is a small part of the total calculation. This can make it very difficult for a single large price jump to cause a change in the direction of the trend and, consequently, the trading signal. It also introduces a lag. For very fast trends, each price will have more importance than for slower trends. The n-day breakout and swing breakout systems are triggered on new highs and lows; therefore, a single big price move often causes a new signal. Breakout systems can be considered event-driven, while a moving average system requires a trend to evolve. Because an event-driven system gives a signal at the moment prices make new highs or lows, there is no lag.
Different Risk Profiles The biggest difference in the trend methods is in their risk profiles. Even when the returns are similar, the risk of the moving average technique is remarkably different from the breakout methods. While the information ratio (annualized return divided by annualized risk) is the best way to distinguish one system from another, the profit factorr (gross profits divided by gross losses) was the only measurement available for these tests; however, the results will still give a good idea of the relative difference in performance. Figure 8.16a shows the profit factors for the Eurodollar interest rate futures for 5 of the 6 methods, all based on the same calculation periods. Data is for 20 years through 2011. Figure 8.16b shows the profit factors for the swing method, which varies the percentage swing size. Even though we recognize the Eurodollar as a highly trending market, the similarity in the profit factors is remarkable. The n-day breakout seems to be slightly better than the other methods, but all of them are clustered together, improving at the same rate as the calculation period increases. This brings up the question “Does it really matter which trend method we use?” Are trend profits the result of a clever formula, or is it the market that controls the result? The swing method has a problem for interest rates because tests are based on varying the percentage swing. But rates are quoted in prices, not yields, so volatility goes down as prices go up. Figure 8.16b shows that, using the range of percentage swings that work for other markets, the results using prices had no trades when the swing was above 1.375%. Using the yield, by subtracting the price from 100, gave trades everywhere but had poor returns. This example is included here to point out that any analysis of interest rate futures prices that use percentages will be a problem. Based on the profit factor, five of the systems look the same for the Eurodollar interest rates. Other markets are not as consistent. The euro currency, Figures 8.17a and b, show that the n-day breakout is quite different for long calculation periods. The rules of the breakout only change positions on new highs and lows, and a calculation period over 125 days is equal to 6 months. Then a new long is set on a high above the highest price of the past 6 months and not exiting until a new low of the past 6 months. That can create a lot of risk. The same is true, to some degree, of the swing method. A swing of 5% in crude oil at $30/bbl is $1.50, but at $100/bbl it’s $5.00. Even though a percentage swing is somewhat self-adjusting in sensitivity, the risk continues to increase (see Figures 8.18a and b).
343
Profit Factor
T rend Systems
Mom MovAv vg Exp Slope N-Day BO
Calculation Period
Profit Factor
FIGURE 8.16a Profit factors for five of the systems show that returns improve as the calculation period increases.
Swing Percentage
FIGURE 8.16b Profit factors for the swing method for interest rate markets use a percentage of either price or yield.
The S&P, along with the euro and crude oil, shows similar profit factors for all trend methods from the fastest calculation periods through about 85 days (see Figures 8.19a and b). After that returns begin to diverge and become more erratic. The n-day breakout is consistently the best for longer periods, but also highly variable. But that’s still not the whole story. The frequency of trades, the percentage of profitable trades, and the average profit highlight the differences in the methods. Using only the euro currency as an example because it seems most representative, Figure 8.20a shows the number of trades for each calculation period, Figure 8.20b the percentage of profitable
344
TRADING SYSTEMS AND METHODS
Euro—Profit Factor 6
Profit Factor
5 4
Mom
3
MovAvg
2
Exp Slope
1 155
145
135
125
115
105
95
85
75
65
55
45
35
25
15
5
N-Day BO 0
Calculation Period
FIGURE 8.17a Euro currency futures profit factors for 5 trend systems over a range of calculation periods for 20 years through 2011.
Euro—Profit Factor 3.5 Profit Factor
3 2.5 2 1.5 SWG
1 0.5 0.125 0.375 0.625 0.875 1.125 1.375 1.625 1.875 2.125 2.375 2.625 2.875 3.125 3.375 3.625 3.875 4.125 4.375 4.625 4.875
Swing Size (in percent)
FIGURE 8.17b Euro currency profit factors for swing method, continuous futures, 20 years through 2011.
trades, and Figure 8.20c the average profit per trade. Again, the breakout system stands out as having less than half the number of trades of the other trend methods. If we use the moving average as an example, prices can move up and down at the time of the trend change causing frequent buy and sell signals until a new trend is decided. These losses are small, but there can be many of them. The risk of a trade in the breakout system is the difference between the n-day high and n-day low, which can be very large but not likely to be reached often. Then we would expect fewer trades and larger losses for the breakout system. The percentage of profitable trades, also called reliability, varies considerably for each method with the moving average and momentum results showing the lowest reliability at about 34% (results are almost identical) and the breakout system at the top with just under 50%. The slope and exponential smoothing are both about 43%. This chart tells
345
T rend Systems
Crude Oil Profit Factors 6 Profit Factor
5 4
Mom
3
MovAvg
2
Exp Slope
1 155
145
135
125
105
115
95
85
75
65
55
45
35
25
15
N-Day BO 5
Calculation Period
FIGURE 8.18a Crude oil futures, profit factors for 5 trending systems, 20years through 2011
Crude Oil Swing Profit Factor 1.6 Profit Factor
1.5 1.4 1.3 1.2 1.1
SWG
1 0.8
0.125 0.375 0.625 0.875 1.125 1.375 1.625 1.875 2.125 2.375 2.625 2.875 3.125 3.375 3.625 3.875 4.125 4.375 4.625 4.875
0.9
Swing Percentage
FIGURE 8.18b Crude oil futures, profit factors for swing method, 20 years through 2011.
us that, although the breakout system holds trades longer and has greater risk, it is more likely to end with a profit. The last chart, average profit per trade, reflects the holding period of the methods. The longer you hold a trade, the larger the average profit, although the average risk will also get larger. The moving average, exponential smoothing, and momentum are all similar and almost indistinguishable on the chart. The regression slope has much larger profits. But the breakout stands alone as having very large profits at all calculation periods. The initial results that we saw, using the simplified spreadsheet and a calculation period of 160 days, are not as clear as when we see more of the system profile. The moving average is still a consistent top performer, but the breakout often has higher returns at the same time it has higher risk. One thing is clear—all of these trend systems are profitable in the long term.
346
TRADING SYSTEMS AND METHODS
S&P Profit Factor 3
Profit Factor
2.5 Mom
2
MovAvg 1.5
Exp Slope
1 155
145
135
125
115
95
105
85
75
65
55
45
35
25
5
N-Day BO 15
0.5
Calculation Period
FIGURE 8.19a
S&P futures, profit factors for 5 trend systems, 20 years
through 2011.
S&P Profit Factors 1.2 Profit Factor
1.1 1 0.9 0.8 SWG
0.7 0.5
0.125 0.375 0.625 0.875 1.125 1.375 1.625 1.875 2.125 2.375 2.625 2.875 3.125 3.375 3.625 3.875 4.125 4.375 4.625 4.875
0.6
Swing Percentage
FIGURE 8.19b S&P futures, profit factors for swing method, 20 years through 2011.
Viewing the Big Picture When trying to decide how fast or slow to trade, it is important to recognize that shorter calculation periods result in more trades, smaller profits per trade, and more sensitivity to transaction costs, slippage, and commission. Even for the euro currency, which is a moderately trending market, fast trading lowers the profits per trade to a marginal amount, which tends to lower the profit factor as well. In Figure 8.21 the five systems are all shown in terms of the number of trades (frequency of trading) and the resulting profit factors. The chart shows that calculation periods that produced more than 200 trades in 20 years were not as good as slower choices.
Expectations Expectations help us recognize when test results are wrong and, even more important, when actual trading varies too far from test results. Common sense goes a long way toward
347
T rend Systems
Euro—Number of Trades
Number of Trades
1200 1000 800
Mom
600
MovAvg Exp
400
Slope
200 0
N-Day BO 5 15 25 35 45 55 65 75 85 95 105 115 125 135 145 155 Calculation Period
FIGURE 8.20a Euro currency futures, 20 years through 2011, number of trades.
Percentage of Profitable Trades
Euro—Percentage of Profitable Trades 65 60 55 50
Mom
45
MovAvg
40
Exp
35
Slope
30
N-Day BO
25
5 15 25 35 45 55 65 75 85 95 105 115 125 135 145 155 Calculation Period
FIGURE 8.20b Percentage of profitable trades.
Average Profit per Trade (USD)
Euro—Average Profit per Trade 10000 8000 Mom
6000
MovAvg 4000
Exp
2000
Slope N-Day BO
0 –2000 5 15 25 35 45 55 65 75 85 95 105 115 125 135 145 155 Calculation Period
FIGURE 8.20c Average profit per trade.
348
Profit Factor
TRADING SYSTEMS AND METHODS
Number of Trades
FIGURE 8.21 Euro profit factors versus number of trades, for the five strategies combined, shows that fewer trades yield much higher profit factors. Profit factors below 1.0 are losses.
keeping your work correct. Consider an engineer who is building a bridge over a large river. The data entry clerk incorrectly enters a value with the decimal shifted to the left one place. The final plans show a 10-foot bridge over a 100-foot river. Fortunately, the engineer had estimated the results and expected an answer between 80 and 120. When different systems are tested for different calculation periods, we should have a good idea of the expected results. Fast and slow trading each has its own patterns; breakout and moving averages have distinct risk profiles. Understanding these differences is important to success.
Robust Testing To get the most value from these tests, there needs to be as much consistency as possible between tests. The following standards were used: 1. Test periods. All markets and all tests used the same 20-year period, ending February
2011. More data are always better, and data that include bull markets, bear markets, and sideways markets are necessary to get the best idea of how a system performs. 2. Tests start on the same date regardless of the calculation period. All tests should be-
gin on the same date as the test with the longest wind-up period, in this case 160 days. 3. Range of trend speeds. The calculation periods should produce tests that range from
only a few trades to many. It should not be necessary to fall below two or three trades per year, or more than 100 per year. Those combinations are unlikely to be traded. 4. Use realistic costs. Costs matter because you cannot trade for free. If your costs are too high, then you might turn a profitable system into a loss, and if the costs are too
T rend Systems
349
low, then you will have unrealistically optimistic results. Try to use costs that represent actual trading. 5. Type of results. In the previous sections, the results were shown as net profits, profit factor, number of trades, average trade profit, and the percentage of profitable trades. If you could only choose one, then the profit factor, or information ratio, is the most important. Those statistics give you the returns relative to the risk and allow you to compare trading strategies on an equal basis. The complete testing process is discussed in Chapter 21.
Which System Is Best? We come back to the question that started this study of various trend-following strategies, “Which system is best?” Of the sample of markets and methods, the moving average and the n-day breakout seem to be the best choices but with two completely different profiles. The moving average has many more trades and many losses, with a few large profits. It is considered a conservation-of-capital approach. The breakout system tends to be more reliable and has much larger profits per trade but does it by taking very large risk. The linear regression slope seems to be somewhere in between. Many traders prefer the returns of the breakout system but find the risk too high and the time holding the trade too long. You might think of trading a 100-day breakout as investing rather than trading. Although a moving average takes losses sooner, it holds the biggest winners for even longer. Traders are always looking for a way to take advantage of the long-term trend but not hold the trade as long and not take as much risk. This will be discussed in the next section. The answer is “There is no best system, only trade-offs.” Every investor has a different risk tolerance. Some traders need to trade a system that has a high percentage of profitable trades, and others want only small losses. It is important to start building a strategy using an underlying method that satisfies your goals.
Programs for the Six Systems In addition to the spreadsheet that gives comparative performance of the six systems, there are individual programs on the Companion Website that will provide much more detail. TSM Momentum TSM Moving Average TSM Exponential TSM N-Day Breakout TSM LinReg Slope TSM Swing The moving average program gets signals from the trendline rather than a price penetration. Each program has useful options.
350
TRADING SYSTEMS AND METHODS
TECHNIQUES USING TWO TRENDLINES There are many situations where two trends of different calculation periods can solve a problem better than one. It is often the case that there is a dominant, long-term trend driven by government interest rate policy. Trends based on fiscal policy can last for years and can be very successful. Most traders, however, are not likely to hold a single longterm trade for the full period of its move. Even if convinced of the ultimate outcome of the trade, there can be very large price swings along the way. Most traders would rather enter and exit the market many times, in the direction of the longer-term trend, each time taking a small profit but with much smaller risk. The final result may be lower total profits, but a much more comfortable risk level for each trade. This problem can be solved with two simple moving averages or a combination of any two trendlines of different speeds. The slower trendline, using a longer calculation period, identifies the primary trend. The faster trendline is used for timing. The faster signal does not have to be a trend at all; it can be pattern recognition or any timing method. In this section, we will use the same trending techniques previously discussed to create a system. The longer calculation period will represent the major trend and the shorter period will be used for timing. Consider the idea that a good entry point is when there is a recent short-term surge of prices in the direction of the major trend. To implement this plan, select two moving averages, one noticeably faster than the other, and apply one of the following sets of rules (also shown in Figure 8.22). 1. Buy when the faster moving average crosses the slower moving average going up.
Sell short when the faster moving average crosses the slower moving average going down. 2. Buy when the current price crosses above both moving averages and close out long
positions when prices cross below eitherr moving average. Sell short when the current price crosses below both moving averages, and close out short positions when prices cross above eitherr moving average. 3. Buy when the faster trendline turns up and the slower trendline is up. Sell short
when the faster trendline turns down and the slower trendline is down. Exit the trade when the two trendlines are moving in opposite directions. The first set of rules always has a position in the market, going from long to short and back again as the faster trend crosses the long-term trend. The second and third sets of rules create a neutral zone, where no position is held. Rule 2 attempts to extract the stronger part of the price move based on price, while Rule 3 looks for both trends to provide confirmation. Exiting a trade, rather than reversing, adds liquidity by reducing the order size and allows you to enter the next trade in the same direction as the previous one, instead of always reversing. To further reduce the problem of whipsaws caused by erratic penetration of the trendlines in Rule 2, yet maintain a faster response to price change than Rule 3, a small band
351
T rend Systems
Sell
Buy
Exit long (a)
Sell Buy
Exit short (b)
Exit long
Sell
Buy
(c)
Exit short
FIGURE 8.22 Three ways to trade systems using two moving averages. (a) Enter and exit when the trendlines cross. (b) Buy and sell when the price crosses the trendlines, staying out of the market when prices are between the trendlines. (c) Enter when both trendlines are moving in the same direction; exit when they conflict.
can be placed around each of the trendlines. Prices must move higher through the upper band before a buy signal occurs and then back through the lower band before that signal is reversed. It is a small safety zone that can eliminate the frequency of bad trades in proportion to the size of the band. With this technique you would want the band to be small; otherwise, you will interfere with the natural process that is the benefit of the two trendlines.
352
TRADING SYSTEMS AND METHODS
Donchian’s 5- and 20-Day Moving Average System The method claiming one of the longest recorded trading histories, beginning January 1, 1961, is Donchian’s 5- and 20-Day Moving Average.8 In 1961, when moving averages were considered state-of-the-art, there was less noise, and agricultural markets were the most liquid. The equivalent of a 1- and 4-week moving average would have worked well. Even now, the use of calendar periods—such as 21 and 63 days for a month and a quarter, respectively—may pick up trends driven by the action of major fund managers as they rebalance their portfolio each month, and also respond to price direction resulting from quarterly earnings reports. Donchian’s idea was to use a volatility-penetration criterion relative to the 20-day moving average, but with some added complication. The current price penetration must not only cross the 20-day moving average but also exceed any previous 1-day penetration of a closing price by at least one volatility measure. In this way Donchian places a flexible band around the 20-day trendline. One volatility measure can be calculated as the average true range over one or more days. The 5-day moving average serves as a liquidation criterion (along with others) and is also modified by prior penetration and volatility. These features tend to make Donchian’s approach an early rendition of self-adjusting rules. To maintain a human element, Donchian requires execution of certain orders to be delayed a day if the signals occurred on specific weekdays or before a holiday. The combination of different factors was the result of refinement over years of actual operation. Rather than try to implement Donchian’s idea exactly, the program TSM Donchian Moving Average System, available on the Companion Website, uses the calculations: 1. A 5-day moving average 2. A 20-day moving average 3. The average true range based on the longer moving average
These three calculations are then used with the rules • If position is not long and Closet > MA5t−1 + 1ATRt−1 and closet > MA20t−1 + 1ATRt−1 then buy • If position is not short and Closet < MA5t−1 − 1ATRt−1 and closet < MA20t−1 − 1ATRt−1 then sell short • If position is long and (Closet < MA5t−1 − 1ATRt−1 or closet < MA20t−1 − 1ATRt−1) then exit long position • If position is short and (Closet > MA5t−1 + 1ATRt−1 or closet > MA20t−1 + 1ATRt−1) then cover short position
8
Richard D. Donchian, “Donchian’s 5- and 20-Day Moving Averages,’’ Commodities Magazine (December 1974).
353
T rend Systems
35000000 Cumulative PL
30000000 25000000 20000000 15000000 10000000 5000000 0
12
/2 12 9/1 /2 96 12 9/1 0 /2 96 12 9/1 3 /2 96 12 9/1 6 /2 96 12 9/1 9 /2 97 12 9/1 2 /2 97 12 9/1 5 /2 97 12 9/1 8 /2 98 12 9/1 1 /2 98 12 9/1 4 /2 98 12 9/1 7 /2 99 12 9/1 0 /2 99 12 9/1 3 /2 99 12 9/1 6 /2 99 12 9/2 9 /2 00 12 9/2 2 /2 00 9/ 5 20 08
–5000000
FIGURE 8.23 Donchian’s 5- and 20-Day Moving Average System (somewhat modernized) applied to corn futures from 1960.
Because the price level and volatility of the market have changed dramatically since 1960, new positions should be sized according their volatility Position size = Investment/(ATR × Big Point Value) Where ATR is calculated over the longer moving average period and the Big Point Value is the conversion factor for a futures contract, for example $50 for corn and $1000 for U.S. bonds. How did this strategy perform? Applying these rules to corn, which would have been the primary market during the 1960s, and without costs (which were much higher until the mid-1990s), the cumulative profits are shown in Figure 8.23. Although the rate of return has slowed, it seems remarkable that a simple method could have been consistently profitable for 50 years. For those analysts who are interested, the program on the Companion Website allows the calculation periods to change as well as the penetration factor. Only corn was run for this example, and no parameters were tested or changed.
Donchian’s 20- and 40-Day Breakout One level slower than the 5- and 20-day average is Donchian’s 20- and 40-Day Breakout. Instead of 1 week and 1 month, this looks at 1 month and 2 months. The method is far less complicated and only considers simple breakouts rather than using volatility bands. The rules are Buy when today’s high > high of the past 40 days Sell short when today’s low < low of the past 40 days Exit longs when today’s low < low of the past 20 days Exit shorts when today’s high > high of the past 20 days Readers will recognize that this is the basis for the Turtle’s trading method.
354
TRADING SYSTEMS AND METHODS
The Golden Cross and the Death Cross The most popular stock market trending methods are the simplest, which does not mean they don’t work. Of course, the 200-day moving average is shown as the key technical indicator on most financial networks, but 50, 100, and 200 days are equally popular. It is not clear how these began, but doubling the period is a simple way of keeping percentage changes the same and getting a good distribution of results over time. The Golden Cross is the point at which the 50-day average crosses above the 200-day average indicating the beginning of a bullish move in the market. It has yielded very good results for the past 60 years and avoided the damaging declines of 2008. When the 50-day average crosses below the 200 day, it is ominously called the Death Cross. In Figure 8.24, the results of Golden Cross are compared to the passive returns of the S&P index (SPX) and continuous futures, remembering that SPX cannot be traded. When the trend signal indicates a short sale, the 1-day returns of the 3-month T-bill rate are used for the daily returns. A spreadsheet named TSM Golden Cross can be found on the Companion Website. For the 11 years beginning mid-1999, the passive return of the stock market was a loss of 7.8%. During the same period, the Golden Cross returned 66.7% using SPX and 36.7% using futures. While the cash index can be traded as the ETF SPY, the futures contract is reasonable alternative. In addition, futures can be leveraged considerably, increasing the returns (and the risk). All the calculations are shown in the Golden Cross spreadsheet, but the way in which the returns of continuous futures are matched to SPX needs some explanation. While the daily returns of SPX are calculated as ln( pt / pt−1), continuous futures are back adjusted and values can become negative. The annualized volatility of SPX was calculated in the classic way (see Chapter 2), but the annualized volatility of the futures was calculated based on the daily change in dollar value of the futures contract.
Passive SPX SPX
5/20/2010
5/20/2009
5/20/2008
5/20/2007
5/20/2006
5/20/2005
5/20/2004
5/20/2003
5/20/2002
5/20/2001
SP futures 5/20/2000
5/20/1999
NAV
Golden Cross 200 180 160 140 120 100 80 60 40 20 0
FIGURE 8.24 The Golden Cross applied to the S&P index (SPX) and continuous futures compared to the passive returns of SPX.
T rend Systems
355
1. Begin with an arbitrary, but large, investment size 2. Calculate the daily returns based on the initial investment size 3. Calculate the rolling 20-day annualized volatility of the returns 4. Find the factor needed to make the annualized volatility 12% 5. Multiply the current returns by the previous volatility factor 6. Create the NAVs from the volatility-adjusted returns
In Figure 8.24 the annualized volatility of SPX is 11.5%, and the volatility of the futures returns is 10.9%. The process of adjusting the portfolio volatility is discussed in detail in Chapters 23 and 24. ROC Method Another classic method for trading the major index is Woodshedder’s long-term indicator.9 The rules are • Buy when the 5-day ROC (rate-of-change) is below the 252-day ROC for two consecutive days. • Exit the long when the 5-day ROC is above the 252-day ROC for two consecutive days. • When there is no position, the system earns one-half of the cash 3-month T-bill rate. In Figure 8.25, the results are compared to the Golden Cross, both using SPY as the basis for trading, from April 15, 1994 (the first available data for SPY plus the 252-day windup), through September 2011. No costs were charged although SPY has administrative cost included. The ROC method far outperformed the Golden Cross even with an annualized volatility of 14.1% compared to the Golden Cross volatility of 10.5%. Note that trading the SPY gave better returns than SP futures, shown in Figure 8.25.
Staying Ahead of the Crowd There is always an attempt to find out where others are placing their orders and get ahead of them. For example, if you know that most trend-followers are using a 30-day calculation period, then using a 28-day average might edge them out. During the 1980s and 1990s there was a trend system that used 8 and 18 days to beat the 10 and 20 days that was most popular. The following calculations would use fastperiod = 8 and slowperiod = 18. The differenceperiod = 9. FasterAverage = Average(close, fastperiod) SlowerAverage = Average(close,slowperiod) 9
The Woodshedderr blog can be found at www.ibankcoin.com/woodshedderblog and covers many other strategies. This method was reviewed by MarketSci blog on October 4, 2011, but used SPX (the cash index) rather than SPY.
356
TRADING SYSTEMS AND METHODS
700 600
NAV
500 400 ROC Method
300
Golden Cross
200 100 4/15/1993 4/15/1994 4/15/1995 4/15/1996 4/15/1997 4/15/1998 4/15/1999 4/15/2000 4/15/2001 4/15/2002 4/15/2003 4/15/2004 4/15/2005 4/15/2006 4/15/2007 4/15/2008 4/15/2009 4/15/2010 4/15/2011
FIGURE 8.25 Comparison of Golden Cross and ROC Method using SPY.
TrendDifference = FasterAverage − SlowerAverage DifferenceAverage = Average(TrendDifference,differenceperiod) The trading rules were Buy when today’s TrendDifference > yesterday’s DifferenceAverage Sell short when today’s TrendDifference < yesterday’s DifferenceAverage Although these calculation periods may not be profitable in today’s markets, the idea of being slightly ahead of the crowd can give you free exposure, a small jump in profits caused by many orders following yours. If you can figure out where the crowd is buying and selling, then this concept will give you an edge.
MULTIPLE TRENDS AND COMMON SENSE If two trendlines can improve trading, it should follow that three or more are even better—but there may be more problems than benefits. Many analysts subscribe to the idea that simpler is better. A single moving average may not have a high percentage of profitable trades but the longer-term periods work because they capture the fat tail. With the use of two trends, the number of combinations expands rapidly. Is there a best relationship between the slower speed and the faster one, that is, should the faster trend period be ¼ of the slower? Certainly, a 38- and 40-day combination will not offer much value, but is a 10-day and 40-day the right combination? Consider something else. If a 10-day trend is not profitable, and a 20-day trend is not profitable, each taken on their own, but the combination is profitable, would you trade
357
T rend Systems
TABLE 8.7 Comparison of 1 and 2 Trend Systems, Eurodollar Interest Rate Futures, 1990–2011 Trend
60 20 Both
Number of Trades
Days Held
Total Profit
Ratio
Avg Trade Profit
%Prof Trades
164 350 254
31 16 16
16537 21737 15310
1.65 1.44 1.50
149 62 92
22.5 31.0 34.6
it? These questions will be addressed in Chapter 21, but some of the concepts should be clear now. If, by computer testing, we were to “discover” that a combination of 2 or 3 trends was profitable, would you be convinced to trade it? Not likely, unless a very large percentage of the combinations were profitable or each trend served a particular purpose and had a calculation period that reflected that purpose. For example, if longer-term trends are intended to track macro fundamental policy and were generally profitable, then that longer-term period would be a good candidate for one of the trends. But those trades can be held for months, and you don’t like that profile, so you want a shorter trend to tell you when to get in and out of that trade, always holding a position in the direction of the long-term trend. Using Eurodollars with 60-day and 20-day trends over the past 20 years, with a $40 round-turn cost, Table 8.7 shows the change in performance. Both single trends do very well, but the 60-day holds trades for an average of 31 days, about 1½ months. The 20-day trend would be better, but the average profit per trade is only $62. By combining the two trends and trading only in the direction of the long-term trend, the profits per trade jump to $92, and the days held remain the same as the 20-day trend. Overall, you get slightly worse performance than the long-term trend but hold the trade for half the time. That makes sense because you are only trading the longs rather than both longs and shorts. Another benefit of the two-trend method is that you are in the market only 50% of the time. That reduces your risk, especially the risk of a price shock. That is a benefit not to be taken lightly.
Three Trends Is there a rationale for more than two trends? If the long-term trend is for market direction, and the shorter one is to reduce the length of the holding period, then the third could be using for entry timing. The third trend could be very fast, perhaps 3 days. Gerald Appel10 adds three rate-of-change (ROC) indicators together (actually momentum, the difference between the price today and the price n days ago), and applies the composite to the S&P index (SPX), all expressed in percent. He recommends buying
10
Gerald Appel, Technical Analysis: Power Tool for Active Traders (Upper Saddle River, NJ: FT Prentice Hall, 2005), 59.
358
TRADING SYSTEMS AND METHODS
when the composite crosses above 4% and exiting when it falls below 4%. If you consider the upwards bias in the S&P, the 4% threshold may not be arbitrary.
Modified 3-Crossover Model The justification for using three trends is that one or more slower moving averages may result in a buy or sell signal at a time when the prices are actually moving opposite to the position that is about to be entered. This may happen if the trading signal is generated when the two moving average lines cross, rather than when price move through the averages. The slope of a third, faster moving average, MA3t − MA3t−1, can be used as a confirmation of direction to avoid entry into a trade that is going the wrong way. This filter can be added to any moving average or multiple moving average system with the following rule: Do not enter a new long (or short) position unless the slope of the confirming moving average (the change in the moving average value from the prior day to today) was up (or down). The speed of this third, confirming moving average only makes sense if it is equal to or faster than the fastest of the trends used in the Crossover System. A program to test the three-trend model is TSM Modified 3MA Cross, available on the Companion Website. In earlier tests of the 3-Crossover method compared to the 2-Crossover, results showed that the added timing in the 3-Crossover reduced the number of trades and increased the size of the returns per contract. Overall, the profitability remained about the same.
4-9-18 Crossover Model During the late 1970s, the 4-9-18 Crossover model was very popular. It seems likely that the selection of 4, 9, and 18 days was a conscious effort to be slightly ahead of the 5, 10, and 20 days frequently used in moving average systems during that period. It is also likely to have been the outcome of the first computerized testing. Even now, high frequency traders continue to look for the smallest edge that keeps them ahead of the competition. In addition to the marginally faster calculation periods each moving average is (nearly) twice the speed of the prior, enhancing their uniqueness for recognizing different trends. Increasing the period in this way keeps a constant percentage difference. To get an idea of how three trends compare to either one or two trends, a small test was run using Eurobund futures from 1990 to mid-2011. Granted this is a trending market, and one test does not reflect the big picture; nevertheless, the results, shown in Table 8.8, were unexpected. Because we already know that faster trends are not performing as well in recent years as they did in the 1970s, the test of Eurobunds compared a 40-day and an 80-day calculation period with a 40-80-day crossover and a 20-40-80-day combination. The 3-crossover method outperformed all others but also reduced the number of trades by emphasizing the trend direction.
359
T rend Systems
TABLE 8.8
Comparison of Single Trend Results with a 2- and 3-Moving Average Crossover Strategies, Applied to Eurobunds, 1990 to Mid-2011
Strategy
Net PL
Profit Factor
Trades
Profit/ Contract
40-Day MA 80-Day MA 40-80 Crossover 20-40-80 Crossover
13300 55620 35040 61210
1.11 1.88 1.45 2.80
310 152 229 42
42 365 153 1457
COMPREHENSIVE STUDIES Because computerized testing platforms have made it easy for anyone to test any number of trends in combination, there have been very few comprehensive studies published since 1990. The exceptions are Colby’s The Encyclopedia of Technical Market Indicators and Bulkowski’s Encyclopedia of Chart Patterns, both of which show results in a standard form and make it easy to compare the differences between systems. But most traders seeking a strategy will need to test it themselves and add their own special features. Both Colby and Bulkowski will give you a good idea of which methods and patterns to avoid. There is a great deal to learn from putting the results of various systems and markets side by side. Earlier in this chapter, there is an informative comparison of six major trending systems; in Chapter 21 tests of single-trend strategies are compared for a standard set of 17 futures markets. In addition, a 2-trend crossover strategy is compared to the single trend methods. An objective of the testing process is to find parameters that succeed over time; this discussion can also be found in Chapter 21.
SELECTING THE RIGHT TREND METHOD AND SPEED Up to now, the selection of the right moving average, the one that will work in the future, has only been discussed in general terms. The success of a single calculation period for a single trend strategy does not mean that it is the right choice for trading. In addition, the best moving average speed for institutional or commercial participants may be very different from that of an active trader.11 For example, a mutual fund receives new investments that must be moved into the market, collectively, once or twice each month. In the same way, a cattle feed lot will choose one time each month to fix the price of new inventory. A 3-day moving average might generate 5 to 10 buy and sell signals in one month, each the result of a 2-day price move—an ineffective tool for either participant
11
Perry J. Kaufman, “Moving Averages and Trends” in Todd Lofton, ed., Trading Tactics: A Livestock Anthology (Chicago: Chicago Mercantile Exchange, 1986).
360
TRADING SYSTEMS AND METHODS
looking for just one place to enter the market. A calculation period of 10 days may come closer to generating the one buy signal needed for the fund or one sell signal that is best for the hedger. The noncommercial trader is not concerned about the frequency of trades, only the returns and risk. For the trader or speculator, the right moving average speed is the one that produces the best performance profile. This profile could be simply maximum profits, or it could be a more complex combination of profits, risk, and time in the market. In Chapter 21, automated testing is used to find the combination of speed, stop-loss, and other rules that best satisfy an objective; a computer, however, is not always necessary. Computer testing of a trend system or other trading strategies sometimes leads to solutions that are highly fitted. The computer may find that a 3-day moving average was slightly more profitable and had lower risk than a 20-day average. Our common sense tells us that the results of the 3-day system will be more difficult to attain in real trading because execution costs will have a larger impact. An occasional fast market may cause the execution price to be far off from the price indicated by the system signal. A slower trend selection with fewer trades is less affected by poor executions. Dominant seasonal factors are an important influence on the calculation period of the trend. While some stocks, such as travel and leisure, can be highly seasonal, their seasonal price patterns can be overwhelmed by a strong trend in the overall market, as measured by the S&P 500. In fact, the arbitraging of the S&P 500 futures with the actual stocks has significantly changed the patterns of the many stocks, forcing many of them to have higher correlations. However, a grain trader knows that the price pattern has a clear cycle each year. At best, we can expect one long upwards move followed by a shorter, faster decline. Not all trend speeds can capture the profits in this pattern. For example, if the uptrend lasts for 6 months, a 6-month moving average will not see any of it; therefore, it is necessary to use a moving average with a period less than one quarter of the length of the trend. If computerized testing of a large range of moving average calculation periods results in a “best” moving average period of six months or more, that choice should be interpreted as a failure to capture the seasonal move. We also discussed the “right” trend method earlier in this chapter. Tests over many years and many diverse markets will show that the differences in net returns using different trend strategies are small. Those differences will be larger when the trend speeds are faster. The most important differences are not in the profits but in the frequency of trades, the size of the individual returns, and the risk of each trade. Experience shows that the primary reason why trend-following systems work is because sustained price moves exist, driven mostly by government interest rate policy. Every trend-following system can capture these moves.
Selecting the Trend Speed Chapter 21 will discuss the systematic ways to find the “best” trend, and that is the most likely way that traders make their choice. But you can find a reasonable choice by simply looking at a price chart. The trends that two traders see are often different. Some traders
T rend Systems
361
FIGURE 8.26 Finding the moving average calculation period from the average span of peaks and valleys.
immediately focus on long-term price trends; others see much shorter movements. To find your own best trend speed without the use of a computer, mark on a chart the beginning and end of each price move that you would like to capture. These trends may occur every few days, or only three or four times each year. Using a daily price chart of IBM from July 2000 through May 2002 (Figure 8.26), the tops and bottoms of the major price swings that we would like to capture were circled. Noting that each gridline on the chart represents one month, there were eight tops and bottoms over a total period of 22 months. The average price swing was then 2¾ months, nearly one calendar quarter. Because it is so close to a quarterly value, which is the period of earnings reports, we will choose three months as the average swing period. Applying the rule of thumb that the trend can be isolated using a calculation period of one-quarter of the swing period, the moving average period becomes 16 days. Applying a 16-day moving average system to the two years of IBM price data, buying and selling whenever the trendline changes direction, the trade results are shown in Table 8.9. There are a total of 36 trades, of which 20 were profitable (no transaction costs were used)—a very high percentage for a trend-following system. Total profits were better than $114 per share, on an average share price of about $100, showing that it is not necessary to optimize using a computer to create a successful trading program. Of course, there is no assurance that this pattern of swings will continue, but basing the decision on quarterly swings, which corresponds to earnings reports, is a hopefulsign.
362
TRADING SYSTEMS AND METHODS
TABLE 8.9 Performance of 16-Day Moving Average Applied to IBM from July 2000 through May 2002 Trade #
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
Entry Date
Entry Order
Entry Price
Exit Date
Exit Order
Exit Price
Profit/ Loss
Total P/L
6/29/2000 7/20/2000 7/24/2000 7/25/2000 9/18/2000 11/9/2000 11/10/2000 11/13/2000 11/27/2000 12/5/2000 12/6/2000 1/5/2001 2/20/2001 4/5/2001 5/11/2001 5/15/2001 5/23/2001 5/24/2001 5/29/2001 6/5/2001 6/12/2001 6/22/2001 6/25/2001 7/31/2001 8/6/2001 8/10/2001 8/17/2001 10/5/2001 1/11/2002 3/4/2002 3/6/2002 3/12/2002 3/26/2002 5/22/2002 5/24/2002 5/28/2002
Sell Buy Sell Buy Sell Buy Sell Buy Sell Buy Sell Buy Sell Buy Sell Buy Sell Buy Sell Buy Sell Buy Sell Buy Sell Buy Sell Buy Sell Buy Sell Buy Sell Buy Sell Buy
114.00 117.25 112.50 112.00 123.25 99.44 93.00 97.44 98.44 103.38 96.75 94.00 111.50 98.21 111.81 113.58 117.40 119.60 115.27 116.97 117.25 112.87 112.65 105.21 106.51 104.95 104.59 98.02 120.31 105.90 106.30 108.50 102.90 84.00 83.10 82.08
7/20/2000 7/24/2000 7/25/2000 9/18/2000 11/9/2000 11/10/2000 11/13/2000 11/27/2000 12/5/2000 12/6/2000 1/5/2001 2/20/2001 4/5/2001 5/11/2001 5/15/2001 5/23/2001 5/24/2001 5/29/2001 6/5/2001 6/12/2001 6/22/2001 6/25/2001 7/31/2001 8/6/2001 8/10/2001 8/17/2001 10/5/2001 1/11/2002 3/4/2002 3/6/2002 3/12/2002 3/26/2002 5/22/2002 5/24/2002 5/28/2002 5/31/2002
SExit LExit SExit LExit SExit LExit SExit LExit SExit LExit SExit LExit SExit LExit SExit LExit SExit LExit SExit LExit SExit LExit SExit LExit SExit LExit SExit LExit SExit LExit SExit LExit SExit LExit SExit LExit
117.25 112.50 112.00 123.25 99.44 93.00 97.44 98.44 103.38 96.75 94.00 111.50 98.21 111.81 113.58 117.40 119.60 115.27 116.97 117.25 112.87 112.65 105.21 106.51 104.95 104.59 98.02 120.31 105.90 106.30 108.50 102.90 84.00 83.10 82.08 80.45
−3.25 −4.75 0.50 11.25 23.81 −6.44 −4.44 1.00 −4.94 −6.63 2.75 17.50 13.29 13.60 −1.77 3.82 −2.20 −4.33 −1.70 0.28 4.38 −0.22 7.44 1.30 1.56 −0.36 6.57 22.29 14.41 0.40 −2.20 −5.60 18.90 −0.90 1.02 −1.63
−3.25 −8.00 −7.50 3.75 27.56 21.12 16.68 17.68 12.74 6.11 8.86 26.36 39.65 53.25 51.48 55.30 53.10 48.77 47.07 47.35 51.73 51.51 58.95 60.25 61.81 61.45 68.02 90.31 104.72 105.12 102.92 97.32 116.22 115.32 116.34 114.71
Another approach to finding the trend period is to consider the worst price retracement. In the IBM chart, the move from $87 to $105, beginning in November 2000 and lasting about two months, is the one to avoid. Remembering that a trend is neutralized with regard to a price move when the trend period is the same length as the total move, we apply a moving average of 42 days. This method successfully avoids the price correction
363
T rend Systems
and holds the downtrend, but the much slower trend nets a significant loss over the 2-year period. It is best to accept the frequent small losses that are natural in a trendfollowing system than attempt to remove them.
MOVING AVERAGE SEQUENCES: SIGNAL PROGRESSION Consider the case where you have selected a 20-day moving average to trade. You enter the day long Biotech, and you get a sell signal. However, you are unaware that the 19day and 21-day moving averages did not get sell signals. This means that the day that was dropped off the calculation 20 days ago caused a slight shift not seen by the other neighboring trends. This can be an important piece of information when assessing the reliability of the trend signal. A moving average is simply a consensus of direction. It is an approximation of values intended to steer a trader to the right side of the market at the right time. It is most fallible when prices are changing direction or going sideways. Any information that clears up the problem is helpful. For any trend system, it is best to see a steady progression of trend changes from the short term to the long term. This is seen in the following tables, where u is an uptrend and d is a downtrend associated with the calculation period above those letters. In Table 8.10, prices have turned up in such a way that the trend calculation periods 1 through 19 show uptrends, while calculation periods from 20 and higher have not yet turned. Unfortunately, normal price movement is not often as uniform as this example. The shorter-term trends can be very erratic, and often appear in smaller, alternating groups of up and down trends (see Table 8.11). This is easily explained because adding and subtracting one day when only two, three, or four days are used in the moving average calculation can quickly change the direction of the trend. As you get to longer intervals, such as 20, 30, and 50 days, this is not the case, and in reality, it does not happen often. Yet when it does, the trend change is not to be trusted. There are also cases where the longer trend begins to reassert itself and the results appear the same as in Table 8.10; however, the trend change occurs from the longer-term down (from right to left instead of left to right). The case we must watch for satisfies neither of these, but occurs in an erratic pattern, such as in Table 8.12. Here we see a dominant long-term uptrend with the very short end turning down. Because of another downturn a few days ago, which then disappeared, this most recent downturn also caused a
TABLE 8.10 Orderly Trend Change Moving Average Period in Days
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 Trend u u u u u u u u u u u u u u u u u u u d d d d d d
364
TRADING SYSTEMS AND METHODS
TABLE 8.11 Erratic Trend Change for the Short Calculation Periods Moving Average Period in Days
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 Trend u u d d u d u u u u u u u u u u u u u d d d d d d
shadow turn in the 20-day range. Is it a leading indicator or a false signal? All indications are that smooth changes in a trend are more reliable precursors of change. Another case is given in the second line of Table 8.12. Here, the smooth trend change from up to down is occurring from left to right; however, as it gets to 13 days, it also jumps ahead to 19 and 20 days, leaving days 14 through 18 still in an uptrend. For trends in this faster range, it appears best to wait for all fastest trends to change. As the calculation period becomes longer, it is unrealistic to expect all faster trends to be the same; therefore, you will need to settle for an orderly change in a group of trends faster than the target trend period. An example of this process is shown in Figure 8.27. Moving average calculation periods of 5 to 50 days are shown in increments of five days for a total of 44 consecutive days. This illustration points out how the long-term uptrend (X) is breached by shorter-term, less consistent trends. Perhaps the best trend is the one with the majority of X Xs or Os on the same line.
Averaging the Sequences The idea of requiring consistency in a range of trends can be automated by selecting a range of calculation periods preceding a target period, finding the trend signal (an uptrend or downtrend), and then deciding according to one of two rules: 1. Average the final trend values to get the average trend result. Compare the previous
average result with the current value to determine the direction of the trend. 2. Scan the trend directions for consistent progression.
When selecting the range of calculation periods, start from 1 if the target period is small (e.g., your intended trend is 15 days). If you are looking at an intermediate trend period, for example, 30 days, you may want to include the range from 20 to 30, or 20 to 32. A few up-and-down price moves that make the short-end erratic should not alter the medium-term trend direction. By extending the calculation periods slightly past the target period, you gain confirmation at the cost of a small lag. TABLE 8.12 Progression of Trend Changes Moving Average Period in Days
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 Trend
d d d d u u u u u
u
u
u
u
u
u
u
u
u
d
d
u
u
u
u
u
Trend
d d d d d d d d d
d
d
d
d
u
u
u
u
u
d
d
u
u
u
u
u
365
T rend Systems
Moving Average Period Day 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
5 X O O X X X X O X O O O O X O O O O X X X X X X X O O O O X X X X X X X X O O O O X
10 X O X X X X X X O O O O O O O O O O O O X X X X X X O O X X X X X X X X X X O O X X
43
X
X
44
X
X
15 X X X X X X X X O O O O O O O O O O O O X X X X X X O O X X X X X X X X X X X X X X
20 X X X X X X X X O O O O O O O O O O O O O X O X X O O O X X X X X X X X X X X X X X
25 X X X X X X X X X O X O X O O O O O O O O O O O O O O O O X X X X X X X X X X X X X
30 X X X X X X X X X X X O X O O O O O O O O X O O O O O O O O O X X X X X X X X X X X
35 X X X X X X X X X X X O X X O O O O O O O X O O O O O O O O O X X X X X X X X X X X
40 X X X X X X X X X X X X X X O O O O O O X X X X X O O O O O O X X X X X X X X X X X
45 X X X X X X X X X X X X X X O O O O O O X X X X X O O O O X O X X X X X X X X X X X
50 X X X X X X X X X X X X X X X O O O O O X X X X X X O O X X X X X X X X X X X X X X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
FIGURE 8.27 Sequences of moving averages.
366
TRADING SYSTEMS AND METHODS
The idea that trends are sensitive to small price changes and the drop-off effect is not a surprise. An alternative to examining sequences is simply to select a number of calculation periods and net out the trends looking for a consensus. That would remove any dependence on a single selection.
EARLY EXITS FROM A TREND By now we know that capturing the fat tail is necessary for the success of trend-following systems. However, there are always practical exceptions if you are allowed to add discretion to your trading decisions. One of the oldest truths for trend-following is “Take your losses and let your profits run.” By imposing profit-taking, or even stop-losses, this can be changed to “Take your profits and let your losses run.” There is a need to be very careful when making exceptions. But consider the following situation. Interest rates have declined for nearly all of the 30 years from 1981 through 2011. For many traders, that’s more than their entire professional career. To profit from this move, a slow trend system can track the 10-year Treasury note futures contract, a municipal or corporate bond index, or any number of varying maturity funds. If a 200-day trend were used, then there would be a lag of 100 days. That is, for a bond fund, the current value of the trendline would reflect the bond prices at the midpoint of the calculation period, 50 days. If the yield on interest rates had steadily dropped a total of 2% during the past year, then the trendline would be lagging about 1% behind current yields. That can translate into a large loss in unrealized gains. One advantage of macrotrends is that they are based on a sustained economic policy. If that policy changes, then the trend is over, even if the trendline has not yet reversed direction. If the Fed were now to raise interest rates (or strongly hint that a rate hike is likely), it would signal a shift in policy. You can reasonably conclude that basis for the long-term uptrend in prices is over and that the trendline is due to turn down. A central bank rarely raises rates one month and lowers them the next. Because the very slow trend lags far behind the actual market price, it may be six months before the trendline actually signals a change of position. This will occur after a large part of your profits has been given back to the market. Exiting the trade when the fundamentals change would be a safe way of capturing more profits and being exposed to less market risk. Often, these decisions are clear only after the fact. In 2010 it seemed that Fed policy was going to change, yet 2011 was one of the strongest trend years in history, with yields reaching record lows.
MOVING AVERAGE PROJECTED CROSSOVERS If moving averages can successfully be used to identify the trend direction, it follows that a projection of the moving average will be valuable in anticipating when the trends
367
T rend Systems
will change. If a moving average trading strategy uses a single trend, the forecasted price (CP1) at which the standard n-day moving average line would cross is t
∑ Pi Sum of last N − 1 prices t − N + 2 CP 1 = = N −1 ( N − 1) That is, an n-day moving average would cross the next price at the value equal to the n−1-day moving average. The price (CP2) P needed to cause two moving averages, of periods m and n, to cross is12
⎛ ∑ most recent recent m − 1 prices ∑ most recent recent n − 1 prices ⎞ CP 2 = m × ⎜ − ⎟⎠ ⎝ m n The projected crossover price is most useful when it is likely that a trend change will occur within a few days, that is, when the two moving averages begin converging and become close in value. Acting on the expected price would give the trader a great advantage in order execution. A chart of this, however, may not appear to be much different from a simple relative strength indicator. The difference between the price and the moving average line constitutes the relative strength. The change in the projected crossover is considered a more valuable tool by Lambert.13 He creates a Market Direction Indicatorr (MDI) with the following formula:
MDI D =
100 × (Crossover e priceprevious − Crossover e pricetoday a ) Average a of past 2 day ′s prices
The point at which the MDI crosses the zero line moving higher is a buy signal, and the point where it crosses moving lower is a sell signal. Forecasting When the Moving Average Will Turn There are two basic rules for generating a moving average signal, when the price penetrates the moving average trendline and when the moving average trendline changes up or down. In the previous section, the forecast was based on when the price crosses the moving average, which is a very common way of generating a trading signal. Tests often show that results are better when the trendline itself is used to generate the signal rather than the penetration. This was discussed earlier in the chapter, but the rationale goes that once prices have been included in the moving average, then it is the moving average that tells you the correct direction, and that the price penetration takes 12
Calculation courtesy of Alexander Solodukhin, Mizuho Alternative Investments, New York. Donald R. Lambert, “The Market Directional Indicator,” Technical Analysis of Stocks & Commodities (November/December 1983). 13
368
TRADING SYSTEMS AND METHODS
away from the value of the trendline. There are two reasons for this. The trendline is smoother than price movement, so the results are more uniform, and the price penetrations generate many more trades and additional costs. Having decided to use the trendline, then how do you forecast when that line will change direction? It is simply whether today’s price is greater or less than the price that is dropped off the end of the moving average period, n days ago. And, that being the case, using the moving average trendline is exactly the same as using the n-day momentum which states that you go long when today’s price is greater than the price n days ago. It seems too simple, but in most cases the results are better than using the price penetration of a moving average.
CHAPTER 9
Momentum and Oscillators
T
he study of momentum and oscillators is the analysis of price changes rather than price levels. Among technicians, momentum establishes the speed of price movement and the rate of ascent or descent. Analysts use momentum interchangeably with slope, the angle of inclination of price movement usually found with a simple least squares regression (Figure 9.1). In mathematics it is also the first difference, the difference between today’s price and the previous day. Momentum is often considered using terms of Newton’s Law, which can be restated loosely as once started, prices tend to remain in motion in more-or-less the same direction. Indicators of change, such as momentum and oscillators, are used as leading indicators of price direction. They can identify when the current trend is no longer maintaining its same level of strength; that is, they show when an upwards move is decelerating. Prices are rising, but at a slower rate. This gives traders an opportunity to begin liquidating their open trend trades before prices actually reverse. As the time period for the momentum calculation shortens, this indicator becomes more sensitive to small changes in price. It is often used in a countertrend, orr mean reversion strategy. The change in momentum, also called rate of change, acceleration, or second difference, is even more sensitive and anticipates change sooner. Before beginning a discussion of various momentum calculations, a brief comment on terminology is necessary to understand how various techniques are grouped together. The use of a single price, such as Microsoft at $25.50 or gold at $1400, has no direction or movement implied. We are simply relating a price level and not indicating that prices are going up or down. Next, we describe the speed at which prices are rising or falling. To know the speed, it is not enough to say that the S&P rose 3 points; you must specify the time interval over which this happened—“the S&P rose 3 points in 1 hour.” When you say that you drove your car at 60, you really imply that you were going 60 miles per hour, or 60 kilometers per hour. This description of speed, or distance covered over time, is the same information that is given by a single momentum value. Then, if the daily momentum of the NASDAQ 100 is +10, it is rising at the rate of 10 points per day. 369
370
TRADING SYSTEMS AND METHODS
p2' momentum = p/ p n or p'/n p1
a
a' p0 n Days
FIGURE 9.1 Geometric representation of momentum.
Having made a point of saying that momentum is change over time, which it is, the “industry” uses momentum to mean price change with the time implied (and often not even given) where speed is always the price change divided by the time interval. The same interpretation will be used here. The term rate of change (ROC) will also be used to describe acceleration, an increase or decrease in the speed; when the rate of change is zero, we are talking about speed and momentum.1 You will see in this chapter that acceleration is more sensitive than speed. We will begin with the least sensitive indicator, momentum, increase to acceleration, and then address the variations and applications, including divergence, the most popular use of momentum indicators.
MOMENTUM Momentum is the difference between two prices taken over a fixed interval. It is another word forr speed, the distance covered over time; however, everyone uses it to mean change. For example, today’s 5-day momentum value M would be the difference between today’s price pt and the price five days ago: 5-day momentum, M = pt − pt–5 Using notation familiar to many programmers: 5-day momentum = price − price[5] 1 Be careful about terminology. Many books and software use rate of change (ROC) interchangeably with momentum, the change in price over n days, rather than the change in momentum. Also, momentum indicators can also be used for mean reversion and may be called oscillators because their values swing from positive to negative.
371
Momentum and Oscillators
or n-day momentum = price − price[n] where the notation [n] refers to the price n days ago. The momentum value Mt increases as the change in price increases over the same 5-day period. Figure 9.1 shows how the momentum changes as the price increases over the same time period. Over n days, the price moves from p0 to p1. It forms angle a and has a momentum of p1 – p0. If prices had increased to point p2, then the momentum would have been greater, and the angle a′ would have been larger. For example, if the 5-day change in price is an increase of 100, then the momentum is simply 100, but the speed is 100/5 = 20. If prices increase by 100 points over a 10-day time interval, the momentum would still be 100, but the speed, or slope, would be 100/10 = 10. When calculating momentum, the interval of the calculation must always be stated. To avoid confusion, we state that the 5-day momentum is 20 and the 10-day momentum is 10. Today’s 5-day momentum, which we will now show as M(5)t can range in value from the maximum upwards move to the maximum downwards move that the price can make in five days; the momentum is zero if prices are unchanged after five days. For stocks, there is no actual limit on the maximum price range over any time interval. In cases such as Enron, prices could collapse to zero in short order. From a practical view, most stocks and futures markets have a history of volatility that relates to their price level. The higher the price, the greater the price moves. As the price of gold rose to $1000 per ounce, the 5-day momentum could have been as high as $100 per ounce ($20 per day). When it was at $250 and investors lost interest, it may have shown a $1 per ounce change over five days. Momentum is not volatility. Gold can move from $1200 to $1250 in two days then back to $1200 over the next three days and the momentum would be zero but the volatility would be high. Figure 9.2 shows a typical pattern of momentum. Smooth prices are used to make the relationship between price change and momentum clear. During the first 15-day cycle, prices rise steadily, peaking on day 9. As prices rise at a slower rate during days 5 through 9 the momentum declines but remains above zero. As long as the 5-day momentum is greater than zero, prices are rising. The highest momentum value occurs on day 3 when prices have the largest positive price change. On day 10 the momentum value is zero. Looking at the price chart, this occurs when the 5-day change in price is zero. The lowest momentum value occurs on day 16 when the prices have declined the most. After prices reach their lowest point and begin up, the momentum is negative but rising. If prices always moved in the smooth pattern shown in Figure 9.2, then momentum would be a perfect leading indicator. You could buy when momentum turned up and sell when it turned down, and be ahead of the change in price direction. Unfortunately, prices movement is irregular; consequently, momentum values are irregular. Because momentum contains valuable information, we will look at a number of systematic ways to evaluate momentum and improve trading. These focus on extreme momentum values
372
TRADING SYSTEMS AND METHODS
30 25 20 15 10 5 0 1
2
3
4
5
6
7
8
1
2
3
4
5
6
7
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
20 15 10 5 0 –5 –10 –15 –20 8
9
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
FIGURE 9.2 Price (top) and corresponding momentum (bottom).
and momentum patterns, all of which have proved to be valuable additions to trading strategies, in particular to the timing of entries and exits.
Characteristics of Momentum Momentum is a way of smoothing price movement and can serve the same purpose as a trend. Although the momentum values are not as smooth as a moving average, larger momentum periods reduce the extremes seen in the price chart. One key advantage of momentum is that it does not have the lag that exists in a moving average. The AOL chart (Figure 9.3) compares 20- and 40-day moving averages at the top with 20- and 40-day momentum along the bottom. The 40-day momentum (dark line) is smoother and peaks at about the same place as the price. The faster 20-day momentum is not as smooth but peaks sooner than the 40-day momentum and actually leads the price movement. The peaks of the faster momentum represent the maximum price change over a 20day period. Had prices continued higher at the same rate—that is, if prices had increased $1 per day—the 20-day momentum would have turned sideways and become a horizontal line.
373
Momentum and Oscillators
FIGURE 9.3 20- and 40-day momentum (lower panel) compared to a 20- and 40-day moving average, applied to AOL.
The 20-day and 40-day momentum lines both peak significantly sooner than their moving average equivalents, showing that the speed represented by momentum is a more sensitive measure than the direction of a trendline. The cost of this leading indicator is the increased noise seen in the erratic pattern of momentum compared to the smoothness of the trendline. Momentum can be used as a trend indicator by selling when the momentum value crosses downward through the horizontal line at zero and buying when it crosses above the zero line. Because there is more noise in momentum than in the equivalent moving average, you would want to draw a small band around the zero line about the width of the small variations in momentum. A sell signal would be given when the momentum falls below the lower band and a buy when it moves upward through the upper band. However, the momentum crossing zero is essentially the same as the moving average turning up or down. It means that the price today is the same as the price n-days ago. Chapter 8 compared the performance of a trend and a momentum system over the same calculation periods.
Momentum as a Percentage It is always convenient to express all markets in the same notation. It makes comparisons much easier. For the stock market, momentum can be expressed as a percentage where a 1-day momentum is equivalent to the 1-day return, 1-day momentum in percent =
( pt
pt 1 ) p = t pt −11 pt 1
1
374
TRADING SYSTEMS AND METHODS
pt−1 . But momentum pt is most often calculated over more than one day; therefore, the n-day momentum as a percentage is or, because they are returns, the alternative can be used, ln
M ( n) =
pt −1 pt n
Using percentages does not work for futures markets because most data used for analysis are continuous, back-adjusted prices. Back-adjusting over many years and many contracts will cause the oldest data to be very different from the actual prices that occurred on those dates; therefore, percentages are incorrect. When using momentum with back-adjusted futures prices, it is best to use the price differences.
Momentum as the Difference between Price and Trend The term momentum is very flexible. It is common for it to refer to the difference between today’s price and a corresponding moving average value, in a manner similar to beta, which indicates the relative strength of a stock compared to an index. The properties of this new value are the same as standard momentum. As the momentum becomes larger, prices are moving away from the moving average. As it moves towards zero, the prices are converging with the moving average. The upper panel of Figure 9.4 shows a 20-period moving average plotted on a daily chart of Intel during the 14 months ending May 2003. The center panel shows the standard 20-period momentum, the difference between prices that are 20 days apart. The bottom panel is the difference between the price and the 20-day moving average. The range of values for the center panel is approximately +6 to −11, and the scale on the lower panel is +3 to −7. Because a trendline lags behind price movement, the difference between the price and trendline is smaller at points where there are larger price swings and typically larger momentum values. A comparison of the two lower panels of Figure 9.4 also shows that there are differences in the small movements but the overall pattern is the same. When a price moves to an extreme, it is generally farthest from the moving average and farthest from the price n-days ago; therefore, the most extreme points occur at exactly the same place. This momentum calculation has also been called relative strength because it is measured relative to a previous price or relative to a trendline.
Momentum as a Trend Indicator The momentum value is a smoothing of price changes and can serve the same purpose as a standard moving average. Many applications use momentum as a substitute for a price trend. By looking at the net change in price over the number of days designated by an n-day momentum indicator, intermediate fluctuations are ignored, and the pattern in
Momentum and Oscillators
375
FIGURE 9.4 Momentum is also called relative strength, the difference between two prices or a price and a moving average (lower panel). The traditional momentum calculation is shown in the center panel.
price trend can be seen. The longer the span between the observed points, the momentum calculation period, the smoother the results. This is very similar to faster and slower moving averages. To use momentum as a trend indicator, choose any calculation period. A buy signal occurs whenever the value of the momentum turns from negative to positive, and a sell signal is when the opposite occurs, as shown in Figure 9.5. If a band is used to establish a neutral position or a commitment zone, as discussed in the previous chapter, it should be drawn around the horizontal line representing the zero momentum value.
FIGURE 9.5 Trend signals using momentum.
376
TRADING SYSTEMS AND METHODS
t1
t2
b1
t3
b2
t4
b3 (a)
(b)
FIGURE 9.6 Relationship of momentum to prices. (a) Tops and bottoms determine momentum value. (b) Corresponding momentum.
In order to find the best choice of a momentum span, a sampling of different values could be tested for optimum performance, or a chart could be examined for some natural price cycle. Identify the significant tops and bottoms of any bar chart, and average the number of days between these cycles, or find the number of days that would closely approximate the occurrences of these peaks and valleys. Then use ½ or ¼ the number of days from peak to peak or valley to valley. These natural cycles will often be the best choice of momentum calculation interval (Figure 9.6). Momentum and oscillators, however, are more often used to identify abnormal price movements and for timing of entries and exits in conjunction with a longer-term trend.
Timing an Entry Momentum is a convenient way of identifying good entry points based on small price reversals within a trend that are not large enough to change the direction of the trend. By choosing a much shorter time period for the momentum calculation (for example, 6 days) to work in combination with a longer trend of 30 to 50 days, the momentum indicator will show frequent opportunities within the trend. The short time period for the momentum calculation assures you that there will be an entry opportunity within about three days of the entry signal; therefore, it becomes a practical timing tool. This is particularly useful
Momentum and Oscillators
377
when you view momentum as a countertrend signal, which will be discussed in the next section. Examples of using a momentum as entry timing can also be found in Chapter 19.
Identifying and Fading Price Extremes An equally popular and more interesting use for momentum focuses on the analysis of relative tops and bottoms. All momentum values are bounded (although somewhat irregularly) in both directions by the maximum move possible during the time interval represented by the span of the momentum. The conditions at the points of high positive and negative momentum are called overbought and oversold, respectively. A market is overboughtt when it can no longer sustain the strength of the current upwards trend and a downward price reaction is imminent; an oversold market is ready for an upward move. Faster momentum calculations (those using shorter calculation periods) will tend to fluctuate above and below the zero line based on small price changes. Longer calculation periods will take on the characteristics of a trend and stay above or below the zero line for the extent of the trend. In Figure 9.7, using S&P futures, the 20-day momentum in the center panel stays above zero for most of the period from September 2010 through February 2011. The very fast 3-day momentum in the bottom panel consistently penetrates the zero line, although the peaks on the upside are larger than those on the downside. The values on the right scale of the two lower panels in Figure 9.7 show the range of price movement over the 20-day and 3-day periods. The 20-day scale goes from +100 to –60 while the 3-day scale is smaller, about +60 to –40. The 3-day momentum is not 3/20ths of the 20-day momentum because volatility does not increase linearly over time. That is, volatility can increase faster in a few days, but over longer periods it has up and down movement that limits the total move in one direction. A system can take advantage of the momentum extremes byy fading the price movement (selling rallies and buying declines). This is done by drawing two horizontal lines on the
FIGURE 9.7 20-day momentum (center panel) and 3-day momentum (bottom panel) applied to the S&P, June 2010 through February 2011.
378
TRADING SYSTEMS AND METHODS
momentum chart (as shown in Figure 9.6b) above and below the zero line in such a way that the tops and bottoms of the major moves are isolated. These lines may be selected • Visually, so that once the line is penetrated, prices reverse shortly afterwards. • Based on a percentage of the maximum possible momentum value. • A multiple of the standard deviation of momentum values. Using two standard deviations would position the lines so that only 5% of all momentum values penetrate above and below the two horizontal lines. When positioning these bands, there is always a trade-off between finding more trading opportunities and entering the market too soon. This can be a complicated choice and is discussed in “System Trade-Offs” in Chapter 22. Once these lines have been drawn, the entry options will be one of the following basic trading rules: • Aggressive. Enter a new long position when the momentum value penetrates the lower bound; enter a new short position when the value penetrates the upper bound. • Minor confirmation. Enter a new short position on the first day the momentum value turns down after penetrating the upper bound (the opposite for longs). • Major confirmation. Enter a new short position when the momentum value penetrates the upper bound moving lower (the opposite for longs). • Timing. Enter a new short position after the momentum value has remained above the upper bound forr n days (the opposite for longs). To close out a profitable short or long position, there are the following alternatives (the rules are symmetrical for longs and shorts): • Most demanding. Close out long positions or cover shorts when the momentum value satisfies the entry condition for a reverse position. • Moderately demanding. Cover a short position when the momentum penetrates the zero line, minus one standard deviation (or some other target point partway between the zero line and the lower bound). • Basic exit. Cover a short position when the momentum value becomes zero. • Allowing an extended move. Cover a short position if the momentum crosses the zero line moving up afterr penetrating that line moving down. The basic exit, removing your trade when the momentum reaches the zero line, is the benchmark case. It is based on the conservative assumption that prices will return to the center of the recent movement (in other words, mean reverting). It is less reasonable to assume that prices will continually move from overbought to oversold and back again. Most statisticians would agree that the mean is the best forecast of future prices, and the zero momentum value represents the mean. You may try to increase the profits by assuming that the momentum value will penetrate the zero line by a small amount because there is always some amount of noise. However, if you require a larger penetration
Momentum and Oscillators
379
FIGURE 9.8 A longer view of the 20- and 3-day momentum applied to the S&P. The magnitude of the momentum values change over time.
of zero to cause an exit, many of the exit opportunities will be lost. You can be more conservative by exiting somewhat before the zero line is reached, but then you also reduce your average profit. The same momentum calculations, viewed over a longer time period, show one of the problems with using momentum for timing. Figure 9.8 covers a critical period, from August 2005 through February 2011. Notice that the scale of the momentum values change dramatically from the beginning to the end of the chart. This is especially important for the 20-day momentum in the middle panel. For all of 2006, volatility was very low. Had we used momentum as an overbought/oversold indicator, the entry bands would have been at about ±30. For the 3-day momentum, it would have been closer to ±15. As we saw before, the faster momentum is more symmetric than the slower one. During 2006, there were more selling than buying opportunities. Volatility increases in 2007. If buy entries were targeted as momentum values of −30 then traders would have held a 120 point loss as momentum dropped to −150. A similar pattern was repeated on the upside for sell signals. It would be necessary to increase the width of the buy and sell bands to ±75 and still hold larger losses waiting for a price reversal. But then comes 2008, and any countertrend entry, buying as prices fall, would have caused a complete loss of equity. However, let’s say that we were able to avoid disaster and the entry-exit bands were at ±100 for the 20-day momentum and ±50 for the 3-day. Volatility finally declines and we get only the occasional entry signal. The bands need to be adjusted back down to a smaller range. The problem with using momentum for timing is that the scale is unpredictable. Even if we waited for a reversal after penetrating the band there is no assurance that prices will not reverse and go to new extremes. Some risk protection is needed, a way of dynamically adjusting the bands (as discussed in Chapter 8), or a different way of measuring momentum.
380
TRADING SYSTEMS AND METHODS
Risk Protection A protective stop-loss order can be used whenever you trade against the current price momentum. A stop-loss is a specific order to exit if the price goes the wrong way (discussed in Chapter 23 but also throughout the book). This is most important with the aggressive entry, which advocates selling when the momentum value moves above the upper threshold line, regardless of how fast prices are rising. While the other entry options allow for a logic positioning of a stop-loss, the aggressive entry does not. You will simply need to decide, based on historic momentum values, where to limit your risk. With the other entry options, prices are no longer at their extremes, so that stops may be placed using one of the following techniques: • Place a protective stop above or below the most extreme high or low momentum value. • Follow a profitable move with a trailing, nonretreating stop based on fixed points or a percentage. • Establish zones that act as levels of attainment (using horizontal lines of equal spacing), and do not permit reverse penetrations once a new zone is entered. Risk protection must be flexible in the way it deals with volatility. As prices reach higher levels, increased volatility will cause momentum tops and bottoms to widen; with low volatility, prices may not be active enough to penetrate the upper or lower bounds. This is shown in Figure 9.8. Therefore, both the profits and risk of a trade entered at extremes must increase with volatility and higher prices. Stops could be based on a percentage of price or a multiple of volatility. The aggressive entry option remains the greatest problem for controlling risk, where a short signal is given when prices are very strong. If an immediate reversal does not occur, large open losses may accrue. To determine the proper stop-loss amount, a computer test was performed using an immediate entry based on penetration of an extreme boundary and with a stop-loss at the close of the day for risk protection. The first results were thought to have outstanding profits and consistency until it was discovered that the computer had done exactly the opposite of what was intended—it bought when the momentum crossed the upper bound and placed a close stop-loss below the entry. It did prove, for a good sampling of futures markets, that high momentum periods continued for enough time to capture small but consistent profits. It also showed that the aggressive entry trading rule, anticipating an early reversal, would be a losing strategy. One should never forget that declining momentum does not mean that prices are falling. The Trend Provides Protection In these examples, momentum is not a strategy itself, but a way of entering a trend trade. When a trend signal first occurs, it is not entered. If the signal was long, then the strategy waits until the 3-day momentum penetrates the lower band. If prices continue lower, then the trend will change from up to down, and the position will be exited. It would not be necessary to have a stop-loss.
Momentum and Oscillators
381
Profit Targets for Fading Extreme Moves When using momentum as a mean-reversion strategy, the most reasonable exit for a short entered at an extreme momentum high, or a long position entered at a low, is when the momentum returns to near zero. Prices do not have an obligation to go from extreme lows to extreme highs; however, any extreme can be expected to return to normal, which is where momentum is zero. Returning to zero does not mean that all trades will be profitable. If there has been a strong upwards move that lasted longer than the calculation period of the momentum, then prices will be higher when momentum finally returns to zero. The trend is not your friend if it fights with your mean-reversion position. The number of profitable trades can be increased by targeting a momentum level that is more conservative than zero. That is, if a long was entered at an extreme low, a sell would be placed 5% or 10% below the zero momentum line, based on the distance between the buying threshold line and zero. Trades that almost return to normal would then be closed out with profits, although the average size of the profit would be smaller. To increase the size of the profits per trade, you would target the opposite side of the zero momentum line; therefore, if you held a long position, you would wait until the momentum value was greater than zero by 5% or 10% of the range. The success of taking profits early or late depends on the amount of noise in the momentum values as it fluctuates near the zero value. In many cases where extreme prices are followed by a sideways pattern, momentum will fluctuate around zero so that there is ample opportunity to exit the trade at a better price.
High-Momentum Trading Some professional traders have made a business of trading in the direction of the price move only when momentum exceeds the high threshold level rather than anticipating a change of direction. There is a small window of opportunity when prices are moving fast. They will usually continue at the same, or greater, momentum for a short time, measured usually in minutes or hours, but occasionally a few days. There is a lot of money to be made in a short time—but at great risk if prices reverse direction sooner than expected. Price patterns have changed. There are many more day traders. When one stock breaks out above a previous high, everyone sees it as an opportunity for profit. Buy orders start to flow, and volume increases. Stocks that are normally ignored can attract large volume when prices make a new high. Traders ride the rising prices for as long as possible, watching to see when volume begins to drop, then they exit. Some may just target a modest profit and get out when that target is reached. High-momentum trading is a fast game that requires tools that allow you to scan a wide range of stocks. You are looking for one that has made a new high after a long, quiet period. You may also continually sort stocks by the highest momentum values. You need to stay glued to your screen, enter fast and exit fast. It is a full-time commitment.
382
TRADING SYSTEMS AND METHODS
Moving Average Convergence/Divergence (MACD) Many of the practical problems of fading prices using momentum are solved with the Moving Average Convergence/ e/Divergence (MACD),2 developed by Gerald Appel. The MACD uses momentum calculated as the difference between two trendlines, produced using exponential smoothing. This momentum value is further smoothed to give a signal line. The most common form of MACD uses the difference between a 12-day and 26-day exponential smoothing. The signal line, used to produce trading recommendations, is a 9-day smoothing of the MACD. The MACD can be created as follows: Step 1: Choose the two calculation periods for the trend, for example, 20 and 40. Convert to smoothing constants using 2/(n + 1). Step 2: Calculate the slow trendline, E E40, using the smoothing value 0.0243. Step 3: Calculate the fast trendline, E20, using the smoothing value 0.0476. Step 4: The MACD line, the slower-responding line in the bottom panel of Figure 9.9, is E20 – E E40. When the market is moving up quickly, the fast smoothing will be above the slow, and the difference will be positive. This is done so that the MACD line goes up when prices go up. Step 5: The signal line is the 9-day smoothing (using a constant of 0.10) of the MACD line. The signal line is slower than the MACD; therefore, it can be seen in the bottom panel of Figure 9.9 as the lower line when prices are moving higher. The 20- and 40-day momentum lines, corresponding to the MACD line and the histogram, are shown in the center panel of Figure 9.9. It is clear that the MACD process smoothes these values significantly; therefore, it makes trading signals easier to see. Reading the MACD Indicator The MACD is normally seen as it appears at the bottom of Figure 9.9. The MACD line is higher in an uptrend and lower in a downtrend. The histogram is created by subtracting the slower signal line from the MACD line. When the histogram is above zero, it confirms the uptrend. The 40/20 MACD line is similar to the 40-day momentum line. We can compare the MACD in the lower panel with the 20- and 40-day momentum in the center panel and see that the peaks and valleys are in about the same place, but the MACD line is much smoother because it is the difference between two trendlines rather than prices. You should note the point at which the MACD and signal lines turn down in May 2001, compared to the corresponding moving averages that are shown with prices in the top panel of the chart. The MACD leads the moving averages in showing the downturn and has only slightly more up-and-down variation in its values. The signal line also leads the moving averages in the downturn and is equally smooth.
2
From John D. Becker, “Value of Oscillators in Determining Price Action,” Futures (May 1994).
Momentum and Oscillators
383
FIGURE 9.9 MACD for AOL. The MACD line is the faster of the two trendlines in the bottom panel; the signal line is the slower. The histogram is created by subtracting the slower signal line from the MACD line.
Trading the MACD The most common use of the MACD is as a trend indicator. For this purpose, only the MACD and signal lines are used in the following way: Buy when the MACD line (faster) crosses upwards through the signal line (slower). Sell when the MACD line crosses from above to below the signal line. In the bottom panel of Figure 9.9, the buy signals that occur right after an extreme low in April and October of 2001 generated large gains. Unfortunately, there were many other crossings that generated losses; therefore, it is necessary to select which trades to enter. To accomplish that, the MACD uses thresholds similar to those shown for momentum, but in the opposite way. The MACD must first penetrate the lower band; then it must signal a new uptrend before a long position can be entered. In this way, it removes some of the whipsaws that might occur in a sideways market. Threshold levels were established by observing the historically high and low momentum values, shown as horizontal lines at the +2.00 and −2.00 levels in Figure 9.9. Sell signals would have been taken only after the MACD value had been above +2.00, and buy signals only when the MACD value had fallen below −2.00. The trading signals that satisfy these conditions are the buy signal in April, a sell in May, and a buy in October. However, fitting the threshold lines
384
TRADING SYSTEMS AND METHODS
make them unreliable values for trading. One solution can be found in “An RSI Version of MACD” in the next section. Appel has written extensively on the MACD, and many variations can be found in his book, Technical Analysis.3 Many of the examples are interpretive, similar to the way we look at chart patterns. Appel also preferred using trends of 19 and 39 days for the NASDAQ composite. An equally important use of MACD is for divergence signals. Bearish divergence occurs when prices are rising but the MACD values are falling. Because this technique applies to many indicators in addition to the MACD, it is covered in detail in the section “Momentum Divergence” toward the end of this chapter.
DIVERGENCE INDEX A method similar to MACD but one that uses an interesting combination of generalized techniques is the divergence index, the volatility-adjusted difference between two moving averages, for example, 10 and 40 days. Using general notation: 1. Slow averaget = 40-day average of the most recent prices 2. Fast averaget = 10-day average of the most recent prices 3. Differencet = pricet – pricet–1
Then the divergence index (DI), DI t =
Fast average averaget − Slow averaget StDev(Difference ( d 2 t , slow period)
The standard deviation of the price differences, taken over the slow period of 40, volatilityadjusts the results. The trading rules require a band around zero to trigger entries. Bandt = stdev(DIt, slow period) Upper bandt = factor × Bandt Lower bandt = −factor × Bandt where factor = 1.0. By using the standard deviation of DI, the band also adjusts to changes in volatility. In Figure 9.10 the index in the lower panel has high peaks followed by periods of low or varying volatility. The standard deviation allows the bands to widen or narrow according to the pattern of fluctuations. This example used the slow period for the standard deviation; however, the fast period would have caused more rapid changes to the band. 3
Gerald Appel, Technical Analysis, Power Tools for Active Investors (Upper Saddle River, NJ: FT Prentice Hall, 2005).
Momentum and Oscillators
385
FIGURE 9.10 Divergence index applied to S&P futures.
The trading rules are Buy when the DI moves below the lower band while in an uptrend Sell when the DI moves above the upper band while in a downtrend Exit longs and shorts when the DI crosses zero Figure 9.10 shows the DI and the upper and lower bands in the bottom panel. The top panel shows the trading signals for the S&P 500 futures contract.
OSCILLATORS Because the representation of momentum is that of a line fluctuating above and below a zero value, it has often been termed an oscillator. Even though it does oscillate, the use of this word is confusing. In this presentation, the term oscillator will be restricted to a specific form of momentum that is normalized and expressed in terms of values that are limited to the ranges between +1 and –1 (or +100 to –100), +1 and 0, or +100 and 0 (as in a percent). To transform a standard momentum calculation into the normalized form with a maximum value of +1 and a minimum value of −1, divide the momentum calculation by its maximum value over the same rolling time period. This allows the oscillator to selfadjust to changes in price or volatility. For example, in April 2006, Amazon was trading at about $34. During a 10-day period it had a high of $35.31 and a low of $31.52, a range of $3.79. During 10 days in February 2011, Amazon had a high of $191.40 and a low of $174.77, a range of $16.63. Therefore, a price move of $2 in 2006 would be the same as a move of $8.77 in 2011. By dividing $2 by $3.79 or $8.77 by $16.63 we get 0.52 in both cases. Hence, normalization, which is the basis for most momentum indicators, can be an excellent way to self-adjust to price changes.
386
TRADING SYSTEMS AND METHODS
The following sections show how a number of useful oscillators are calculated. In each case, the purpose is to have the indicator post high values when prices are at a peak and low values when they are in a valley. To be most useful, prices should reverse direction soon after the oscillator records values near its extremes.
Relative Strength Index One of the most popular indicators for showing overbought and oversold conditions is the Relative Strength Index x (RSI) developed by Welles Wilder.4 It provides added value to the concept of momentum by scaling all values between 0 and 100. It is more stable than momentum because it uses all the values in the calculation period rather than just the first and last. It is a simple measurement that expresses the relative strength of the current price movement as increasing from 0 to 100. It is calculated as RSI S = 100 −
where
⎛ 100 ⎞ ⎛ RS ⎞ = 100 × ⎝ 1 + RS ⎠ ⎝ 1 + RS ⎠
AU AD AU = the total of the upwards price changes during the past 14 days AD = the total of the downwards price changes (used as positive numbers) during the past 14 days RS =
Once the first calculation has been made, both the AU U and AD values can be calculated daily using an average-offf method: AU t = AU t−1 +
AU t−1 + max( a pt − pt −1 , 0 ) 14
AD Dt = ADt−1 +
AD Dt−1 + max( a pt − pt , 0 ) 14
This method essentially subtracts an average value and adds the new value, if any (see “Average-Off Method” in Chapter 7). All price changes are treated as positive numbers. The daily calculation of the RSI becomes a matter of simple arithmetic. Wilder has favored the use of 14 days because it represents one-half of a natural cycle, in this case, 1month. He has set the significant threshold levels for the RSI at 30 and 70. Penetration of the lower level is indicative of an imminent upturn and penetration of the upper level, a pending downturn. A chart of an RSI is shown along with a comparable momentum and stochastic indicator in the next section, Figure 9.15.
4
J. Welles Wilder Jr., New Concepts in Technical Trading Systems (Greensboro, NC: Trend Research, 1978).
Momentum and Oscillators
387
FIGURE 9.11 RSI top formation.
Use of the RSI alone to generate trading signals often requires interpretation similar to standard chart analysis. Lines are drawn across the tops of the RSI values to indicate a downtrend. A head-and-shoulders formation can be used as the primary confirmation of a change in direction. Wilder himself used the RSI top and bottom formations shown in Figure 9.11. A break of the reaction bottom between the declining tops is a sell signal. In addition, the failure swing, or divergence (discussed later in this chapter), denotes an unsuccessful test of a recent high or low RSI value. Wilder created other popular indicators. One of these is a momentum calculation called the Average Directional Movement (ADX). The ADX is a byproduct of the Directional Movement and is discussed in Chapter 23. All of these indicators are actively used by traders. Modifying the RSI An obvious objection to the RSI might be the selection of a 14-dayy half-cycle. Maximum divergence is achieved by using a moving average that is some fraction of the length of the dominant cycle, but 14 days may not be that value. If a 14-day calculation period is too short, then the RSI would remain outside the 70-30 zones for extended periods rather than signaling an immediate turn. In practical terms, a 14-day RSI means that a sustained move in one direction that lasts for more than 14 days will produce a very high RSI value. If prices continue higher for more than 14 days, then the RSI, as with other oscillators, will go sideways. The idea is to pick the calculation period for which there are very few larger sustained moves, and 14 may be that value. If more frequent overbought and oversold conditions are needed, then the period could be lowered to 10. At the same time, the zones could be increased to 80-20. Some combination of calculation period and zone will usually give the frequency of trades that is needed. A study by Aan5 on the distribution of the 14-day RSI showed that the average RSI top and bottom value consistently grouped near 72 and 32, respectively. Therefore, 50% of all RSI values fall between 72 and 32, which can be interpreted as normally distributed, and 5
Peter W. Aan, “How RSI Behaves,” Futures (January 1985).
388
TRADING SYSTEMS AND METHODS
equivalent to about 0.675 standard deviations. This would suggest that the 70-30 levels proposed by Wilder are too close together to act as selective overbought/oversold values, but should be moved farther apart. The equivalent of 1.5 standard deviations is a comfortable trade-off between frequency of trades and risk. It is generally safer to err on the side of less risk. If there are too many trades being generated by the RSI, a combination of a longer interval and higher confidence bands will be an improvement.6 Further Smoothing with N -Day Ups and Downs Instead of increasing the number of days in the RSI calculation period, a smoother indicator can be found by increasing the period over which each of the up and down values are determined. The original RSI method uses 14 individual days, where an up day is a day in which the price change was positive. Instead, we can replace each 1-day change with a 2-day change, or an n-day change. If we use 2-day changes, then a total of 28 days will be needed, so that each 2-day period does not overlap another; there will be 14 sets of two days each. Using 14 sets of 2 will give a smoother indicator than using 28 single-day changes. RSI Countertrend Trading Momentum indicators are used for timing and countertrend trading. Normally, it is the absolute overbought or oversold level that is the trigger for a trade. However, either a very fast move in price or an extreme value for a momentum indicator could be a criterion for a reversal. When RSIIt – RSIIt–k > a, or when RSIIt – RSIIt–k < −a, where a is a threshold value, we could sell and buy, respectively. This also increases the number of trades because it does not require that RSIIt > 0, only that it has moved quickly. Exits can be taken when momentum returns to near zero, or after n days. A program to test this is TSM RSI Countertrend, available on the Companion Website. Net Momentum Oscillator Another variation on the RSI is the use of the difference between the sum of the up days and the sum of the down days, called a net momentum oscillator.7 If you consider the unsmoothed RSI = 100 × (S (Su/((Su+ Sd)) then the net momentum oscillator would be CMO = 100 × (S (Su − Sd)/(S (S u + S d) This method replaces some of the indicator movement lost to smoothing in the normal RSI, and shows more extremes. This may also be done by shortening the number of periods in the RSI calculation.
6 For
another interesting approach to RSI optimization, see John F. Ehlers, “Optimizing RSI with Cycles,” Technical Analysis of Stocks & Commodities (February 1986). 7 Tushar S. Chande and Stanley Kroll, The New Technical Traderr (New York: John Wiley & Sons, 1994).
389
Momentum and Oscillators
The 2-Day RSI Among the interesting information published on MarketSci Blog8 is Michael Stokes’s “favorite” indicator, the 2-day RSI, which replaces each 1-day closing price change with a 2-day change; otherwise, the calculations and the number of data points are the same. If you already have a program to calculate the RSI, you only need to change the statement pt – pt−1 with pt – pt−2 to get overlapping 2-day data. Or, to try an n-day RSI, replace the “2” with your choice of days. The effect of using combined 2 days instead of 1 is some smoothing and a general increase in volatility. Stokes uses threshold levels of 10 and 90 for the S&P and the rules Buy on the next close when the 2-day RSI penetrates the threshold of 10 moving lower Sell short on the next close when the 2-day RSI penetrates the threshold of 90 moving higher Exit one day later on the close Figures 9.12a and b are from the MarketSci Blog on December 9, 2008. Figure 9.12a shows that the profitability of the RSI reversed in about 1998. From 1970 to 1998 it was a good trend indicator; that is, when the RSI moved above 90 the S&P continued up. After 1998 it has been a much better mean-reverting indicator. Figure 9.12b is the result of applying a method of scaling in to trades according to the following rules: If the RSI < then buy y this % < < < <
5 10 15 20
100% 75% 50% 25%
If the RSI > then sell shortt this % > > > >
95 90 85 80
100% 75% 50% 25%
On day t the RSI was 14, and we entered 50%, but then on day t + 1 the RSI dropped to 8; it was not clear whether we added an extra 25%, but we assume that is the case. Then the trade is exited if we do not add on the next day. Because the RSI can stay above or below 50 for long periods of time, an exit rule that waits for the RSI to cross 50 is not likely to be successful. Stokes’s approach of exiting after one day seems much safer. Figure 9.12b separates the longs and short sales from 2000 through 2008, showing that both sides performed well, a very desirable outcome. Having good performance for longs and shorts is not common because many markets have an upwards bias (especially the stock market). However, 1-day trades are sensitive to costs. Traders will need to see if the returns per share, or per contract, are sufficient to cover commissions and slippage.
8
Free subscriptions are available at MarketSci Blog [emailprotected]. The author, Michael Stokes, presents his own ideas and analysis of various systematic approaches.
390
TRADING SYSTEMS AND METHODS
Evolution of RSI(2) Strategy (1970 to Present)
1970
1975
1980
1985
1990
RSI(2) 10 RSI(2)90
FIGURE 9.12a Performance of the 2-day RSI, MarketSci blog’s favorite oscillator, from the December 9, 2008, posting, simple entries 90 applied to the S&P, 1970 through 2008.
A Standard 2-Period RSI In Figure 9.13 a standard 2-period RSI is shown in the middle panel and the traditional 14day RSI in the lower panel. Both are applied to NASDAQ futures, from August 2005 through September 2008, which appears at the top. The classic RSI penetrates the extremes of 30 and 70 but does not reach 20 or 80, while the 2-period RSI touches near 15 and 85 a number of times. We might expect a 2-period oscillator to jump between 0 and 100 every day that prices changed direction, but the average-off calculation slows down the process and makes the 2-period chart a somewhat more volatile version of the standard RSI. Trading Strategy: Long versus Short-Only T
1.00 20 000
2002
2004
Trading Tr ading Strategy: Long Only
2006
2008
Trading Tr ading Strategy: Shor Shortt Only
FIGURE 9.12b A breakdown of longs and short sales using the scaling-in method, S&P 2000 through 2008.
Momentum and Oscillators
391
FIGURE 9.13 2-Period RSI (center panel) compared with the traditional 14-day RSI (bottom panel), applied to NASDAQ futures, August 2005 through September 2008.
An RSI Version of MACD While the MACD creates a histogram of the difference between two moving averages, we can make that pattern easier to interpret by applying the RSI to the spread of the moving averages. In Figure 9.14 a 5-day RSI is applied to the difference between the 10- and 40-week moving average for the emini-S&P futures. Using the standard 30-70 thresholds, this seems to find credible points where prices are overbought and oversold.
FIGURE 9.14 RSI applied to the spread between a 10-week and 40-week moving average of S&P futures.
392
TRADING SYSTEMS AND METHODS
Stochastics The stochastic indicator, created by George Lane, is an oscillator that measures the relative position of the closing price within a past high-low range. It is based on the commonly accepted observation that closing prices tend to resist penetrating the high prices of the past few days, the place where a horizontal resistance line would be drawn on a chart. Similarly, in a downtrend prices must be able to close below the lows of the past few days for the move to continue. When the market is about to turn from up to down, for instance, it is often the case that the highs are higher than previous days, but the closing price settles nearer the low of the day, failing to indicate a continuation of the uptrend. This makes the stochastic oscillator different from the MACD, which uses the difference between two trends, and the RSI which uses only the closing prices. The stochastic uses the high, low, and close and unlike the other oscillators, there does not have to be any smoothing to introduce a lag. The three indicators that result from the stochastic measurement are called %K, K %D, and %D-slow. These indicators show increasingly slower interpretation of price movement, with %D being the most popular as a single indicator; however, %D and %D-slow are often used together to produce a trading signal. Calculation of these indicators for today’s value t over the past 5 days, are Initial ( raw r ) % K t = 100 ×
%D
“% K -slow slow” =
% Kt
Ct
Lt (5) Rt (5)
% K t−11 + % K t 3
2
⎛ t ⎞ % Ki ⎟ ⎜ i∑ = ⎜ t− 2 ⎟ 3 ⎜ ⎟ ⎜⎝ ⎟⎠
⎛ t ⎞ ⎜⎝ ∑ % Di ⎟⎠ % Dt -slow = i t− 2 3 Where
Ct = today’s closing price Lt(5) = the low price of the last 5 days Rt(5) = the range of the last 5 days (highest high minus lowest low) as of today.9
Calculating the 10-Day Stochastic for Hewlett-Packard (HPQ) Using an Excel spreadsheet, each of the stochastic components can be calculated in only a few columns. In Table 9.1, the historic prices for Hewlett-Packard are imported into columns A–D. The 10-day stochastic calculations, columns E–J, are: 1. Column E, the 10-day high using the function Max. 2. Column F, the 10-day low using the function Min. 9
Harry Schirding, “Stochastic Oscillator,” Technical Analysis of Stocks & Commodities (May/June 1984).
393
Momentum and Oscillators
TABLE 9.1 Excel Example of 10-Day Stochastic for Hewlett-Packard (HPQ)
Row
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
A
B
C
D
E
F
G
H
I
J
Date
High
Low
Close
10-Day High
10-Day Low
10-Day Range
%K
%K-Slow
%D-Slow D
1/3/2011 1/4/2011 1/5/2011 1/6/2011 1/7/2011 1/10/2011 1/11/2011 1/12/2011 1/13/2011 1/14/2011 1/18/2011 1/19/2011 1/20/2011 1/21/2011 1/24/2011 1/25/2011 1/26/2011 1/27/2011 1/28/2011
43.49 43.77 44.22 44.96 45.39 45.05 46.06 45.71 45.84 46.40 46.42 46.48 46.79 47.64 47.59 47.83 47.28 46.98 46.69
42.22 43.01 43.40 44.18 44.71 44.57 45.20 45.27 45.31 45.61 46.08 46.08 45.76 46.83 46.66 46.88 46.57 46.58 45.36
42.74 43.63 44.20 44.88 45.09 44.86 45.43 45.64 45.65 46.25 46.34 46.32 46.78 47.23 47.55 47.08 46.88 46.74 45.51
46.40 46.42 46.48 46.79 47.64 47.64 47.83 47.83 47.83 47.83
42.22 43.01 43.40 44.18 44.57 44.57 45.20 45.27 45.31 45.36
4.18 3.41 3.08 2.61 3.07 3.07 2.63 2.56 2.52 2.47
96.41 97.65 94.81 99.62 86.64 97.07 71.48 62.89 56.75 6.07
96.29 97.36 93.69 94.44 85.07 77.15 63.71 41.90
95.78 95.16 91.07 85.55 75.31 60.92
3. Column G, calculate the high-low range by subtracting F from E. 4. Column H H, row n, calculate the raw stochastic %K K as (Dn-Fn F )*100/Gn. 5. Column II, the %Kslow is the 3-day average of %K, K column H. 6. Column J J, %Dslow is the 3-day average of %K-slow, column I.
The raw stochastic in column H of the spreadsheet shows that values start above 90% and drop to 6% in a few days. This happens when prices close near the highest or lowest prices of the past 10 days. When calculating the stochastic, today’s close is always included in the max, min, and range calculations. If today’s price is the highest or lowest of the calculation period, then the raw stochastic will have a value of 100 or 0. The full spreadsheet TSM Stochastic calculation for HPQ, can be found on the Companion Website. Comparing the Stochastic to Momentum and the RSI The calculations for momentum, RSI, and the stochastic are very different; therefore, we would expect a chart of these indicators to vary considerably from one another. However, there are surprising similarities among the three, even calculated over the same 14-day period, as shown in Figure 9.15. The momentum and stochastic both show how
394
TRADING SYSTEMS AND METHODS
FIGURE 9.15 Comparison of simple momentum, RSI, and stochastic, all for 14-day calculation periods, General Electric, May 2008 through February 2011.
today’s price relates to the prices over the calculation interval; therefore, we would expect them to be most similar, and that appears to be true. Both have peaks at the same place, although the %D-Slow stochastic has a smoother overall line due the two successive 3-day averages. The RSI chart does not seem to be lagged, instead it is dampened, appearing to have less volatility. In fact, the highs and lows rarely touch 70 and 30, while the stochastic highs and lows often go above 90 and below 10, even though it is smoothed. The overall impression of the stochastic is that it moves faster and exaggerates the swings. Trading the Stochastic Traditionally, the stochastic can be traded by using a combination of a slower and faster calculation to give signals, or by combining extreme stochastic values for entry or exit timing with a trend. To use the stochastic by itself, %D and %D-slow can take on the role of the faster indicator and the slower signal line in the same way as the MACD and its signal line were used. The fastest calculation, %K, K is not often used due to its instability.10 Figure 9.16 shows the two 20-day calculations, %D and %D-slow, along the bottom of an S&P futures continuation chart from December 2001 through September 2002. A 60-day moving average is in the top panel. The downtrend in the S&P during 2002 produces two good sell signals using the stochastics. In March and August, the slower %D penetrates above the 80% threshold and crosses the signal line moving down. A third peak in May touches near 70% and would produce an additional sell signal if the upper threshold were set lower. During a sustained downtrend, it is common for the indicator values to fall below the lower threshold 10 It is common practice to use the notation % %K K and %D to mean % %K K-slow and %D-slow, respectively.
All writings on the stochastic use the smoothed values, rather than the initial %K %K calculation, regardless of the omission of “-slow.” Any use of %K %K in this text also refers to %K-slow unless specifically stated.
Momentum and Oscillators
395
FIGURE 9.16 20-day stochastic (bottom) and a 60-day moving average for the S&P futures continuation series.
and remain there for extended periods. Although the rolling calculation is intended to self-adjust, the most practical solution is to combine the stochastic signals with a trend. The 60-day moving average, shown along with prices in the upper part of Figure 9.16, indicates a downtrend for the entire period of the chart. Using the relatively slow 20-day stochastic, the penetration of the upper 80% threshold gives very good timing for short sale entries, and avoids the problems of an unfavorable distribution of stochastic values. The 20-day stochastic does not indicate where to exit the downtrend. A faster stochastic can be used to produce more frequent sell signals that can be applied as follows Enter a short sale after the trend has turned down on the first stochastic sell signal (the stochastic crosses the signal line going down). Enter a long after the trend has turned up on the first stochastic buy signal. The problem with all timing rules is that, if prices move higher and do not retrace, then there will not be a stochastic signal, or it will occur well after there would have been profits in the trade. Many of the lost opportunities can be eliminated by using a faster stochastic calculation period. It is particularly dangerous to use a timing rule for exiting a position. Delays in entering are lost opportunities, but delays exiting are real trading losses.
Left and Right Crossovers The faster %K-slow will usually change direction sooner than the %D-slow, crossing the %D-slow line while it is still moving in the prior trend direction. The opposite case, when
396
TRADING SYSTEMS AND METHODS
(a)
(b)
(c)
(d)
FIGURE 9.17 Lane’s patterns. (a) Left and right crossings. (b) Hinge. (c) Bear market set-up. (d) %K-slow failure.
the %D-slow turns first, indicates a slow, stable change of direction and is a more favorable pattern (Figure 9.17a). Using the fast %K-Slow and the slower %D-Slow, the following patterns have been identified: Hinge. A reduction in the speed of either the %K-slow or %D-slow lines, shown as a flattening out, indicates a reversal on the next day (Figure 9.17b). Warning. An extreme turn in the faster %K-slow (from 2 to 12%) indicates at most two days remaining in the old trend. Extremes. Reaching the extreme %K-slow values of 0 and 100 requires seven consecutive days of closes at the highs (or lows). The test of these extremes, following a pullback, is an excellent entry point. Set-up. Although the line chart shows higher highs and lows, if the %D-slow line has lower lows, a bear market set-up has occurred. Look for a selling opportunity on the next rally (Figure 9.17c). Failure. An excellent confirmation of a change in direction occurs when %K-slow crosses %D-slow (after penetrating the extreme level), then pulls back to the %D-slow line, but fails to cross it again (Figure 9.17d).
Creating a Stochastic from the RSI Any series or indicator value can be converted to a raw stochastic, %K, K without adding lag by replacing the closing price with the indicator value. This creates a measure of
397
Momentum and Oscillators
where that indicator lies in its high-low range over the calculation period and may simplify the generation of buy and sell signals. A stochastic created from an RSI would be11 n -day Stoc t chR RSI =
RSI S toda t ay
RSI n -day a low
RSI S n -day high − RSI S n -day low
Williams’s Oscillators Larry Williams has been known for his development of trading methods based on oscillators since his publication of the A/D oscillatorr in 1972. The three techniques described below have some similarities, even though the last one, the Ultimate Oscillator, was published 13 years later. A/D Oscillator In 1972, Jim Waters and Larry Williams published a description of theirr A/D Oscillator. For their method, A/D means accumulation/distribution rather than the popular notation of advance/decline, a well-known indicator for stocks. They used a unique form of relative strength, defining buying powerr (BP) and selling powerr (SP) as BP = high − open SP = close − low where the values used were today’s open, high, low, and closing prices. The two values, BP and SP, show the additional buying strength (relative to the open) and selling strength (compared to the close) in an effort to measure the implied direction of the day’s trading. This definition of buying and selling power is still used today. The combined measurement, called the Daily Raw Figure (DRF) is calculated as DRF RFt =
BP Pt + SP Pt 2 × ( H t Lt )
The maximum value of 1 is reached when a market opens trading at the low and then closes at the high: BPt − SPt = Ht − Lt. When the opposite occurs and the market opens at the high and closes on the lows, the DRF = 0. Each price series develops its own patterns, which can be smoothed or traded in many ways similar to a momentum index. The Waters-Williams A/D Oscillator solves problems of volatility and limit moves (although there are very few markets with trading limits any more) in futures markets. DRF F completely adjusts to higher or lower trading ranges because the divisor itself is a multiple of the day’s range; because each day is treated independently, the cumulative values of the momentum index are not part of the results. 11
Tushar Chande and Stanley Kroll, The New Technical Traderr (New York: John Wiley & Sons, 1994).
398
TRADING SYSTEMS AND METHODS
This day-to-day evaluation has no memory and causes DRF to be very volatile, yet it still takes on the pattern of the underlying market. If fewer trades are preferred, the DRF can be smoothed. In the example in Table 9.2, a 0.30 exponential smoothing was used (selected arbitrarily) and the entry bands narrowed from 80-20 to 70-30 to reflect fewer extreme prices. Because the 1973 examples used soybeans, this example will do the same, but for 2011 data. Table 9.2 shows the calculations for the DRF and the smoothed DRF. The DRF is plotted as bars on a scale of 0 to 1.00 in Figure 9.18 and is extremely erratic. The solid line is the smoothed DRF. Once plotted, two horizontal lines can be drawn to isolate the peaks and bottoms of DRF; the top part becomes a zone representing an overbought condition, and the bottom zone represents oversold. For this chart, the 80-20 levels were used, although we expect this to be consistent over time because the range used in the denominator normalizes volatility. Even though we do not claim that these thresholds are predictive, the original article by Waters and Williams had lines drawn in a similar place. The thresholds for the smoothed DRF were set at 70-30. TABLE 9.2 A/D Oscillator and Trading Signals, Soybeans, January 1, 2011 through March 4, 2011
Date
Open
High
Low
Close
Raw DRF
30% DRF Smoothing
80-20 Entry DRF Signal (Lagged)
70-30 Entry DRF Signal (Lagged)
1/3/2011
1409.00 1422.00 1388.00 1392.00 0.250
0.250
1/4/2011
1391.25 1403.50 1370.50 1382.50 0.367
0.285
1/5/2011
1385.00 1408.00 1375.00 1406.50 0.826
Sell→
1/6/2011
1405.50 1411.75 1389.00 1391.00 0.181
Buy→ 1405.50 0.368
1/7/2011
1389.75 1395.50 1373.25 1378.00 0.236
Buy
1389.75 0.328
1/10/2011 1381.00 1407.50 1379.00 1393.50 0.719
Buy
0.445
1/11/2011 1395.00 1401.50 1368.25 1370.00 0.124
Buy
0.349
1/12/2011 1372.50 1440.00 1372.00 1428.00 0.908
Sell→
0.517
0.447
1/13/2011 1431.75 1445.50 1426.00 1429.00 0.429
Sell
1431.75 0.491
1/14/2011 1431.50 1442.50 1418.00 1435.50 0.582
Sell
0.518
1/18/2011 1425.25 1443.00 1421.25 1426.25 0.523
Sell
0.519
1/19/2011 1429.50 1444.75 1415.25 1424.50 0.415
Sell
0.488
1/20/2011 1426.00 1434.00 1396.50 1427.25 0.517
Sell
0.497
1/21/2011 1428.75 1440.00 1418.00 1425.25 0.420
Sell
0.474
1/24/2011 1425.50 1439.50 1409.75 1417.50 0.366
Sell
0.441
1/25/2011 1417.25 1421.00 1383.25 1387.50 0.106
Buy→
1/26/2011 1388.50 1404.00 1377.25 1398.50 0.687
Buy
1388.50 0.445
1/27/2011 1402.25 1414.00 1391.00 1412.50 0.723
Buy
0.528
1/28/2011 1414.50 1436.25 1405.50 1411.00 0.443
Buy
0.503
1/31/2011 1408.25 1426.50 1407.50 1426.00 0.967 2/1/2011 1426.50 1453.50 1421.25 1451.00 0.880 2/2/2011 1452.50 1465.00 1446.50 1457.00 0.622
Sell→ 0.642 Sell 1426.50 0.713 Sell 0.686
0.341
Sell→ Sell 1452.50
399
Momentum and Oscillators
TABLE 9.2 (continued)
Date
2/3/2011 2/4/2011 2/7/2011 2/8/2011 2/9/2011 2/10/2011 2/11/2011 2/14/2011 2/15/2011 2/16/2011 2/17/2011 2/18/2011 2/22/2011 2/23/2011 2/24/2011 2/25/2011 2/28/2011 3/1/2011 3/2/2011 3/3/2011 3/4/2011
Open
High
Low
Close
1459.00 1451.50 1451.00 1438.00 1450.00 1464.25 1444.75 1431.75 1416.00 1382.25 1378.50 1417.50 1391.00 1310.00 1332.25 1328.75 1378.00 1368.00 1374.50 1390.50 1410.25
1465.50 1455.75 1456.75 1450.00 1468.75 1468.00 1454.50 1438.00 1422.00 1389.00 1418.75 1421.25 1397.50 1335.00 1336.75 1399.25 1380.25 1376.50 1399.00 1414.50 1424.50
1447.00 1435.25 1434.25 1427.00 1448.00 1443.00 1423.00 1413.25 1378.00 1370.00 1378.50 1373.00 1311.00 1296.25 1310.25 1322.00 1357.75 1353.75 1372.00 1384.50 1395.75
1448.50 1446.50 1437.50 1447.25 1464.00 1446.00 1429.00 1416.00 1381.25 1378.50 1416.50 1381.00 1311.00 1331.50 1329.25 1375.00 1364.75 1375.25 1394.25 1412.00 1414.00
Raw DRF
30% DRF Smoothing
80-20 Entry DRF Signal (Lagged)
70-30 Entry DRF Signal (Lagged)
0.216 0.378 0.200 0.701 0.837 0.135 0.250 0.182 0.105 0.401 0.972 0.122 0.038 0.777 0.443 0.799 0.206 0.659 0.866 0.858 0.565
Sell Sell Sell Sell Sell Buy→ Buy 1444.75 Buy Buy Buy Sell→ Buy→ 1417.50 Buy 1391.00 Buy Buy Buy Buy Buy Sell→ Sell 1390.50 Sell
0.545 0.495 0.406 0.495 0.598 0.459 0.396 0.332 0.264 0.305 0.505 0.390 0.284 0.432 0.436 0.545 0.443 0.508 0.615 0.688 0.651
Sell Sell Sell Sell Sell Sell Sell Sell Buy→ Buy 1382.25 Buy Buy Buy Buy Buy Buy Buy Buy Buy Buy Buy
1.000 0.900 0.800 0.700 0.600 0.500
Raw DRF
0.400
Smoothed DRF
0.300 0.200 0.100
FIGURE 9.18 A/D Oscillator.
01 1 /2 28 2/
01 1 /2 21 2/
01 1 /2 14 2/
20 11 7/ 2/
01 1 1/
31
/2
01 1 /2 24 1/
01 1 /2 17 1/
01 1 /2 10 1/
1/
3/
20 11
0.000
400
TRADING SYSTEMS AND METHODS
The rules for using the A/D Oscillator were not defined in the original article, but some simple rules could be: • Sell when the DRF (or smoothed DRF) penetrates into the overbought zone. Close out all accumulated long positions (if any) and go short on the open of the next trading day. • Buy and exit the short position when the opposite conditions occur. • All positions are entered on the next open after a signal. For risk control, positions could be exited if the DRF does not post a lower value (for shorts) within one or two days, and the opposite for longs. In Table 9.2 no stops were used. Long positions were held until a short signal occurred, and shorts until a long was signaled. If the DRF (or smoothed DRF) enters an overbought or oversold zone more than once without the opposite zone being entered, an additional position can be added, although that was not done in the example. Following these rules, the A/D Oscillator showed nine trades, six of them profitable. For the smoothed DRF there were only two trades, both profitable. The amount of smoothing can easily be changed. For more signals, increase the smoothing constant so that it’s greater than 0.30. An Excel spreadsheet and a TradeStation program, both named TSM AD Oscillator, can be found on the Companion Website. Although this example was very good, there are potential problems in the A/D Oscillator. The first happens on locked-limit days (where the market opens at the allowable limit and does not trade). In that case the open, high, low, and close are all the same and the DRF cannot be calculated because the divisor is zero. Fortunately, there are few markets in which that can happen, but it did recently in cotton. A more basic problem concerns gap openings. A much higher opening with a stronger close would also upset the resulting DRF value. Consider the following example:
Monday Tuesday Wednesday Thursday Friday
Open
High
Low
Close
DRF
ΔRFs
ΣΔDRF
43.00 42.00 38.50 42.00 40.00
44.00 42.00 38.50 42.00 43.00
40.00 39.00 38.00 39.00 40.00
41.00 40.00 38.00 40.00 42.00
0.25 0.17 0.00 0.17 0.83
–0.17 +0.17 –0.33 +0.50
–0.17 0.00 –0.33 +0.17
Note that on Wednesday, the DRF indicates that the momentum has reversed, but in fact the price is falling rapidly and gives no indication of recovering; it may actually be gaining momentum. On Thursday the price soars up and closes in the midrange, but the DRF shows a new downward momentum. The problem seems to be related to lack of association with the prior closing price. The daily movement can take on different appearances if the entire range was above or below the closing price. To form this link, replace the current high or low with the prior closing price, in the manner of the true range calculation, if that price was outside the current trading range. The following example shows that the results smoothed out and leaves the trend intact.
401
Momentum and Oscillators
Monday Tuesday Wednesday Thursday Friday
Open
High
Low
Close
DRF
ΔDRF
ΣΔDRF
43.00 42.00 38.50 42.00 40.00
44.00 42.00 (40.00) 42.00 43.00
40.00 39.00 38.00 (38.00) 40.00
41.00 40.00 38.00 40.00 42.00
.25 .17 .37 .25 .83
−.17 +.04 −.12 +.58
−.17 .13 −.25 +.33
Linking the Current Day with the Prior Day Another oscillator can be constructed using the highs and lows relative to the prior close: Ot =
H t C t −1 H t Lt
The two days are linked together, and the ratio of the high price relative to the prior close is measured against the total range for the day. For the normal case, Ht ≥ Ct−1 ≥ Lt; but if Ct−1 replaces eitherr Ht orr Lt to extend the range, the value off Ot will be either 1 or 0 for these extreme cases. As with the A/D Oscillator, the values derived from this method may also be smoothed. Oscillators are not the only tools for measuring momentum or for determining overbought or oversold conditions. Because momentum is very different from either a charting technique or a moving average, it is valuable either on its own or as a confirmation of another method. A word of caution: Trading against the trend can be exciting and profitable, but at considerably greater risk than a trend-following system. The problem with selling an overbought condition is that it is much more difficult to hold losses to a minimum. A long position may be entered while prices are falling fast, and they may continue to fall at the same speed after you are long. Even a quick exit may sustain substantial losses. %R Method After the publication of Williams’ How I Made One Million Dollars . . . Last Year . . . Trading Commodities, the %R oscillator became well known. It is a simple way of calculating where today’s closing price fits into the recent trading range. Using the last 10 days, define %R =
h10 − Closetoday Buying power High a = Rang a e High h10 − Low10
Williams’ 10-dayy %R is different from a 10-day stochastic, because it measures how strong the market closed today compared to the high of the past 10 days. It is also conceptually upside down; that is, as the close gets stronger the value of %R gets smaller. It may be intuitively easier to work with if you use 1.0 −%R. Williams viewed this as a timing device to add positions within a major technical or fundamental trend. This same approach was discussed with regard to the stochastic, and is shown in Figure 9.16. Trades were not entered if they contradicted the major market direction.
402
TRADING SYSTEMS AND METHODS
The Ultimate Oscillator In the Ultimate Oscillator, Williams seems to combine his original idea of the A/D Oscillator with a great deal of Wilder’s RSI.12 He adds the unique feature of three concurrent time periods in order to offset the negative qualities of the short time period used for the %R, without slowing the system too much. The Ultimate Oscillator uses the following steps: 1. Calculate today’s buying pressure BPt by subtracting the true low from the closing
price, BPt = Ct − TLt. The true low TLt = min(L ( t, Ct–1). Rt 2. Calculate today’s true range, TR
max( H t max(
Lt , H t Ct 1 ,,C Ct
1
Lt ).
3. Total the buying pressure BPt separately over the three intervals 7, 14, and 28 days,
designated as SB7, SB14, and SB28. 4. Total the true range TRt over the same three periods, SR7, SR14, and SR28. 5. Divide the sum of the buying pressures by the corresponding true range, that is, SB7/
SR7 and scale by multiplying the 7-day value by 4 and the 14-day value by 2. All three calculations are now in the same scale. Notice that the nearest seven values for the buying pressure and the true range are each used seven times, that is, they are multiplied by both the scaling factors of 4 and 2, and used once more in the 28-day calculation. Williams has created a step-weighted momentum, assigning values of 7, 3, and 1 to the first 7 days, second 7 days, and last 14days, respectively. The last 14 days account for only 10% of the total. The rules for using this oscillator (Figure 9.19) are: 1. A sell set-up occurs when the oscillator moves above the 50% line, peaks at a high
value, declines, and then moves higher. If the oscillator fails to move above the peak on the next rally, a short sale order can be placed when the oscillator fails on the right shoulder. This is a traditional top confirmation signal.
FIGURE 9.19 Williams’ Ultimate Oscillator. 12
Larry Williams, “The Ultimate Oscillator,” Technical Analysis of Stocks & Commodities (August 1985).
403
Momentum and Oscillators
2. Short positions are closed out when a long signal occurs, when the 30% level is
reached, or if the oscillator rises above 65% (the stop-loss point) after being below 50%. 3. A buy signal is given using the opposite formation as the short signal (rule 1). 4. Close out longs when a short signal occurs, when the 70% level is reached, or if the
oscillator falls below 30% (after being above 50%).
Relative Vigor Index John Ehlers, who has contributed extensively in the mathematical analysis of prices, in particular using cycles, has created the Relative Vigor Index x (RVI), a very smoothed 13 momentum indicator. The basic form of RVI is RVI = (Close − Open)/(High ( − Low) However, the final RVI uses a 4-day symmetric weighting (similar to a triangular weighting) of the close − open in the numerator, and a similar symmetric weighting of the high − low in the denominator. RVI is conceptually similar to the A/D Oscillator; however, the RVI is smoothed in a special way that targets a particular price cycle and eliminates the 2-bar cycle and its associated unwanted frequencies. While it is preferable that the price series be analyzed for its cycle period, Ehlers suggests using 10 as the nominal value. The RVI is calculated as Nt = [(C Ct − Ot) + 2 × (C Ct−1 − Ot−1) + 2 × (C Ct−2 − Ot−2) + (C Ct−3 − Ot−3)]/6 Dt = [(H (Ht − Lt) + 2 × (H (Ht−1 − Lt−1) + 2 × (H (Ht−2 − Lt−2) + (H (Ht−3 − Lt−3)]/6 Numeratort = Σ Ni, i = t − n + 1, t Denominatort = Σ Di, i = t − n + 1, t RVI = Numeratort/Denominatort, while Denominatort ≠ 0 RVI signal linet = (RVI ( + 2 × RVIIt−1 + 2 × RVIIt−2 + RVIIt−3)/6 where Ot, Ht, Lt, and Ct are today’s open, high, low, and closing prices and n is the calculation period, nominally 10. The RVI signal line is used in the same manner as the MACD signal line. After a peak in the RVI value, showing an overbought situation, the sell signal occurs the first time that the RVI crosses the RVI signal line moving lower.
13
John F. Ehlers, “Relative Vigor Index,” Technical Analysis of Stocks & Commodities (January 2002).
404
TRADING SYSTEMS AND METHODS
DOUBLE-SMOOTHED MOMENTUM Important contributions to the study of momentum have been made by William Blau.14 In addition to creating new momentum indicators, he has added substantial value to the old ones. Also refer to his work on double smoothing of momentum in Chapter 7.
True Strength Index Much of Blau’s work combines double smoothing of momentum values (1-period price differences) which has surprisingly little calculation lag given the amount of smoothing. By using the first differences, he has based the calculations on values more sensitive than price and then slowed them down by smoothing. In effect, he speeds up the price movement before slowing it down. The net result is that the final index value has less lag than we would normally expect, and the index line is much smoother than a standard moving average. Blau refers to this as using momentum as a proxy for price. One of Blau’s most popular indicators is the True Strength Index x (TSI) which combines these features: TSI S ( close , r , s ) = Where
100 × XAverage a ( XAverage XA a ( close − close [1], r )s ) XAverage a ( XAverage a ( absvalue ( close close [1], r )s)
r = the calculation period of the first momentum smoothing s = the calculation period of the second momentum smoothing close − close[1] = the 1-day momentum XAverage(close, period) = the TradeStation function for exponential smoothing AbsValue = the TradeStation function for absolute value
A spreadsheet to calculate the True Strength Index for crude oil, TSM True Strength Index, and a program indicator, TMS True Strength, are available on the Companion Website. The spreadsheet code, which is easily entered, is set up as follows: 1. Column B is the closing prices 2. Column C is the 1-day difference in prices 3. Column D is the first smoothing, where D3 = C3 and D4 = D3 + $H$2*(C3-D3) 4. Column E is the second smoothing, E4 = D4, and E5 = E4 + $H$3*(D5-E4)
The smoothing constants in H are derived from the days in G using 2/(n + 1). A sample of the spreadsheet appears in Table 9.3. The numerator and denominator of the TSI differ only in that the denominator takes the absolute value of the price changes (the 1-day momentum). This guarantees 14
William Blau, Momentum, Direction and Divergence (New York: John Wiley & Sons, 1995).
405
Momentum and Oscillators
TABLE 9.3 TSI Calculations Using Two 20-Day Smoothing Periods
Column
A
B
C
D
E
Date
Crude
Diff
Smooth 1
Smooth 2
2
1/3/2011
96.35
3
1/4/2011
94.18
4
1/5/2011
95.1
5
1/6/2011
6 7
–2.17
–2.170
0.92
–1.876
–1.876
93.18
–1.92
–1.880
–1.876
1/7/2011
92.83
–0.35
–1.734
–1.863
1/10/2011
94.05
1.22
–1.453
–1.824
8
1/11/2011
95.91
1.86
–1.137
–1.758
9
1/12/2011
96.42
0.51
–0.980
–1.684
10
1/13/2011
95.85
–0.57
–0.941
–1.613
F
G
H
Smooth 1
20
0.0952
Smooth 2
20
0.0952
that the denominator will be at least as large as the numerator. The 1-day differences are first smoothed over the period r, and then the result is smoothed over the periods. The relationship between the standard momentum (the difference in prices over r days) and the TSI can be seen in Figure 9.20 for Intel (INTC). The standard 20-day momentum indicator (second panel) has the typical erratic pattern of prices, and a slight lead identifying the peaks. The TSI is much smoother with peaks and valleys lagging prices slightly (third panel). If more smoothing is necessary to avoid false signals, a signal line can be created by smoothing the TSI using a 3-period moving average, then buying when the TSI crosses the signal line after a high or low value was reached. This can be a basic trend signal, or it can be applied in the manner of MACD. The slight lag in the TSI seems a small problem compared to the extreme noise of the momentum calculation. Additional Smoothing without Adding Lag In creating the TSI, Blau missed an opportunity to improve the smoothing with only a minor increase in the lag. Instead of taking the 1-day differences, substitute the n-day differences in the first step. This smoothes the trendline even more at the cost of a slight additional lag. Figure 9.20 shows the TSI with a 10-day difference followed by two 20-day exponential smoothings in the bottom panel. Anticipating the Turn When working with trendlines that are very smooth, such as the 10-20-20 TSI, you can anticipate the change in the trend direction most of the time. Instead of waiting for the smoothed trendline to change from up to down, you can sell when it gets to a “near-zero slope” and is continuing to flatten. This anticipation can greatly reduce the lag and improve performance even at the cost of a few false signals.
406
TRADING SYSTEMS AND METHODS
FIGURE 9.20 Comparing the TSI with 10-20-20 smoothing (bottom) to a standard 20-period momentum (center) using INTC from January 2001 through March 2002.
Double-Smoothed Stochastics Because of Blau’s great interest in double smoothing, he defines the general form of a double-smoothed stochastic as: DS ( q, r , s ) =
100 × XAverage a ( XAverage a ( close Lowest( low, q ), r ), s ) XAverage a ( XAverage a ( Highest ( high i , q ) Lowest ( low, q ), r ), s)
Where Close − Lowest(low,q) = the numerator of Lane’s raw stochastic, the lowest low over the past q periods Highest(high,q) − Lowest(low,q) = the denominator of Lane’s stochastic, the greatest high-low range over the past q periods XAverage((...,r), r s) = an exponential smoothing of the numerator, first calculated overr r periods, then overr s periods
TRIX Similar to Blau’s double smoothing is TRIX, a triple-smoothed exponential that is most often used as an oscillator. Introduced by Jack Hutson,15 it is created using steps similar to Blau except that there are three exponential smoothings and the differencing is done at the end. Typically, the same smoothing constants (calculation periods) are used for each smoothing. This method has been applied to daily, hourly, or even 1-minute price data. 15
Referenced in Robert W. Colby, The Encyclopedia of Technical Market Indicators (NewYork: McGraw-Hill, 2003) as “Good Trix” by Jack K. Hutson, Technical Analysis of Stocks & Commodities1, no. 5.
Momentum and Oscillators
407
1. Calculate the natural log (ln) of the closing prices (daily or intraday bars). This im-
plicitly corrects for price volatility; however, it is commonly omitted from the calculation because back-adjusted data in futures will cause errors. 2. Calculate the p-period exponential smoothing of the closing prices, or the ln of the
closing prices, to get trend 1. 3. Calculate the q-period exponential smoothing off trend 1 to get trend 2. 4. Calculate the rr-period exponential smoothing of trend 2 to get trend 3. 5. Get the 1-period differences of trend 3 by subtracting each value from the previous
value. As with the added smoothing of the TSI, the 1-period differences can be replaced with the s-period differences. 6. Scale the results by multiplying by 10,000. This is an attempt to get TRIX scaled to a
positive integer value for charting and may also be omitted. The resulting TRIX indicator acts as an oscillator due to Step 5. It can be very smooth when the calculation periods are larger; it also reduces the lag because of the differencing step. TRIX can be used as a trend indicator by buying when the value of TRIX crosses above zero and selling when it crosses below zero. It can produce buy and sell signals sooner by buying when the TRIX value is rising for two or three consecutive periods, and selling when TRIX is falling for two or three consecutive periods. Because the triple smoothing results in a very smooth TRIX value, trading signals can safely use the change in TRIX as an advance indicator of trend. Figure 9.21 compares TRIX (center panel) with the TSI (lower panel), both based on first differences, but using the smoothing constant of 1.0 to negate one of the steps. The point is to show that TRIX is actually smoother because the differences are taken at the end rather than the beginning. The lag in TRIX is slightly more than the TSI, but it would be unnecessary to use n-day differences for TRIX to get further smoothing; therefore, TRIX may have less lag in its final form.
FIGURE 9.21 Comparison of TRIX (center panel) and TSI (lower panel) using two 20-day exponential smoothings applied to INTC.
408
TRADING SYSTEMS AND METHODS
Changing the Divisor All return calculations divide the price change from yesterday to today by the starting value, yesterday’s price. There is no rule that says that you cannot divide the change by the current price, rt =
Closet Close C t −1 −1 Closet
While this would result in only small changes, the cumulative effect is said to add stability to an indicator that is based on returns.
An Oscillator to Distinguish between Trending and Sideways Markets The lack of predictability of trending markets is the greatest problem for the analyst. The work found under the topics “Ranking of Markets for Selection” and “Directional Movement” in Chapter 23 discusses that issue. Based on the idea that the trend component is stronger when price is further from fair value, and the noise (sideways movement) is greater when price is near value, an oscillator can be created to show the strength of the trend component based on this concept, Strengt n th Oscillatorrt =
Average a (Closet Close C t 1, n) Average a ( High ht Lowt , n )
As the trend increases, the average change in closing prices becomes larger relative to the high-low range for the day. During an unusual period, when the market gaps open, it would be possible for the differences in the closing prices to become larger than the daily range. In a sideways market, both the change in the closes and daily range will get smaller, but the net price change over period n should be close to zero. This oscillator can be smoothed by taking the change in price over two or three days (for example, closet− closet−3), rather the most recent day, as well as taking the high-low range over the same number of days. The indicator and function, TSM Strength Oscillator, can be found on the Companion Website.
Adding Volume to Momentum A momentum indicator can also incorporate volume by multiplying the price change over n periods by the total volume over that same period. The use of the cumulative volume over the period, or even better, the average volume, will help to stabilize the volume, which is often erratic when seen as only one day’s activity. The average volume will appear to be the same magnitude as the volume and can be plotted along with it on a
409
Momentum and Oscillators
chart. That gives the momentum-volume indicator (MV), shown mathematically and in programming notation:
MV Vt = ( pt
pt
n
∑ )×
t
volumei
i t − n +1
n
MV = (close-close[n])*average(volume,n)
Alternately, the price change overr n periods could have been divided by y n to give a per unit value. The following sections will include those techniques that combine price change and volume or open interest; for methods that use volume but not price, see Chapter 12.
Scaling by a Percentage or Volatility The same conversions can be applied to momentum with and without volume. Using a percentage rather than price will add some robustness over long test periods. Because volatility often increases faster than a fixed percentage of the price when prices rise, momentum can be scaled according to a shorter measure of true range. If the true range is averaged over 20 to 65 days, approximately one month to one quarter, then the 1-day change in price will become a relative momentum value. By using a much longer period for averaging the true range, you can create a stable profile of the volatility changes in the underlying market. Percentage momentum with volume %MV = (close − close[n]) / close[n] * average(volume,n)
Momentum with volume scaled by true range TRMV = (close − close[n]) / average(truerange,p) * average(volume,n)
where truerange is always calculated for the most recent period (e.g., 1 day), and the average of the 1-day true ranges for the past p days is average(truerange,p).
Volume-Weighted RSI In the same way that the RSI accumulates the price changes for positive days and divides by the sum of the negative changes, it is possible to weight each day by its volume to add another factor, called money flow,16 to the calculation. A positive or upwards day is when the average of today’s high, low, and close is greater than the previous average. Each average is then multiplied by the volume, giving the daily money flow, and a ratio of the past 14 days is used to create a money ratio and finally a money flow index, both steps similar to Wilder’s RSI. 16
Gene Quong and Avrum Soudack, “Volume-Weighted RSI: Money Flow,” Technical Analysis of Stocks & Commodities (March 1989).
410
TRADING SYSTEMS AND METHODS
Moneyflo f wt
Moneyratiot
V l et × Volum
∑ = ∑
t i t −13 t i t −13
Moneyflowindex f t = 100 −
High ht + Low L wt Close C t 3
Moneyflo f wi iif > 0 Moneyflo f wi iif < 0
100 1 + Moneyratiot
Herrick Payoff Index Using the change in the underlying value of the futures contract, rather than only the change in price, the Herrick Payoff Index17(HPI) combines volume and open interest to generate an indicator that is not bounded as is the basic momentum calculation. The daily value is:
HP Pt = cff × Vt
Where
( Mt
⎡ ⎛ Mt M t 1 ) × ⎢1 + ⎜ ⎣ ⎝ | Mt
M t −1 ⎞ ⎛ 2 | OI t − OI t −1 | ⎞ ⎤ ⎥ M t −1 | ⎟⎠ ⎜⎝ min(OI t ,OI , OI t 1 ) ⎟⎠ ⎦
t = today t − 1 = the previous day cf = the conversion factor (value of a one big point move) Vt = today’s volume (Mt − Mt−1) = the difference in the mean values, M (M M=(high + low)/2, where vertical bars denote absolute value |OIIt − OIIt−1| = the absolute value of the change in open interest (for futures) min(OIIt, OIIt−1) = the smaller of the open interest for today or the previous day
The expression that divides the change in mean prices by the absolute value of the same change is used to create a value of +1 or −1. The index HPt is then scaled down to a manageable value and smoothed using a 0.10 smoothing factor, s (about 19 days). This complex formula for HPI can also be written in programming code as HP = BigPointValue*volume*((high-low)/2 − (high[1]-low[1])/2)* (1+(((high-low)/2 − (high[1]-low[1])/2) / absvalue((high-low)/2 − (high[1]-low[1])/2))*2* (absvalue(opint − opint[1])/lowest(opint,2))) HPI = smoothedaverage(HP,19) 17
From the original CompuTrac manual, which became the Dow Jones Telerate division, and finally just Dow Jones.
411
Momentum and Oscillators
12000 10000 8000 6000 4000
Close
2000
HPI
0 -2000 -4000 1/3/2000
1/3/2001
1/3/2002
1/3/2003
1/3/2004
1/3/2005
1/3/2006
1/3/2007
1/3/2008
1/3/2009
1/3/2010
1/3/2011
FIGURE 9.22 The Herrick Payoff Index applied to the DAX, 2000 through February 2011.
Most analysts who use the Herrick Payoff Index divide the HPI by 100,000 to scale the value to a more usable level (in the example below it is scaled by 1,000,000). The final series, when seen along with prices, may appear volatile and require interpretation, often using trendlines. This is due to the fluctuations in volume and open interest, which are smoothed over 20 days, rather than a longer period. The Herrick Payoff Index may be helpful, despite its volatility, because it is a combination of factors not included in most other indexes. It has patterns that appear to lead price change to compensate for its noisy behavior. A spreadsheet, TSM Herrick Payoff Index for DAX, X and a program, TSM Herrick Payoff, f can be found on the Companion Website. Figure 9.22 gives an idea of how the HPI reacts to prices, in this case using the German DAX from 2000 through February 2011. It shows higher volatility at the turning points and very low volatility during the upwards trends from 2004 to 2006 and again in 2010. It turns out that volume is a good surrogate for volatility and might actually be a good forecaster of volatility. This is discussed in Chapter 12.
Comments on the Use of Volume Volume is an important piece of information, but it can be difficult to interpret. It fluctuates in a much larger range than price, and may be 50% higher or lower from day to day. While it indicates market interest and potential volatility, there are many days for which a high or low volume does not have a consistent reaction. In general, adding volume to an indicator results in a more volatile, erratic series. Therefore, the first steps in using volume are: 1. Create a long-term, smoothed volume series. 2. Locate days with extremely high volatility to identify only those exceptional days
where continued high volatility should follow. 3. Low volume should not be determined by a single day, but by either a few unusually
low days clustered together or by a decay in the smoothed volume over a modest time period. Using volume to enhance trend signals as well as identifying important volume patterns is discussed in Chapter 12.
412
TRADING SYSTEMS AND METHODS
VELOCITY AND ACCELERATION In physics, momentum is called speed orr velocity. It is the amount of change measured over a specific period of time. It is also called rate of change and with regression analysis it is slope, discussed in detail in Chapter 6. pt xt
Slopet =
pt− n xt − n
where the numerator is the change in price and the denominator is the change in the xaxis, which is normally the time, or simply n, elapsed units. For example, when traveling in a car, your speed might be 30 miles per hour. When prices are moving higher, they may be averaging a gain of $1 per week. There are two types of velocity: average and instantaneous. The average velocity is simply calculated as the mean velocity over a fixed distance and for a fixed time interval. In working with stock and futures prices, the time interval used is days and the distance is measured in points or unit value; if IBM moved $5 in six days, its average velocity is v
5 6
$0 833 per day
In general, the average velocity is expressed v=
D T
where D = the total elapsed distance over the time interval T Velocity is the same as the simple measurement of momentum. For a geometric interpretation of momentum, the change in price, D, can be related to the length of the momentum span, T, giving the same results for average velocity as for slope. Physicists prefer to draw velocity (the average over period T) and instantaneous velocity (the speed at exactly one point) in their own way, shown in Figure 9.23. The instantaneous velocity, v, which is the velocity calculated at a specific point in time, may be different from velocity. In order to determine the instantaneous velocity, a mathematical technique called differentiation is used. It effectively looks at smaller and smaller time intervals and consequently smaller distances on the price curve until the slope calculation is reduced to a single point. The result of the process of differentiation is called the derivative and is expressed vt = lim Δ t→ 0
ΔD D dD = Δt dt
This shows that the velocity taken at any point is the result of the time interval (t) becoming progressively smaller without actually reaching zero. The symbol delta (∆) represents
Momentum and Oscillators
413
(a)
(b)
FIGURE 9.23 (a) Average velocity. (b) Instantaneous velocity.
the change in price (∆D ∆ ) and the corresponding change in time (∆t). The rules for differentiation can be found in any advanced mathematics book. Only the results are presented here. The velocityy vt represents the speed or momentum of the price at the point in time t. Iff v gets larger forr t0, t1, t2, . . ., then the velocity is increasing; iff v gets smaller, the velocity is decreasing. Because the velocity also denotes direction, it can be both positive and negative in value and appear similar to a momentum indicator. Acceleration is the change in velocity. In the same way that we find the change in price D over time period t, we can find the change in velocity over time period t. Therefore, if you are driving at 30 miles per hour when you enter the acceleration ramp of the motorway, and after one minute you are driving 60 miles per hour, you have changed speed, or accelerated, at the rate of 30 miles per hour per minute. Fortunately, we do not need to be concerned about the units of time when we apply these techniques to prices. The units are always the same, whatever they are. When S&P prices have been moving
414
TRADING SYSTEMS AND METHODS
higher at an average speed of 10 points per week and then begin posting increases of 15 points per week, then 20 points per week, prices are accelerating at the rate of 5 points per week. Mathematically, velocity can be substituted for price in the equation forr vt to get acceleration, at. at = lim Δ t→ 0
ΔV dV = Δt dt
The short-cut to finding velocity and acceleration is to take the first and second differences, each step removing first the trend, then the speed, leaving the more sensitive components plus noise.
Finding the Velocity and Acceleration of Different Techniques Differentiation can be applied to many different formulas that have been discussed previously, including those that represent a straight line, curved lines, and various other trendlines. The result of the first differentiation gives you the component that represents velocity, and the result of the second differentiation is the component of acceleration. Of course, some of the basic equations have constant velocity and cannot be used for a velocity trading plan because the values never change. The straight line, simple and weighted moving averages, and exponential smoothing all have constant velocities. Only those equations with second-order smoothing will work. Table 9.4 gives basic equations along with their first and second derivatives. TABLE 9.4 Equations for Velocity and Acceleration
Straight line Curvilinear Logarithmic (base a) Logarithmic (natural log) Exponential Moving average
*
Basic Equation
Velocity at x t
Acceleration at
yt = a + bxt
vt = b vt = b + 2cxt
at = 0 at = 2c
yt
a + bx t + cx t2
yt = logaxt
vt = (logae)/xt or vt = 1/(xt ln a) at
1// (x ( x t2 ln a )
yt = ln xt
vt = 1/xt
at
1// x t2
aeaxt
at
yt
e axt
yt =
x t + x t −11 + + x t n
vt n +1
Weighted moving a x + a x t −1 + + an x t −n +1 yt = 1 t average n Exponential smoothing
yt = yt–1 + c(xt–y yt–1)
vt = 1
vt =
a1 a2 + + an n
vt = c
x t*
a 2eaxt
at = 0 at = 0 at = 0
*Because velocity and acceleration are time derivatives, all equations implicitly include the factor d (xt ) as part of the right member. dt
415
Momentum and Oscillators
Let’s assume that the velocity and acceleration have been calculated as in Table 9.4. The following are the possible combinations that can occur: Velocity
Acceleration
+ + + 0 – – –
+ 0 – 0 + 0 –
Price Movement
Price Price Price Price Price Price Price
is is is is is is is
moving moving moving static moving moving moving
up at an increasing rate up at a constant rate up at a decreasing rate down at a decreasing rate down at a constant rate down at an increasing rate
Using acceleration, a change of velocity (or momentum) can be detected or the strength of a current price move can be confirmed.
Using Velocity and Acceleration to Identify a Sideways Market The combination of velocity and acceleration can give a good indication of whether prices are moving in a directional or sideways pattern. When velocity is near zero, the average speed of price movement is near zero. It is also the same as saying that prices have netted no movement over the time interval T T. However, that is not enough. During the interval T T, prices may have moved sharply higher then sharply lower. By chance, they are unchanged after time T although they are still moving lower quickly. The acceleration will tell you that prices are moving even though they are at the same level as T periods ago. To identify a sideways pattern, both the velocity and acceleration must be near zero.
Quick Calculation of Velocity and Acceleration A less precise but very convenient way of isolating velocity and acceleration is the calculation of first and second differences. The purpose of these values is to find more sensitive indicators of price change, and most traders find this quick calculation satisfactory. The results can be used in exactly the same way as the formal mathematical results. Consider the following two examples: 1. A price series 10, 20, 30, 40, . . . is moving higher by a constant value each day. The first
differences are 10, 10, 10, . . ., showing a consistent velocity of 10. The second differences, formed by subtracting sequential values in the first-difference series, are 0, 0, 0, . . ., showing that there is no change in speed; therefore the acceleration is zero. 2. Another price series is shown with its first and second differences as Time
1
2
3
4
5
6
7
8
9
10
11
12
Series Velocity Acceleration
10
15 +5
20 +5 0
30 +10 +5
45 +15 +5
50 +5 –10
45 −5 –10
35 –10 −5
25 –10 0
20 −5 +5
25 +5 +10
40 +15 +10
416
TRADING SYSTEMS AND METHODS
where velocity values are the first differences, and acceleration the second differences. The original series has two turns in the trend direction clearly shown by the velocity and acceleration as changes in the sign of the numbers. The velocity continues to be positive through the sixth value as the underlying price moves from 10 to 50. Whenever prices change direction, the velocity changes sign. The basic upward trend can be associated with a positive velocity and a downward trend with a negative one. The acceleration shows the change in speed. At the sixth item, the acceleration becomes negative, even though the velocity was positive, because prices moved higher at a slower rate. They had been gaining by 5, 10, and 15 points each day, but on day 6 the gain was only 5 points. This reversal in acceleration was a leading indicator of a trend change. A similar situation occurred on day 8, when the acceleration slowed and reversed on day 10, one day ahead of the actual price reversal.
HYBRID MOMENTUM TECHNIQUES Combining a Trend and an Oscillator Directional Parabolic System The Directional Parabolic System18 is a combination of two of Wilder’s well-known techniques, Directional Movement and the Parabolic Time/Price System. Directional Movement is covered fully in Chapter 23. It gained popularity as a method of selecting the futures markets that were most likely candidates for trend-following systems. The Parabolic Time/Price System is covered in Chapter 17. Although a full reading of both techniques is necessary, the essence of the combined systems may be understood with the following definitions: +DM14 −DM14 ADX DPS
The 14-day upward Directional Movement, the sum of the current high prices minus the previous high prices. The 14-day downward Directional Movement, the sum of the previous low prices minus the current low prices. The Average Directional Movement Index, calculated by smoothing the Ratio of the net of +DM14 and −DM14 by the sum of the same values. The Directional Parabolic stop-loss.
Although shown as −DM14, the downward Directional Movement is a positive number based on the sum of those days that closed lower. The ADX is a ratio of the +DM14 divided by −DM14 representing the positive direction of the index. Therefore, the ADX is an oscillator such that, when its value is greater than 50, it means that price movement 18
J. Welles Wilder, Jr., Chart Trading Workshop 1980 (Greensboro, NC: Trend Research, 1980).
Momentum and Oscillators
417
is upwards. Directional Movement is combined with the Parabolic Time/Price System according to the following rules: 1. If the ADX is up, take only long Parabolic System trades; if the ADX is down, take
only short trades. 2. If the two systems conflict, no trade is entered. A trade may be entered at the time
they agree. 3. If a position is held, the Parabolic stop is used. (The stop is now called the DPS in-
stead of the SAR because it no longer requires a reversal of position.) 4. If no position is held, the Directional Movement equilibrium point is used (the high
or low of the day on which the +DM14 crosses the −DM14). In 1980, the entry rules were revised to include an added use of the ADX when it is greater than the +DM14 or the −DM14. Because the ADX is an oscillator and indicates turning points in the trend, when the ADX exceeds the magnitude of the current +DM14 or −DM14 and reverses, the current position should be closed out. If the ADX remains above both the +DM14 and −DM14, the market is extremely strong, and liquidation should stop. The ADX is intended to be a leading indicator for liquidation only. Reversal of the current position only occurs when the DPS has been penetrated and the new trade agrees with the direction of the Parabolic System. The addition of an oscillator to a trend-following system allows trades to be closed out at more favorable prices than the usual trend exits. If the new direction carries through and the position is reversed, the added feature has worked perfectly; however, if prices turn back in the original direction, a reentry may not be possible. The revised rules are unclear concerning reentry into a position if prices fail to penetrate the DPS and signal a reversal. A reentry might occur if the ADX falls below both the +DM14 and −DM14, indicating that prices are no longer extreme, then turns back in the trend direction. Once reestablished, the DPS can be used and additional exits using the revised rules would apply. Oscillator Method with ADX Filter A simple variation from Lars Kestner19 creates an oscillator from two moving averages, then uses the ADX to show a lack of trend. The rules are Osc = average(close,10) – average(close,50) If osc < osc[1] and ADX(14) < 30 then sell next open If osc > osc[1] and ADX(14) < 30 then buy next open If osc > osc[1] then buy to cover next open If osc < osc[1] then sell next open 19 Lars
Kestner, Quantitative Trading Strategies (New York: McGraw-Hill, 2003).
418
TRADING SYSTEMS AND METHODS
Using a Oscillator as Timing for a Trend System One point of irritation is that trend entries always seem to be poorly timed. Traders would prefer to wait for pullback after a buy or sell signal to enter at a better price. This can be done using an oscillator of a much shorter calculation period than the trend. One choice would be 1. Calculate a 40-day moving average 2. Calculate a 5-day stochastic indicator 3. Buy when the 40-day trend is up and the 5-day stochastic < 20 4. Sell when the 40-day trend is down and the 5-day stochastic > 80
It may also be better to enter trades using this timing method but exit immediately when the trend changes. Waiting for just the right point to exit may result in very high risk if the market is moving the wrong way. In order to avoid missing a trade entirely, a rule can be added that forces entry after n days following the initial signal.
Cambridge Hook An indicator that combines Wilder’s RSI with other basic indicators is the Cambridge Hook.20 It is intended to identify an early reversal of the current trend by combining three indicators. The following conditions must occur in an existing upwards trend: • An outside reversal day (a higher high followed by a lower close). • Wilder’s RSI must exceed 60% (moderately overbought). • Volume and open interest must be increasing. The result is a high likelihood of a downward trend reversal (the opposite applies to upward trend reversals). Protective stops are placed above the high of the hook on the day that signaled a downward reversal. The program function TSMCambridgeHook, available on the Companion Website, returns a “1” when an upwards hook occurs and a “–1” when a downwards hook occurs. These events should be filtered with a trend direction. Note that using the open interest may be a problem. While volume is available through the day for most futures markets, open interest is not as easily available. Because of that, the program TSM Cambridge Hook, on the Companion Website, has the option of not using open interest.
MOMENTUM DIVERGENCE Divergence occurs when two price series move apart. The Dow Jones Industrials and Dow Jones Utilities are diverging if the Industrials are rising while the Utilities are falling. This divergence between these two markets has always been considered a leading indicator 20
Elias Crim, “Are You Watching the ‘Right’ Signals?’’ Futures (June 1985).
419
Momentum and Oscillators
PRICES RISE 2
3 PRICES DECLINE Mo omentum(Close,20) 2.29
PRICES DECLINE 1 B
MOMENTUM DECLINES
MO OMENTUM RIS SES C A MOMENTUM RISES
FIGURE 9.24 Momentum divergence.
of a downturn in the economy. The S&P 500 is also watched in relationship to the 10-year Treasury note, the benchmark long-term rate. Notes usually counterbalance moves in the stock market. When the S&P rallies at a fast pace, the price of notes falls to reflect the anticipation of an increase in interest rates needed to dampen growth. When the S&P and the price of notes both rise, or both fall, something special is happening. When prices diverge with respect to a technical indicator, such as an unsmoothed momentum or the MACD, the direction of prices is expected to follow the direction of momentum. You can visualize the price chart needed for divergence as the rising part of a rounded top. Prices are still going up but at a slower and slower rate. Momentum divergence is measured by comparing the direction of prices with the direction of a momentum indicator over the same time interval. Most often, this is done by connecting the peaks of the price movement when prices are rising (or the valleys of the price declines). Connecting only the peaks and valleys of both prices and momentum avoids the problems associated with erratic data. Figure 9.24 shows three examples of a 20-day momentum divergence for Intel. A bearish divergence is one that anticipates a downturn in prices. Because momentum is a leading indicator, a bearish divergence occurs when prices are rising and the momentum values are falling. This can be seen in the middle of Figure 9.24 where line 2 (top panel) shows sharply rising prices at the same time that line B (bottom panel) shows clearly falling momentum values. Price follows momentum, and a sharp decline lasts for all of December 2002.
420
TRADING SYSTEMS AND METHODS
A bullish divergence is formed when prices are declining while momentum values are rising. Two examples of a bullish divergence can be seen in Figure 9.24 marked with 1 and 3 on the price chart and A and C on the momentum indicator. The important points to remember about a divergence are: • Prices and momentum must be moving in opposite directions. It is not correct to say there is a bullish divergence when momentum is rising quickly while prices are moving sideways or slightly higher. Theyy must be moving in opposite directions. • The greater the divergence, the more likely prices will change direction soon. That is, when prices are moving up very sharply and momentum is clearly moving lower, then the likelihood of an immediate change of direction for prices is much greater than if prices were gradually rising while the momentum was slowly falling. • A bearish divergence can be interpreted as a market that is rising slower and slower. Each successive peak makes a smaller advance, and each successive peak occurs after more and more time has elapsed. This may appear similar to a rounded top before prices start down. • Divergence that occurs over a longer time period (for example, months) will forecast a larger price reversal than a divergence formed over hours or days. Divergence is best when the momentum indicator begins at an extreme high or low level, indicating that the price move is extended. It is particularly good if the divergence signal occurs while momentum is still well above or below the midpoint of the indicator values, either 50 or 0. That assures us that a price correction can occur before the indicator returns to neutral.
An Amazon.com Example Using Momentum Peaks Momentum divergence is an important concept. The following example, applied to Amazon.com in Figure 9.25, uses the method of momentum peaks with MACD, plus an additional rule. Use the following steps: 1. Find the swing highs on the chart. This can be done simply by looking at the highest
peaks. In Figure 9.25 there are two significant peaks, one in January 1999 and the other at the end of April 1999. There is a peak slightly earlier in April; however, that is part of the price move that ends with a rally to 110. 2. Draw a line connecting the January and April peaks. 3. There will be two corresponding peaks in the MACD lines directly below the price
chart. Connect the two peaks in the MACD line. 4. The line drawn across the price highs is clearly rising. The line across the MACD
peaks is clearly falling; therefore, the pattern indicates a bearish divergence. Prices confirm the divergence by dropping from 110 to 70 in less than two weeks, and then below 50 in the same move.
421
Momentum and Oscillators
Rising prices Horizontal resistance
Fallin ng MACD gives strong divergence signal
FIGURE 9.25 An example of divergence in Amazon.com.
There is also an unmarked bullish divergence on the chart. Prices bottom in June and August with clearly rising lows in the MACD occurring at the same time. The August price low marks the bottom of the move and a rally follows.
Trading Rules for Divergence There are a number of alternative rules for trading a momentum divergence, each differing in the amount of anticipation. MACD Divergence The simplest rules are based on using the MACD as the indicator to create a bearish divergence. Once the second rising price peak is identified, along with the corresponding MACD peak, the divergence sell signal comes when the MACD line crosses the MACD signal line as it moves lower. This is seen in Figure 9.25 at the end of April. The trade is exited when the MACD value becomes zero, or if a price objective is reached, based on a top formation. It is possible to extend the trade by waiting for the MACD line to cross back over the signal line before exiting. The same rules apply to a bullish divergence. General Rules for Trading Momentum Divergence 1. Enter a short position when the divergence is identified, provided prices have not already reached the correction level or profit target. Bearish divergence is
422
TRADING SYSTEMS AND METHODS
recognized after the second momentum peak has crested; therefore, it is possible that the momentum value will be near neutral (the midpoint value) if the first momentum peak was not an extreme. The neutral momentum is the normal profit target because we cannot expect high momentum to alternate with low momentum, but we can expect high or low momentum to correct to neutral, or zero. Waiting until the divergence is extremely clear is often too late. Momentum will have achieved most of its correction. An alternative is discussed in the following section, “Anticipating the Divergence.” 2. Enter a short position when the MACD line crosses the signal line after the diver-
gence formation is recognized. MACD offers a clear signal: the crossing of the faster MACD line with the slower signal line. This is a basic buy or sell signal and applies equally to divergence patterns. 3. Exit the short position when the current momentum moves above the last mo-
mentum peak. A new momentum high after a divergence signal indicates that the divergence has disappeared and there is no basis for this trade. The exact price at which this occurs may be calculated one day in advance for most momentum indicators. 4. Exit the short position when the market has corrected or an objective has been
reached. Once the momentum has declined to the midpoint level of 50 for the RSI and stochastic, or zero for the MACD or simple momentum, it should be considered neutral and cannot be expected to continue into negative values. A price objective can also be set using volatility or support levels. 5. Exit the MACD short divergence when the MACD crosses the signal line moving
higher. MACD provides a signal that may allow the divergence trade to be held longer, or exited quickly. In Figure 9.25 the MACD line gives a sell signal at the beginning of May and does not give another buy signal to close out the trade, until mid-June. This adds considerable profit to the trade. 6. Allow the short divergence position to convert to a short trend position. If the
MACD is not used, then a simple trend, such as a moving average, can be substituted. A short divergence signal can be converted to a short trend signal using, for example, one of the two trends used to create the MACD. Anticipating the Divergence Divergence signals are often seen too late. When the second momentum peak is recognized, especially when the divergence is severe, the momentum values are already near their neutral level, 50 or zero. Anticipating the divergence signal can be a more successful approach to trading. Bearish divergence can be anticipated at the point where prices move above their previous resistance level. This is shown in Figure 9.25 with the line market horizontal resistance. Once prices move higher, there is always a potential divergence. If the current value of momentum is lower than the value of momentum at the previous price peak, an anticipated divergence sell signal exists. The short sale is now entered as
Momentum and Oscillators
423
prices are rising as long as the current momentum value is below the last peak momentum value. For Amazon.com, that means holding a short position while prices continue higher. The trade is exited if the momentum value continues higher and exceeds the previous peak momentum value, in which case there can be no divergence pattern. This method offers the best opportunity for profiting from the entire downward reversal, but at higher risk. A less risky alternative would be to divide trading capital into three parts, then • Sell the first third when prices make a new high and the MACD value is much lower. • Sell the second part when the MACD value moves to within 15–20% of the previous MACD high. • Sell the third part when the MACD value crosses the signal line heading down. If there is only one choice, it is better to take the second signal. If there are two choices, take the first and second. If you only take the third sell signal, when the MACD crossed the signal line, prices will have already dropped significantly, and you will be disappointed with your entry price and the lack of profit opportunity. Single, Double, and Triple Divergences In fewer cases, double and triple bearish divergences will occur. A double bearish divergence is one in which three momentum peaks are declining with prices rising at each corresponding momentum peak. Most often, the second momentum peak is only slightly lower than the first, and the last peak drops off noticeably, indicating that a drop in price is soon to follow. Multiple divergences are expected to be more reliable than single divergences, and represent a prolonged period in which prices are rising at a slower and slower rate, in the manner of a rounded top. Alternating Divergence Peaks A common bearish pattern is where a lower momentum peak falls between two declining peaks. For example, the first momentum peak is at 90, the next at 60, and the last at 75. When studying the price and momentum charts, most analysts will ignore the lower peak in the middle and consider only the 90–75 divergence. In the following section, this combination can be automated by looking at the most recent momentum peak, i, and the previous two momentum peaks, i − 1 and i − 2, along with their corresponding prices.
Programming Divergence Before explaining the technique used in the divergence program, it should be clear that there is no simple solution. There are many choices to be made in order to recognize a divergence pattern, and it will be difficult to find them all. What we can see on a chart is not always easy to program into a computer. A TradeStation program, TSM Divergence, is available on the Companion Website; it gives the user a number of choices for entries
424
TRADING SYSTEMS AND METHODS
and exit, including multiple divergences, or simply a starting point for writing your own program. The inputs are 1. Diverge
1 = single divergence, 2 = double divergence
2. Swing
the percentage price swing to find price extremes (normally 2% to 5%)
3. Strength
the minimum percentage decline from the indicator high that will trigger a signal (normally 5%)
4. Length
the calculation period for the stochastic (normally 5 to 10)
5. Type
0 for normal prices, 1 to change short rates into yields, and 2 to approximate the yield of a bond.
6. Exit
the percent added or subtracted from 50 for the momentum exit (slowK) K criterion (if exit = 10 then exit at 60, normally 0)
7. FastX X
exit level for fast stochastic (fastK K) (normally 20)
The first decision is whether the pattern keys off the momentum indicator or the price pattern. This program uses the price peaks, which are identified using the swing technique explained in Chapter 5, with the minimum swing value given in the parameter swing. For the momentum indicator, the stochastic is used instead of either a simple momentum or the MACD. Momentum values are then chosen corresponding to those price extremes. The momentum value at the second swing high must be less than the one at the first swing high by the amount specified by the strength h parameter, typically 5 (for a bearish divergence). There is no test to see if momentum dropped further between the two price peaks. All other momentum values are ignored for the purpose of deciding on the entry signal. If the momentum peaks are declining and the price peaks are rising, there is a bearish divergence. If momentum peaks are rising and the price peaks are falling, there is a bullish divergence. By not looking for the momentum peaks, it is possible that some of the patterns may not be timed correctly. A bearish divergence exits when the smoothed fast stochastic (%D % ) reaches 50. If the input parameter exit is set to +10 or –10 the trade exits when the momentum reaches 60 or 40, respectively. Alternatively, if the momentum drops quickly, the parameter FastX will trigger an exit when the raw stochastic, FastK, K touches 20. In addition to the standard single divergence, the program recognizes a double divergence, the combination of three rising price peaks and three declining momentum peaks. It is easier to find divergence by looking at a chart on a quote screen than to program it into a computer. Translating what you see into a systematic analysis of divergence signals is very difficult. You will find that this program does not always find the divergence that seems obvious to the eye. A divergence may be missed when there is a steady rise in prices that do not create swing highs, even though there is a corresponding steady decline in momentum. This situation is addressed using slope divergence.
Slope Divergence One of the problems in using peak prices and peak momentum values is that some of the most obvious divergence situations are missed. Prices can move higher or lower steadily,
Momentum and Oscillators
425
without large swings, while momentum moves the other way. This will happen during a very orderly rounded top or rounded bottom formation. Without peaks that can be identified using a swing analysis, this pattern is missed. An alternative technique is to analyze the slope of both the price movement and the momentum indicator over the same time interval. This can be done using a spreadsheet function, slope, or the program function LinearRegSlope, over a specified time interval. Because momentum is a way of detrending the price series, the period used for the calculation should not be too long; otherwise the slope values of the momentum will tend towards zero. A more interesting but complicated method is to record the point of the last momentum peak, m. As we move forward in time to day t, find the slope of the momentum from m to t and the corresponding slope in the price over the same period. If the slope of the momentum is negative and the slope of the prices is positive, then there is a divergence. As t gets larger, we have more confidence in the divergence. If the slope of the prices on day t is less than the slope on day t−1, but still positive, we have a sell signal. Divergence can be any combination of conflicting directions between the slope of price and the slope of momentum, including prices rising faster than momentum, momentum rising faster than prices, or the opposite. However, classic analysis has focused on momentum as a leading indicator of a change in the price direction, which limits the combinations to: • Prices rising and momentum falling (a bearish divergence). • Prices falling and momentum rising (a bullish divergence). The strength of a bearish divergence, which is helpful when selecting which situations are best for trading, can be determined primarily by the momentum slope, but can also be assessed as the net difference between the rising slope of prices and the falling slope of momentum. When comparing the two slopes, care must be taken because the angle of price movement can be far greater than the angle of momentum movement. Slope Divergence Using Double Smoothing Double smoothing, discussed earlier in this chapter, is a tool that represents the trend of momentum but may not show many momentum peaks; therefore, it becomes an alternate method for slope divergence. In Figure 9.26 there is a long upwards move in the NASDAQ 100 throughout 1999. The price swings are relatively small and may not be picked up using a swing value that worked during prior years. At the same time there is a steady decline in momentum, represented by a double smoothing of 20-20-20 (a 20-day momentum, smoothed twice using 20-day exponentials). Lines are drawn through both prices and momentum to show the slope of the corresponding movement. One way to produce a trading signal for the two slope calculations is to monitor their relative movement. While they remain constant or are moving apart, no action is taken. Once the slope values begin to converge beyond a threshold value representing normal variance, a short sale signal is produced. After that, normal price targets apply. If the price slope continues to decline, the trade should be held. If the momentum slope rises
426
TRADING SYSTEMS AND METHODS
FIGURE 9.26 Slope divergence of NASDAQ 100 using double smoothing.
above its value at the time of the short sale signal, the trade should be exited, or if the slopes begin to diverge significantly, the trade should also be exited.
SOME FINAL COMMENTS ON MOMENTUM Because momentum and oscillators are very different from either a charting technique or moving averages, they have become important in technical analysis. However, when the time interval for calculation is small, these indicators can be highly unstable, jumping from frequent overbought signals to just as frequent oversold ones. All momentum indicators, when used to enter contrary to the direction of price movement, exhibit high risk. Momentum indicators are most often used as a timing tool within another more conservative strategy, such as trend following. The calculation period is then tuned to allow the momentum values to reach extremes with a certain frequency. Momentum values that are not extremes give us very little useful information. Consider a trending strategy where each trade is held for an average of 20 days. A fast oscillator can be created to provide entry timing. If you are willing to wait up to two days to enter a trade after the trend signal has been given, then construct a 10-period oscillator of 1-hour bars, or a 3-period oscillator of daily bars. Test the oscillator to see if it generates at least one, but preferably two, oversold signals during each 2-day period. If so, use it to time your entry and you are likely to be buying dips rather than rallies.
CHAPTER 10
Seasonality and Calendar Patterns
C
hapter 6 introduced prices as a time series and identified its four components as the trend, the seasonal pattern, the cycle, and chance (random) movement; it included various ways of finding the trend using statistical analysis and forecasting techniques. Chapter 7 then showed various ways to calculate trends. Of all techniques, the trend is overwhelmingly the most popular foundation for trading systems. In this and the next chapter, we turn our attention to two other principal components, the seasonal and cyclic movements. Seasonality is a cycle that occurs yearly. It is most often associated with the planting and harvesting of crops, which directly affect the feeding and marketing of livestock. Normally, prices are higher when a product is not as readily available, or when there is a greater demand relative to the supply, as often occurs with food or heating oil during the winter months and electricity during mid-summer. For grain, cotton, coffee, and other agricultural products, the crop year is dominated by planting, harvest, and weather-related events that occur in between. Most abundant crops have been produced in the northern hemisphere, but South American soybeans and orange juice have become a significant factor since the early 1980s, as have Australian and New Zealand beef and lamb, resulting in a structural change in seasonal patterns. Globalization has not only affected financial markets, but nearly everything we purchase. Consumer habits can cause a seasonal pattern in metals and some equity markets as weather does for agricultural products. Passenger airline traffic, along with the travel and hotel industry, is much more active in the summer than in the winter, and profits of those companies that are not diversified reflect that seasonality. Gasoline is in high demand during the summer, when most of the population in the northern hemisphere makes room for each other at the beach. Eastman Kodak once had a classic pattern caused by much more active picture-taking during the summer months, which was also reflected in the price of silver, used to make film. Not anymore.
427
428
TRADING SYSTEMS AND METHODS
Many commodities are priced in U.S. dollars, such as gold, oil, and even metals traded on the London Metals Exchange (LME), but for investors not in the United States, purchasing in their own currency, the fluctuations in foreign exchange rates significantly change the price of the commodity. Looking at it from the view of a U.S. consumer, if the U.S. dollar falls, then American buyers will expect to pay more. Commodities that have worldwide demand maintain a world price, so that everyone essentially pays the same amount, regardless of their currency. When studying seasonality, it is sometimes necessary to separate the underlying price move of the commodity from the move in its denominated currency.
A CONSISTENT FACTOR Even when the impact of seasonality on agricultural products is not clear from the price patterns, it is still there. Consider the following factors that do not change: • More corn, wheat, and soybeans are sold during harvest than at any other time of year because there is not enough available storage to hold all of the new crop. Rental storage, when available, requires a minimum 3-month charge. Lack of storage and the need for immediate income result in greater sales and cause prices to decline. • Because feed grains are harvested only once each year, forward contracts include a storage cost as part of the total carrying charge. Therefore, each forward delivery price should be higher within the same crop year. Sometimes the price pattern of forward months does not seem to reflect the added costs of carry. Occasionally these markets even invert, and the nearest delivery trades at a price higher than the deferred months, a situation familiar in crude oil and copper. The cost of carry, however, still exists in an inverted or backwardation market. Extreme short-term demand pushes the nearest delivery much higher, while the events causing price disruption are expected to be temporary. The normal carry is still there; it is just overwhelmed by temporary demand. Seasonal equity shares reflect the same factors as agricultural products. While holiday travel may vary by 10% in a given year, there is still a strong seasonal pattern in the travel business. The profitability of a company may decline during a poor travel year, sending share prices lower, yet the seasonality is still there. It is important to be able to identify seasonal patterns. Seasonal patterns can bias the size of the positions traded throughout the year, they can identify changes in risk, they can affect the direction of prices, and most important they can be exploited for profit. The methods for finding them are simple, and made more so by the use of a spreadsheet program or statistical software. These will be discussed in this chapter along with some practical applications.
Seasonality and Calendar Patterns
429
THE SEASONAL PATTERN Seasonal patterns are easier to find than the longer-term cycles or economic trends, because they must repeat each calendar year. Although any 12-month period can be used to find the seasonal pattern, academic studies in agriculture usually begin with the new crop year for grains, just following harvest, when prices tend to be lowest. This approach makes the carrying charges, which increase steadily throughout the new crop year, more apparent. For uniformity, the examples in this chapter always begin with a calendar year, which assumes no knowledge of where the season starts, and can be equally applied to stocks. Carrying charges are always reflected in the market price. United States agricultural production is considered to be the standard for “seasonal,” even though a wheat crop is harvested continuously throughout the year in different parts of the world. Prices are expected to be lower during the U.S. harvest and highest during the middle of the growing season. The influence of world stocks and anticipated harvest from other major producers in South America or Russia will cause an overall dampening or inflating of prices, rather than change the seasonal pattern. There is a constant flow of agricultural and industrial products throughout the world. The seller of a product will always choose the highest price as denominated in the local currency, so that a buyer with a weaker currency will appear to pay more than one with a stronger currency. But the seller gets the same price from everyone, net of shipping costs. The fact that any buyer can go to any seller creates the competition that produces a world market price. The interchangability of product is called fungibility. Industrial commodities have seasonal price variation based on demand. Silver and gold, although increasingly used in electronics as high-end conductors, are still mostly consumed for jewelry but during unstable economic times, they serve as a hedge against inflation by the general public. Almost half of all copper is used in electrical and heat conductivity, with much of it in the form of an alloy with nickel and silver. Its seasonality is heavily related to the housing industry, where it is required for both electrical and water systems. New sources of ore are introduced infrequently, and the possibility of discovery or expansion is rarely seen in price movement as short-term anticipation. The primary supply problems in copper are related to labor as well as social and political changes in producing countries. More recently, growth in China and India has spurred a demand for copper. It is said that China has warehoused large quantities of copper in anticipation of future needs. This might distort the seasonal patterns, but they will return to normal as seasonal consumption becomes the driver. There are many businesses with finished products that have seasonal demand, and their publicly traded stock prices will reflect that tendency. Because the shares in a company are far removed from buying and selling the raw materials that they use, changes in the price of raw materials may have a small effect on the bottom line, or the share price. Yet some industries, such as airlines, still show seasonal patterns, and the same procedures given here can be used to find them.
430
TRADING SYSTEMS AND METHODS
POPULAR METHODS FOR CALCULATING SEASONALITY Seasonal patterns are most often calculated using monthly data, although some studies have tried to pinpoint their periodic turns to specific days. As with most other analysis, closer observation and shorter time periods also bring more noise and erratic results. With this in mind, the seasonal studies in this chapter will use monthly data and keep an eye toward the big picture.
An Important Note about the Data There is one important caveat about the futures prices used in some of these examples: They were created using continuous, back-adjusted data. Continuous futures data are much easier to study than many individual delivery months and more accessible than cash data for most traders. Patterns in futures data will be more relevant for trading because it is the same data that is traded. Unfortunately, back-adjusted futures do not give the same results as using cash prices, and it is the cash price pattern that we normally see as the traditional seasonal pattern. This chapter will include comparisons of seasonal patterns using different types of data. To create a continuous data series from individual contract delivery months, it is necessary to close the price gap between the old futures contract and the new one on the day of the roll and then adjust all the data backwards to reflect the value of that closed gap. The continuous data works well for trend analysis, but the oldest data may be much higher or lower than actual prices at that time due to the aggregate effect of adjusting dozens of gaps. In the case of wheat, the price in 1965 was $1.72/bushel using cash data but when backadjusted it is $12.45. In other cases, such as interest rates, prices that have been adjusted back 25 years can actually become negative because the carry is always negative. A traditional seasonal analysis will use cash prices, rather than a constructed series, in order to have valid percentages. When using continuous futures data, results cannot be expressed as percentage changes. Cash prices for the underlying futures contracts are available on downloading services, such as Commodity Systems, Inc. (CSI), Boca Raton, Florida. You should also remember that the price of a stock may have changed due to splits or reverse splits; therefore, the percent values we get for data in 1975 may not have been the same value at the time.
Seasonal Decomposition Before showing the various ways of finding seasonal patterns manually, there are more automated ways of finding many of the same results. Statistical software will have options for seasonal differences and seasonal decomposition. For seasonal differences you are asked to enter the number of days or periods in the season. For monthly data that would be 12 and for daily data, probably 252 (you will want to divide the total number of days in the data by the number of years to get the exact number). The result will be a detrended price series, comparable to what will be done in the next section.
431
Seasonality and Calendar Patterns
Seasonal decomposition is more extensive and essentially separates the main components of a time series, the trend, seasonal, cycle, and noise. It should provide the residuals; that is, the price fluctuations due to seasonality, after the other components have been extracted. In this chapter we will not be as rigorous about these other time series components, but try to be practical about extracting seasonal patterns that can be traded.
Detrending It was already stated that the price trend, or the underlying change in currency, can make it more difficult to recognize the seasonal patterns. As an example, Figure 10.1 shows monthly average cash wheat prices from 1985 through 2010. There are both an upwards trend and an increase in volatility over time. By performing a simple regression analysis using Excel, then creating the regression line based on the slope and y-intercept, it is easy to see the long-term trend of prices, increasing about ½ cent per bushel each month from 1985. By subtracting the regression line values from the actual price we get the residuals, which are the detrended wheat prices also plotted in Figure 10.1. Volatility in 2007 is actually higher in the detrended prices than the cash prices. It would be more accurate to remove the trend from all data before finding the seasonal patterns, but then the trend bias would need to be added back to find the net move for a specific month. Most traders will not want to do that, and in many cases, such as wheat, the underlying trend is a modest 0.42% per year and 51% over 25 years. Because this repeats equally for each month, it will not change the seasonal patterns.
Basic Calculation Components Average Prices Finding the seasonal pattern does not need to be complicated; however, some basic rules must be followed. For most analysts it is easiest to begin with a spreadsheet, where 1000 800 600 400
Wheat
200
Regression
Residuals
–400
12/1/1985 2/1/1987 4/1/1988 6/1/1989 8/1/1990 10/1/1991 12/1/1992 2/1/1994 4/1/1995 6/1/1996 8/1/1997 10/1/1998 12/1/1999 2/1/2001 4/1/2002 6/1/2003 8/1/2004 10/1/2005 12/1/2006 2/1/2008 4/1/2009 6/1/2010
–200
FIGURE 10.1 Detrending monthly cash wheat prices.
432
Jan
Year
1966 1967 1968 1969 1970 … 2007 2008 2009 2010 2011 Average Median Adj Avg Adj Mdn
4.50 9.36 4.33 4.44 8.03 3.526 3.480 0.054 0.044
4.33 8.68 4.60 3.84 8.37 3.553 3.495 0.062 0.048
12.42 11.96 11.58 11.64
7.98 13.68 7.60 6.35 8.20 11.28 11.63 −0.0010 0.0105
12.32 11.96 11.62 11.57
7.97 11.64 8.27 6.33 8.56 11.27 11.62 −0.0016 0.0096
Feb
1.78 1.48 1.32 1.57
Feb
1.61 1.49 1.38 1.48
Jan
1966 1967 1968 1969 1970 … 2007 2008 2009 2010 2011 Average Median Adj Avg Adj Mdn
Year
8.09 11.18 7.54 6.13 11.23 11.46 −0.0054 −0.0040
11.28 11.55 −0.0005 0.0035
12.29 11.80 11.55 11.67
May
3.137 3.245 −0.062 −0.027
4.75 5.62 5.47 4.52
1.72 1.66 1.37 1.28 1.42
Jun
3.117 3.175 −0.068 −0.048
5.34 6.11 4.31 4.77
1.86 1.49 1.26 1.25 1.43
Jul
3.176 3.160 −0.050 −0.052
5.71 5.84 4.15 5.94
1.89 1.52 1.26 1.28 1.46
Jun
9.14 12.04 7.52 5.58
12.63 12.18 11.70 11.51 11.66
11.25 11.25 11.43 11.51 −0.0034 −0.0032 −0.0063 0.0007
8.20 10.54 8.53 5.87
12.45 12.32 11.81 11.54 11.59
May
Aug
10.53 10.80 6.61 7.74
12.66 12.06 11.56 11.50 11.80
Aug
Sep
Sep
12.01 9.37 6.14 7.58
Oct
Oct
11.33 11.40 0.0037 −0.0095
10.81 8.09 6.72 7.92
Nov
Nov
3.548 3.430 0.061 0.029
8.54 4.24 4.13 6.73
1.79 1.44 1.32 1.44 1.74
11.31 11.57 0.0020 0.0053
11.27 8.12 7.19 7.24
12.51 11.99 11.62 11.57 11.88
3.394 3.430 0.015 0.029
7.83 3.58 3.14 7.13
1.72 1.50 1.30 1.36 1.77
12.44 12.07 11.63 11.52 11.90
3.315 3.180 −0.009 −0.046
8.87 4.85 2.62 6.22
1.74 1.53 1.19 1.33 1.70
12.49 12.11 11.52 11.51 11.85
3.219 3.145 −0.037 −0.057
6.84 5.53 2.89 6.18
1.88 1.46 1.19 1.29 1.57
11.26 11.34 11.36 11.30 11.50 11.51 −0.0026 0.0043 0.0060 −0.0182 −0.0002 0.0007
9.29 10.82 7.09 7.28
12.64 12.16 11.64 11.46 11.68
Jul
(b) Back-Adjusted Futures Prices
7.82 13.00 7.49 6.03
12.42 11.94 11.51 11.60
Apr
3.242 3.325 −0.030 −0.003
3.324 3.385 −0.006 0.015
Mar
4.68 6.31 4.63 4.16
1.66 1.36 1.32 1.58
Apr
4.01 7.37 4.66 3.83
1.79 1.49 1.29 1.51
Mar
(a) Cash Prices
TABLE 10.1 Prices of Cash Wheat, 1966–2011, with Monthly Average and Median Values Dec
11.31 11.60 0.0016 0.0079
11.24 8.51 6.90 8.18
12.43 11.97 11.62 11.60 11.83
Dec
3.574 3.565 0.069 0.069
8.05 4.89 4.10 7.81
1.76 1.45 1.39 1.51 1.75
Seasonality and Calendar Patterns
433
the months are recorded in each column and the rows represent years (see Table 10.1). The average monthly price, placed in each cell, can give a good indication of seasonal patterns by simply averaging each column and plotting the results as shown in the four summary lines at the bottom. The major criticism of this technique is that it ignores the changing price levels over time. For example, a 25-year study of soybeans will use prices that vary from $6 to $15 per bushel; price changes at the $15 level, which will be much more volatile, could overwhelm other years. Getting the monthly averages can be time consuming, but with many charting and data services you can convert a daily chart to monthly (showing the last price of the month rather than the average) and then download those prices into an Excel spreadsheet. In the case of TradeStation you can write a program to print the prices shown on a monthly chart into a flat file. Comparing Cash and Futures Seasonal Calculations To show how important it is to use the correct data, the monthly last price of cash and back-adjusted futures for wheat was put into a spreadsheet (the entire spreadsheet is available on the Companion Website as TSM Cash and Futures monthly tables wheat) shown in Table 10.1a and b. In particular, the cash prices progress steadily from lower to higher, while the futures prices begin at higher prices and end at lower prices. There were periods of higher and lower volatility not shown in these tables. At the bottom of each table are the monthly averages and monthly medians. Normally, the median is considered a better gauge of the typical price because it is not affected by one or two extremes, but shows the price that would normally be received. If we average all the average monthly prices, then divide each monthly average by that yearly average, we get the adjusted average that is shown two lines below. The lower two lines show the averages and medians divided by the yearly average (Adj Avg and Adj Mdn). Plotting the ratios for the averages and medians gives a picture of the seasonality in Figures 10.2a and b. While the cash prices show a classic seasonal pattern, the futures do not. Winter wheat, the biggest U.S. crop, is harvested beginning in June and may continue through the summer. Figure 10.2a shows the lowest average prices in May and June, and the lowest median prices in July and August. Both are reasonable. The futures prices show an exaggerated picture, with the median prices spiking down in July but the average prices out-of-phase with what is believed to be the correct seasonal pattern. The conclusion is that futures prices may work for some markets, but cash prices are safer.
A Program to Create a Table of Monthly Price Changes Creating a table of price changes in order to evaluate seasonality is a tedious task. The monthly changes, shown in various tables, were created using three TradeStation programs, TSM Seasonal Average, TSM Seasonal Median, and TSM Seasonal Volatility,
434
TRADING SYSTEMS AND METHODS
0.0800
Percent Variation
0.0600 0.0400 0.0200 Adj Avg
0.0000
Adj Mdn
–0.0200 –0.0400 –0.0600 –0.0800
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec (a)
0.0150
Percent Variation
0.0100 0.0050 0.0000
Adj Avg
–0.0050
Adj Mdn
–0.0100 –0.0150 –0.0200 Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec (b)
FIGURE 10.2 Seasonal patterns resulting from dividing the monthly averages by the average of all months. (a) The results using cash wheat prices. (b) The results using back-adjusted wheat futures.
available on the Companion Website. These programs write flat files in table form with the months along the top and the years along the left. The programs have no inputs. They will automatically run and produce the output table as soon as it is loaded into the chart workspace. Indexing the Data A simple way to adjust for price differences over time is by indexing data, where each new entry is based on a percentage change from the previous value. This method will work well for seasonal studies, but must use unadjusted cash data or stocks. Backadjusted futures cannot be used for this purpose. Begin by giving the first monthly average price, for example, $25, the index value of 100. Each subsequent monthly average
435
Seasonality and Calendar Patterns
price increases or decreases the index by the percentage change. If the second month had an average price of $27, then 100 × 27/25 = 108, an increase of 8%. If the third month showed an average of $26 then the index value becomes 108 × 26/27 = 104. This method can be found in the section “The Index” in Chapter 2. Once the data has been indexed, the average results are interpreted as percentage changes, which should be more useful as prices vary over time. Consider two stocks, Southwest Airlines (LUV) and Amazon (AMZN). We would expect Southwest to have a seasonal pattern because most leisure travel occurs during the summer. Amazon is not as clear. First, the seasonal values are calculated from prices in the same manner as wheat, using data from August 1998 through February 2011. Results are shown in Table 10.2a with the adjusted average along the bottom. The prices are then indexed, starting at 100, and the months averaged in the same way. Figure 10.3 compares the seasonality in terms of price with those in terms of percent. Table 10.2a Southwest Airlines seasonality calculated in dollars ($) in part a and in percent (%) in part b. In Figure 10.3 both seasonal patterns are the same, but the one expressed in dollars ($) appears to have very small fluctuations. Table 10.2a shows that the seasonal range is from about –$0.50 to +$0.50. The percentage chart is much clearer, showing fluctuations of –6% to +6%. Because Southwest remained at about the same price level for the entire period, the chart actually differs only in the scale. Most important, it shows that there is a seasonal peak from April through July (spring through early summer in the United States) and another in November for Thanksgiving holiday. August, September, and January are lows when families get back to work and school and after the major holidays. The same seasonal calculations were done for Amazon, without any expectation of whether there was seasonality. Figure 10.4 shows the results; however, instead of showing the price and percentage fluctuations on the same scale, the percentage change is shown on the left and the price on the right. The charts are nearly identical, but the percentages show variations of –40% to +30% while the prices ranged from –$5.00 to 8.000 6.000 4.000 2.000 Adj Avg %
0.000
Adj Avg $
–2.000 –4.000 –6.000 –8.000
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
FIGURE 10.3 Seasonality of Southwest Airlines in dollars ($) and percent (%).
436 14.01 12.59 19.71 16.80 15.87 15.34 14.41 15.96 14.21 12.98 6.71 12.42
13.60 12.43 18.22 15.94 16.99 16.59 13.80 16.23 14.81 12.97 6.71 11.10
12.13 15.51 19.72 13.62 16.21 14.31 14.05 17.84 15.55 15.50 7.83 12.03
Jul
Aug
7.78 10.94 14.86 17.64 14.02 16.89 14.66 13.20 17.18 15.01 15.15 8.15 11.04
Sep
8.84 9.96 15.92 14.63 12.89 17.49 13.48 14.71 16.53 14.70 14.43 9.58 13.06
9.22 11.02 18.71 15.67 14.41 19.17 15.60 15.86 14.91 14.12 11.72 8.38 13.75
Oct
9.47 10.70 20.72 18.48 16.48 17.77 15.56 16.35 15.58 14.06 8.60 9.18 13.31
Nov
9.91 10.58 22.02 18.22 13.72 15.95 16.11 16.28 15.20 12.12 8.58 11.41 12.97
Dec
Feb
Mar
Apr
May
Jun
(b) In Percent Jul
Aug
Sep
Oct
Nov
Dec
Average 174.56 175.76 182.14 184.83 183.17 181.44 186.70 174.53 174.23 180.48 184.16 181.01 Adj Avg % –5.691 –4.495 1.893 4.582 2.921 1.186 6.445 –5.721 –6.017 0.231 3.909 0.755
145.373 161.311 169.666 169.152 159.640 142.674 154.627 141.902 167.866 176.735 171.080 166.710 152.185 152.057
Jan
Year
14.23 14.23 17.94 17.96 15.76 14.12 14.73 16.08 14.24 13.16 6.95 13.16
Jun
(a) In Dollars May
13.67 14.17 14.38 14.25 14.12 14.53 13.58 13.56 14.04 14.33 14.08 –0.350 0.147 0.356 0.227 0.092 0.501 –0.44 5 –0.46 8 0.018 0.304 0.059
13.22 13.66 17.49 19.08 14.18 14.05 14.10 17.84 14.59 12.33 6.31 13.20
Apr
2010 2011
13.58 –0.443
Average Adj Avg $
13.16 12.09 18.33 20.82 11.92 13.65 13.71 16.63 15.01 12.19 5.87 12.55 11.83
Mar
100 113.625 118.509 121.722 127.378 151.285 169.152 169.923 182.905 180.077 174.807 155.913 140.617 128.021 141.645 137.532 135.990
11.77 10.45 20.57 18.68 12.88 14.78 14.33 16.31 14.98 11.65 7.00 11.31 11.84
1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011
Feb
1998 1999
Jan
Year
TABLE 10.2 Southwest Airlines Seasonality
437
Seasonality and Calendar Patterns
60
8.00
50 Percentage Change
30
4.00
20 10
2.00
0.00
–10
Adj Avg % Adj Avg $
–2.00
–20 –30
–4.00 Nov
Dec
Oct
Aug
Sep
Jul
Jun
May
Apr
Mar
Jan
Feb
–40 –50
Price Change
6.00
40
–6.00
FIGURE 10.4 Amazon seasonality, using both price change and percentage change, August 1998 through February 2011.
+$6.50. During this period, the price of Amazon was as low as $6 and as high as $180. The average price fluctuation will not be a good measure of expectation when prices are at either extreme. Percentages will be better, but not perfect. Other techniques will be considered to see if the pattern changes, rather than the magnitude of the move. The seasonal pattern for Amazon is remarkably clear, with business improving after the summer holidays and spiking ahead of the Christmas. In retrospect, retailers get the bulk of income at Christmas, so this result can be justified. Most important, this clear pattern could help trading decisions. Detrending Amazon Detrending, as seen in the previous section, is theoretically essential to finding a clear seasonal pattern. Although seasonality will always affect prices, a strong trend can overwhelm the seasonal movements and make the patterns invalid. Detrending can be accomplished by using linear regression, moving averages, yearly averages, and first differences, as well as the more complicated techniques off link relatives and X X-11. As an example of the effect of detrending, consider Amazon, which has had a wide price range since 1998. To detrend Amazon, the same steps were used as before: 1. Create a column with the simple numeric sequence, 1, 2, 3, . . . This is needed as the
independent variable, x, in the regression because the date form does not work and the date skips weekends, which would cause incorrect results. 2. Find the slope and y-intercept, using the numeric sequence as x and the prices as y.
Use the regression tool in Excel found in Data Analysis. 3. Create the linear regression line value for each corresponding price, x, using the
formula y = ax+b, where a is the slope, b is the y-intercept.
438
TRADING SYSTEMS AND METHODS
8.000 6.000 4.000 2.000 Detrended
0.000
Not detrended
–2.000 –4.000 –6.000 –8.000
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
FIGURE 10.5 Comparison of seasonal patterns using original Amazon prices and detrended prices.
4. Calculate the residuals by subtracting each value on the regression line (3) from the
corresponding original price. 5. Put the residuals into a table with the year on the left and the months across the top
in order to create the seasonal chart. When the detrended seasonal pattern is compared to the non-detrended pattern, as shown in Figure 10.5, the overall shape is the same. The major differences are that February is now much weaker and November is the high; November and December remain the two strongest months. Although this is only one case, we would conclude that, for finding the overall seasonal pattern for trading, it is not necessary to detrend prices. A trader selecting the strongest six months to bias trades on the long side would get the same results with original or detrended prices.
Removing the Trend with First Differences Jake Bernstein, most well-known for his seasonal studies,1 uses the method of first differences to remove the trend from prices before calculating the seasonal adjustment factor. He offers the following steps for determining the cash price seasonality: 1. Arrange the data used in a table with each row as one year. Columns can be daily,
weekly, or monthly although most analyses will use monthly. Average prices are preferred for each period (see Table 10.2). 2. Compute a second table of month-to-month differences by subtracting month 1 from
month 2, month 2 from month 3, and so on. This new table contains detrended values. The average of these differences should be near zero. 1
Jacob Bernstein, Seasonal Concepts in Futures Trading (New York: John Wiley & Sons, 1986).
Seasonality and Calendar Patterns
439
3. Calculate the sum of the price differences in each column (month) in the new table.
Find the average for that column by dividing the number of years of data (columns may have different numbers of entries). This is the average price change for that month. 4. From the table, count the times during each month (column) that prices were up,
down, or unchanged. This will give the frequency (expressed as a percent) of movement in each direction. Bernstein adds the average monthly changes together, expresses the frequency of upwards price changes, and presents the results of corn in Figure 10.6. Using Bernstein’s method, the seasonal price tendency for corn is shown in Figure 10.6. While Figure 10.6 shows a clear pattern for corn, where monthly price changes fluctuate around the zero horizontal line, the same method would not work well for Amazon. Normally, the method of first differences will remove the trend; however, corn prices remained in a narrow price range for the 20 years while Amazon varied over a very wide range, starting low and ending high. The large changes in more recent years greatly distort the results.
FIGURE 10.6 Seasonal price tendency in monthly cash average corn prices (1936 to 1983).
440
TRADING SYSTEMS AND METHODS
Effects of a Few Volatile Years Seasonal calculations can be distorted by a few very volatile years that show large percentage changes, especially during a time when there is not normally a strong seasonal bias. For example, cotton has recently been the target of severe supply disruptions— flooding in Pakistan, geopolitical events in Egypt, and drought in the United States. The normal seasonal pattern based on the years 1973 through February 2011, shown in Figure 10.7, is similar to other northern hemisphere summer crops, with seasonal lows at harvest, or anticipation of harvest, July through September. If only the past two years are averaged, the pattern is very different, with a price jump of 17% in October and rising prices during what is normally harvest season. This distortion points out that seasonal patterns are formed over many years, and a few nonseasonal events do not affect the long-term pattern—although they could result in large trading losses. It is interesting to note that these nonseasonal extremes are usually in the direction of higher prices. Another way of seeing extremes is to plot the highest and lowest price changes that occur during any month. This also relates to volatility, which is discussed in a later section of this chapter. Although seasonal lows are in July, August, and September, the maximum monthly move was 45% in September, as seen in Figure 10.8, with the second largest move in August. The largest downside move of about 22% was in October. The upward surprises are much larger than the downward ones. If the monthly percentage changes are each sorted highest to lowest over all years, the extent of the extremes can be seen in Figure 10.9. Although it is difficult to distinguish one month from another, the largest upside move was 45% in September, followed by 40% in August and nearly 30% in June. On the downside, July, September, and October all compete with each other at about –20%. Harvest seems to be the time for the largest moves, regardless of direction. Complete seasonal tables in prices and
Cotton Seasonal Average 20%
4.0% 3.0% 2.5%
10%
2.0% 1.5% 1.0%
5%
0.5% 0.0%
0%
–0.5%
–5%
–1.0% –1.5%
1
2
3
4
5
6
7
8
9
10 11 12
Years 1973–2011
Years 2009–2011
3.5% 15%
2009–Feb 2011 1973–2011
FIGURE 10.7 Cotton seasonal pattern from monthly averages, 1973 to 2011.
441
Volatility (percentage change in price)
Seasonality and Calendar Patterns
50.00% 40.00% 30.00% 20.00%
1973–2011
10.00%
Max
0.00%
Min
–10.00% –20.00% –30.00%
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
FIGURE 10.8 Monthly extreme moves in cotton, 1973 to February 2011.
percentages are available on the Companion Website as Cotton Extreme Years and Heating Oil Extreme Years.
Method of Yearly Averages Although a number of different methods have been used to show the seasonal patterns, all of them have problems when prices have wide ranges or have been inflated. Expressing prices as percentages tends to reduce some of the issues, but changes at higher price levels still seem to overwhelm those at lower levels. Analysts have been trying to correct this problem for years. An alternative way of expressing percentages, and one that could be used with backadjusted futures, is to express each year’s variation as it relates to the annual average.
50%
Jan
40%
Feb Mar
30%
Apr
20%
May Jun
10%
Jul
0%
Aug
–10%
Sep
–20%
Oct
–30%
Nov 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37
Dec
FIGURE 10.9 Cotton percentage monthly changes, sort highest to lowest.
442
Jan
0.022 0.115 0.029 –0.063
Year
1966 1967 1968 1969 1970
TABLE 10.3b
179.25 148.50 128.75 150.50
166.00 135.50 132.25 158.00
Jul
189.25 151.75 125.50 127.75 146.25
Aug
188.00 146.25 118.50 129.25 156.50
Sep
173.75 153.00 119.25 132.75 169.75
Oct
172.00 149.50 129.75 136.25 176.50
0.132 0.102 –0.012 –0.009
Feb
0.138 0.110 –0.037 –0.047
Mar
0.054 0.012 –0.011 0.000
Apr
–0.041 0.056 0.022 –0.041 –0.103
May
0.034 –0.052 –0.062 –0.067 –0.095
Jun
0.055 –0.036 –0.062 –0.044 –0.074
Jul
0.048 –0.071 –0.115 –0.033 –0.009
Aug
–0.032 –0.028 –0.109 –0.007 0.075
Sep
Monthly Percentage Changes Based on the Yearly Averages of the Same Year
178.25 147.50 132.00 156.50
185.50 149.25 125.50 124.75 143.00
Jun
161.00 149.25 137.50 148.00
172.00 166.25 136.75 128.25 141.75
May
1966 1967 1968 1969 1970
Apr
Feb
Jan
Year
Mar
Original Cash Wheat Data with Yearly Averages
TABLE 10.3a Nov
–0.041 –0.051 –0.031 0.019 0.117
Oct
179.00 144.25 131.50 144.00 174.25
Dec
–0.002 –0.084 –0.017 0.077 0.103
Nov
176.00 145.00 138.50 150.50 174.50
–0.019 –0.079 0.035 0.126 0.105
Dec
179.44 157.48 133.83 133.67 157.96
Average
443
Seasonality and Calendar Patterns
For agricultural products, using the crop year is better than the calendar year, but in the end the results should be the same. In order to compare methods, the same wheat data was used as in Table 10.1. The first few years of the original data and the yearly averages are shown in Table 10.3a. The percentage changes for each month are calculated using the average of the same year, change = month/average – 1, and shown in Table 10.3b. The same process as before is followed to create the seasonal patterns. Each month is averaged down, then divided by the average of all months in order to see the results as variation around zero. Figure 10.10 shows that the pattern based on monthly averages is nearly identical to the first method of finding seasonality, but the median shows lows in May and June rather than August and September, a somewhat more consistent result. A general formula for the monthly average is:2 ⎧⎪ ⎡ N ⎛ 12 ⎞⎤⎫⎪ 1 APP PPi = 100 ⎨ ⎢12∑ ⎜ Pin / ∑ Pjn ⎥⎬ , i = 1,12 ⎪⎩ N ⎣ n=1 ⎝ ⎠⎦⎪⎭ j =1 Where
APPi = the Average Percentage Price in month i i = the calendar month from 1 to 12 N = the number of years in the analysis Pjn = the average price for month j of year n
This formula may be applied to weekly or quarterly average prices by changing the 12 to 52 or 4, respectively.
0.04 0.03 0.02 0.01
Average Average × 2
0 1
2
3
4
5
6
7
8
9
10
11
12
–0.01 –0.02 –0.03
FIGURE 10.10 Season pattern of wheat using the method of yearly averages.
2
David Handmaker, “Low-Frequency Filters for Seasonal Analysis,” in Perry J. Kaufman, Handbook of Futures Markets (New York: John Wiley & Sons, 1984).
444
TRADING SYSTEMS AND METHODS
The use of an annual average price still does not account for a long-term trend in the price of the stock or futures market. If the rate of inflation in the United States is 6%, there will be a tendency for a commodity price, such as gold, to be 0.5% higher each month, resulting in a trend toward higher prices at the end of the year. Longer trends, such as the steady rise in grain prices from 1972 to 1975 and from 2008 to 2011, alternating with even longer declines, can obscure or even distort the seasonality unless the trend is removed. Seasonality is still a major factor influencing price variation, even when there is a dominant trend.
The Method of Link Relatives Another technique for identifying seasonal price variations and separating them from other price components involves the use of link relatives. Table 10.4 shows the following steps for the first few years of wheat cash prices, 1966–1968, although the average and other calculations include the years 1966–2010. The full spreadsheet, along with all calculations, is available on the Companion Website as TSM Wheat method of yearly averages and link relatives. 1. Each month is expressed as a ratio by dividing each monthly price by the preceding
one. December 1966 is used to find the ratio for January 1967, but then we ignore the 1966 data and begin in 1967 in order to have only those years with data in every month. 2. Find the average of the monthly ratios for all years. Put that value in the right col-
umn. 3. Find the average (or the median, which is preferred if an adequate sample is used)
of the monthly ratios expressed in rows 1, 2, and 3. The average in row 4 represents monthly variation as a percentage of change. Thus far, this is the same as Bernstein’s average monthly price changes, expressed as a percent of the prior price. 4. In order to establish a fixed base in the manner of an index, chain relatives (see Ta-
ble 10.4b) are constructed always using January as 1.00; each monthly chain relative is calculated by multiplying its average link relative by the average link relative of the preceding month. In row 2 of part b, the March 1967 chain relative is then 1.107 (the February 1967 chain relative) × 1.006 (the March 1967 link relative) = 1.113 (the March 1967 chain relative). 5. A constant trend throughout the test period can be found by multiplying the De-
cember 1968 chain relative (part c) by the January 1967 link relative (part b) giving 0.928 × 0.915 = 0.849. If prices show no tendency for either upward or downward movement, the result would be 1.00 (the right column); however, long-term inflation should cause an upward bias and therefore the results are expected to be higher. This leaves a negative factor of 15.1% unaccounted for, indicating that the 1967–1968 years showed a strong downward bias; therefore, the expected rate of inflation was offset by some other economic factor, such as the accumulation of grain stocks by the U.S. government or a much better than expected crop. 444
445
149.25
1968
0.990
0.993
1968
Average
Median
Feb
Mar
Apr
May
0.968
0.980
1.009
1.002
Jun
0.983
0.989
0.918
0.898
Jul
1.008
1.018
1.000
1.017
1.013
1.013
0.944 1.024
1.027
1.006
1.046
Sep
118.50
0.964
Aug
125.50
146.25
188.00
Aug
0.986
1.104 0.988
Mar
99.497
1.023 0.909
May
0.918 0.834
Jun
0.933 0.834
Jul
0.899 0.787
Aug
(d) Corrected Chain Relatives
0.966
0.949
0.935
0.953
0.975
1.007
0.941 0.792
Sep
1.041
0.919 0.862
Oct
1.086
0.886 0.874
Nov
1.098
0.891 0.921
Dec
91.625 84.087 84.087 79.397 79.899 86.935 88.107 92.797
(e) Index of Seasonal Variation
1.022 0.901
Apr
90.787
0.969 0.890
Average
1.000
Growth
1.004
Dec
1.098 0.981
Nov
1.000 1.000
Oct
1967 1968
Sep
Feb
Aug
0.997
0.986
Average
138.50
145.00
176.00
Dec
Jan
Jul
1.013
1.010
1.053
1.005
Dec
131.50
144.25
179.00
Nov
Year
Jun
1.036
1.047
1.013
0.965
Nov
129.75
149.50
172.00
Oct
–0.009
May
1.048
1.040
1.088
0.977
Oct
119.25
153.00
173.75
Sep
–0.006
Apr
(c) Chain Relatives (only years with all data)
0.987
0.980
0.912
0.926
125.50
151.75
189.25
Jul
(b) Link Relatives
136.75
149.25
185.50
172.00 166.25
Jun
(a) Original Price Data May
98.827
Mar
0.981
0.990
1.007
1.006
135.50
166.00
Apr
1968 100.000
Feb
0.987
0.993
0.988
1.107
148.50
179.25
Mar
1967 100.000 110.714 111.335 103.106 103.261 92.702 94.255 90.839 95.031 92.857 89.596 90.062
Jan
1.029
1967
Year
Jan
0.915
Year
147.50
178.25
161.00
1967
1966
Feb
Jan
Year
TABLE 10.4 Wheat Prices Expressed as Link Relatives
446
TRADING SYSTEMS AND METHODS
6. The chain relatives must be corrected (part d) by adding the negative bias back into
the values, using the same technique as in computing compound interest. For example, from 1967 to 1977, the Consumer Price Index increased from 100 to 175, a total of 75% in 10 years. To calculate the annual compounded growth rate for that period, apply the formula: Compound rate of growth = N
Ending value −1 Starting value
where N = the number of years or the number of periods over which the growth is compounded 175 R = 10 −1 100 = 1.05755 = 0.05755 This indicates a compounded rate of inflation equal to 5.75% per year. In the case of wheat, if the trend had been positive, that is, greater than 1.00 instead of 0.990, the growth rate would be subtracted from each month to offset the upward bias. In this case, the results are added back into the chain relative to compensate for the negative influence. A 0.1% decline, compounded over 12 consecutive entries, gives: 99 −1 1.00 = 0.99916 − 1
R = 12
= −0.00084 7. This is a compounded deflation of about 8/100 of 1%. To apply this to wheat, calcu-
late the compounded rate of change for the net trend change each year. In 1968, the trend bias of 0.919 becomes a compounded growth rate of –0.0070. The growth rate for each year is added to each monthly chain relative of that year to get the corrected chain relative. For example, growth rate of –0.007 for 1968 is added to the February chain relative, 0.988, to give 0.981. 8. The chain relatives have been calculated on a base of January, which was important
in order to correct the compounded bias throughout the test period. The final step is to switch the corrected chain relatives to a base of the average value. Using the corrected chain relatives, find the average of each month and then calculate the average of all the months. Divide the monthly averages by the yearly average to normalize the results. The final result is the Index of Seasonal Variation, shown in part e. Figure 10.11 shows the monthly averages during the four main steps needed to create the index. The final index is very smooth and has its seasonal lows at harvest. A complete study of seasonality using this method can be found in Courtney Smith, Seasonal Charts for Futures Traders.
447
Method of Link Relatives 1.130 1.080 1.030
(4) Index (3) Corr Chain rel
1.0 0.930
(2) Chain rel (1) Link rel
0.880
Ja n Fe b M ar Ap r M ay Ju n Ju l Au g Se p O ct N ov D ec
Seasonal Variation (adjusted percent)
Seasonality and Calendar Patterns
FIGURE 10.11 The four steps in creating link relatives.
The Moving Average Method The moving average is a much simpler yet very good technique for determining seasonal patterns and removing the trend. Using monthly cash wheat prices, calculate as follows: 1. Take the average of the first 12 monthly prices, May 1966 through April 1967. Quar-
terly prices can also be used but not as desirable. 2. Place the average (1) in the sixth row of column 3, which is the same as lagging the
average by 6 months. 3. In column 4 take the average of the sixth and seventh rows because a calendar year
has an even number of months; therefore, the midpoint will be the average of month 6 and month 7. 4. Get the seasonal adjustment factorr by subtracting the midpoint values (3) from the
corresponding average price. 5. The seasonal index x = 1 + seasonal adjustment factor/100.
These calculations can be seen in Table 10.5 and the midpoint plotted along with wheat prices from 2005 through 2010 in Figure 10.12. The midpoint shows the expected wheat price given seasonality, so that the difference between the actual wheat price and the midpoint is abnormal price movement. The seasonal index is used to construct the familiar seasonal chart. By averaging all of the January seasonal index values, then all of the February, and so on, we can plot the seasonal pattern in Figure 10.13. The results are very smooth, easy to calculate, and are equally as good as the best results from any of the other methods.
X-11 and X-12 ARIMA Methods The seasonal adjustment method X-11 (Census Method II-X-11) has been most widely used for creating a seasonally adjusted series of such information as car and housing
448
TRADING SYSTEMS AND METHODS
TABLE 10.5 Calculations for the Moving Average Method.
Date
12-Month Seasonal Moving Adjustment Seasonal Price Average, Lag 6 Midpoint Factor Index
5/31/1966 6/30/1966 7/29/1966 8/31/1966 9/30/1966 10/31/1966 11/30/1966 12/30/1966 1/31/1967 2/28/1967
172.0 185.5 189.3 188.0 173.8 172.0 179.0 176.0 161.0 178.3
176.67 176.19 173.17 170.04 166.56
−0.93 2.82 −3.10 1.32
176.43 174.68 171.60 168.30
0.991 1.028 0.969 1.013
Wheat Price (cents/bushel)
1000 900 800 700 600 500
Wheat
400
Seasonal mid-point
300 200 100 1/1/2005 5/1/2005 9/1/2005 1/1/2006 5/1/2006 9/1/2006 1/1/2007 5/1/2007 9/1/2007 1/1/2008 5/1/2008 9/1/2008 1/1/2009 5/1/2009 9/1/2009 1/1/2010 5/1/2010 9/1/2010
FIGURE 10.12 Wheat seasonal midpoint using the moving average method, 2005–2010. 1.300 1.200 1.100 1.000 0.900 0.800 0.700 Jan
Feb Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
FIGURE 10.13 Averaging all of the monthly seasonal index values gives a standard seasonal pattern for wheat.
Seasonality and Calendar Patterns
449
sales, as well as other consumer products. It is very thorough, using moving averages to detrend the data, and includes both an initial estimation and reestimation. X-12-ARIMA3 is used to adjust the CPI and includes both X-11 estimations and a regression ARIMA calculation (see Chapter 6) for determining intervention and data extension. Because it is widely used by economists, an outline of the X-11 calculations follow.4 1. Calculate a centered 12-month moving average (MA). Subtract this MA from the
original series to get an initial detrended seasonal series in the same manner as the moving average method. 2. Apply a weighted 5-period MA to each month separately to get an estimate of the
seasonal factors. 3. Compute a centered 12-month MA of the seasonal factors (Step 2) for the entire series.
Fill in the six missing values at either end by repeating the first and last available MA values. Adjust the seasonal factors from Step 2 by subtracting the centered 12-term MA. The adjusted seasonal factors will total approximately zero over any 12-month period. 4. Subtract the seasonal factor estimates (Step 3) from the initial detrended seasonal
series (Step 1). This is the irregular component series used for outlier adjustment. 5. Adjust the outliers in Step 4 by the following procedure: a. Compute a 5-year moving standard deviation s of the irregular component series
(Step 4). b. Assign weights to the series components ci as follows:
0 if ci > 2.5s linearly scaled from 0 to 1 if 2.5s ≥ ci ≥ 1.5s 1 if c < 1.5s Use this weighting function to adjust the detrended series in Step 1. 6. Apply a weighted 7-period MA to the adjusted series (Step 5) to get the preliminary seasonal factor. 7. Repeat Step 3 to standardize the seasonal factors. 8. Subtract the series resulting in Step 7 from the original series to find the preliminary
seasonally adjusted series. 9. To get the trend estimate, apply a 9-, 13-, or 23-period Henderson’s weighted mov-
ing average5 to the seasonally adjusted series (Step 8). Subtract this series from the original data to find a second estimate of the detrended series. 3 The
U.S. Government provides details of its methods on the Bureau of Labor Statistics website. Scan the Internet for “X-11” or “X-12.” 4 A more detailed account of X-11 and Henderson’s weighted moving average (Step 9) can be found in Abraham, Bovas, and Johannes Ledolter, Statistical Methods for Forecasting (New York: John Wiley & Sons, 1983),178–191. Their book also includes a computer program for “seasonal exponential smoothing.” 5 A specialized symmetric assignment of weighting values. A specific example can be found in Abraham, Bovas, and Johannes Ledolter, Statistical Methods for Forecasting (New York: John Wiley & Sons, 1983), 178.
450
TRADING SYSTEMS AND METHODS
10. Apply a weighted 7-period MA to each month separately to get a second estimate of
the seasonal component. 11. Repeat Step 3 to standardize the seasonal factors. 12. Subtract the final seasonal factors from the original series to get the final seasonally
adjusted series.
X-12-ARIMA The Bureau of Labor Statistics uses intervention analysis in the seasonal adjustment of consumer price indexes to provide more accurate CPI data. This process offsets the effects that extreme price volatility would otherwise have on the estimates of seasonally adjusted data. It states,6 Intervention analysis is the prior adjustment of an index series before the calculation of the seasonal factors. Prior adjustment may be called for if a “ramp” occurs. (A “ramp” occurs where a good or service undergoes a unique, large, and rapid change in price level.) An example would be a large decrease in the price of gasoline due to the breakdown of an oil cartel. Removal of the ramp gives a clearer seasonal pattern and lessens the irregular component. It must be said that the BLS statement references a large drop in oil prices; however, it is of greater interest to them to reduce the impact of a large increase. Although they argue that oil prices are embedded in all other consumer prices, therefore, using them explicitly in an inflation calculation (such as the CPI) would be counting them twice, it is in the interest of the U.S. Government to show only small increases in the CPI. By law, the government must give cost-of-living increases to all Social Security beneficiaries based on the annual change in the CPI. A large upward revision would be very costly. Intervention analysis, although automated, provides a way to delay the effects of large shifts in prices, whether event-driven or a structural change in the seasonality. Because of this inherent conflict of interest, it becomes questionable whether the CPI is a good choice for deflating commodity prices. In keeping with the ARIMA concept, each year the seasonal adjustment factors are recalculated using the most recent five to eight calendar years. These values are then used for the next year’s seasonal adjustment indexes and the most recent five years of adjustment factors are published. As part of the process, it states, Most higher level index series are adjusted by the indirect, or aggregative, method, which is more appropriate for broad categories whose component indexes show strongly different seasonal patterns. Under the aggregative method, direct
6
BLS Handbook of Methods Bulletin 2490 (April 1997), Chapter 17, “The Consumer Price Index: Estimation of Price Change,” 192.
451
Seasonality and Calendar Patterns
adjustment is first applied to indexes at lower levels of detail, and thereafter the adjusted detail is aggregated up to yield the higher level seasonally adjusted indexes. If intervention analysis is indicated, it will be used in adjusting selected lower level indexes prior to aggregation. For those series which have not been selected for seasonal adjustment, the original, unadjusted data are used in the aggregation process.
Winter’s Method Another technique for forecasting prices with a seasonal component is Winter’s method,7 a self-generating, heuristic approach. It assumes that the only relevant characteristics of price movement are the trend and seasonal components, which are represented by the formula Xt = (a + bt) × St + et where
Xt = the estimated value at time t (a + bt) = a straight line that represents the trend St = the seasonal weighting factor between 0 and 1 et = the error in the estimate at each point
If each season is represented by n data points, St repeats every n entries, and n
∑S
t
=1
t=1
The unique feature of Winter’s model is that each new observation is used to correct the previous components a, b, and St. Without that feature, it would have no applicability to price forecasting of housing starts, employment, or other seasonal data. Starting with two or three years of price data, the yearly (seasonal) price average (for example, a 12-point average for monthly data) can be used to calculate both values a and b of the linear trend. Each subsequent year can be used to correct the equation a + bt using any regression analysis. Winter’s method actually uses a technique similar to exponential smoothing to estimate the next a and b components individually. The seasonal adjustment factors are assigned by calculating the average variance from the linear component, expressed as a ratio, at each data point. As more observations are made, each component can be refined, and it will take on the form of the general long-term seasonal pattern.
7 Winter’s method, as well as other advanced models, can be found in Douglas C. Montgomery and Lynwood A. Johnson, Forecasting and Time Series (New York: McGraw-Hill, 1976), and Abraham and Ledolter, Statistical Methods for Forecasting (New York: John Wiley & Sons, 1983).
452
TRADING SYSTEMS AND METHODS
Changes in Seasonal Patterns Very little remains the same over time. While the United States has improved its production methods and has always been a major exporter of wheat and other grains, the rest of the world improves as well. Wheat is grown in many countries and, along with soybeans and rice, is one of the important food staples. And while Russia has always been a big producer of wheat, South America has made the biggest steps forward. In 1966 the world wheat production was about 300 million metric tons, of which the United States produced 35 million, China 25 million, and Argentina 6 million. In 2003 the world production was 552 million (up 84%), with the United States at 63 million (up 80%), China 86 million (up 244%), and Argentina at 13.5 million (up 125%). The estimated world production for the 2010–2011 crop year is only 351 million MT due to severe weather problems in many countries. China is in the northern hemisphere; therefore, it has essentially the same crop-year as the United States and Russia. However, increased production in Argentina, Brazil, and Chile would affect our seasonal patterns. Countries needing wheat will purchase from any exporting country at the best available price. That makes wheat a fungible commodity. If the United States is in short supply of wheat, or asks too much because of inflation, then buyers go elsewhere, driving down the price of United States wheat until it reaches the world market value. It may be too difficult to forecast how the seasonal pattern for wheat would change based on the production of other countries and the change in value of the U.S. dollar, but we can show how patterns have changed using historic prices. Figure 10.14 shows the seasonal pattern using monthly average prices (the first method discussed) for all years 1966–2010. The low price is clearly in June, with May the second-lowest price. If we look only at 1966, the low was in May; otherwise, the pattern is similar. More recently, 2001–2010, there is a shift backwards, showing the low in April with the second-lowest
Percentage Seasonal Variation
15.0% 10.0% 5.0% Original 0.0%
1966–1980 2001–2010
–5.0% –10.0% –15.0%
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
FIGURE 10.14 Changes in seasonal patterns for wheat.
453
Seasonality and Calendar Patterns
month in March, and a somewhat more irregular pattern. These changes could be structural, based on changing supply and demand demographics, or they might be temporary due to the recent sharp drop in world production. Because this book is not intended to forecast fundamentals, it is only important that the seasonal pattern can change, and that trading systems that rely on seasonality should have a broader window when it comes to anticipating lower seasonal prices.
Seasonal Volatility Consistent seasonal patterns can be confirmed by a corresponding increase in volatility as the season reaches its peak as seen in Figure 10.15, which shows heating oil from 1984 to 2010. Volatility was calculated first by finding the monthly percentage changes in price, then by averaging each month and finding the maximum and minimum volatility in that month. Based only on volatility, April, May, and June are the seasonal lows. This corresponds to the end of the winter heating season and the refining shift from heating oil to gasoline. During the summer months, there is a slow increase in inventories, but winter is the season of both high demand and high uncertainty. Unexpected cold spells, without considering geopolitical events, will draw down inventories and make heating oil prices more volatile. Volatility tells us that December and January are the key seasonal months for heating oil. This can be important information for trading and may result in 1. Taking only long trades during the winter months 2. Reducing position size during the winter to offset the increase in risk 3. Reducing position size in May and June due to lower activity 4. Buying volatility using options.
Volatility (% change in price)
100.0% 80.0% 60.0% 40.0%
Average
20.0%
Max
0.0%
Min
–20.0% –40.0% –60.0%
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
FIGURE 10.15 Heating oil monthly average volatility, 1984 to 2010, as a percentage of price.
454
TRADING SYSTEMS AND METHODS
For the purpose of confirming the validity of the seasonal results, the steady increase and decrease in volatility surrounding the peak month of June indicates a building of the seasonal concerns that cause wide fluctuations. If a single price shock had occurred unrelated to seasonality, there would be a sharp increase in volatility during one month, perhaps declining afterwards, but with no steady growth of volatility leading up to this event.
Weather Sensitivity The effects of changes in weather, especially extremes in weather, are an inseparable part of the agricultural market’s seasonal effects. Without weather, the price of an agricultural commodity would lack the surprises that cause them to jump around during the growing period. Once planted, you would have a very good idea of the expected supply. For insurance companies, hurricane season (from mid-summer through October) contains the same uncertainty. Each agricultural product, and those firms impacted by changing agricultural prices, has its own particular sensitivity to weather. Grain planting can be delayed due to rain, causing some farmers to switch from corn to soybeans; hot weather during pollination will significantly reduce yields; a freeze in September can stop the ripening process and damage production for orange juice. Freezes are of greater concern than droughts and affect more products. Patterns of crop sensitivity to weather depend upon their location in the northern or southern hemisphere; however, active trade between world markets show that crops grown primarily in the northern hemisphere are affected by weather developments in the southern hemisphere. In Table 10.6 major weather events are TABLE 10.6 Weather-Related Events in Southern and Northern Hemispheres Southern Hemisphere
January February
Northern Hemisphere
OJ peak for Florida freeze, heating oil (cold or hot) Corn pollination in S. Africa and Argentina, soybean pod development
Heating oil (cold or hot)
March April
Corn, cotton planting
May
Soybean planting
June July
Cotton boll development Coffee freeze Brazil, OJ freeze Brazil, Cocoa pod development in W. Africa, and pod rot in Brazil
Sugar: heat in Russia, corn pollination
August
Soybean pod development
September
Atlantic hurricanes affect sugar, orange juice, heating oil; corn freeze
October
Soybean freeze, cotton harvest
November December
Brazil coffee rainy season
Soybean harvest corn harvest Heating oil (cold or hot)
455
Seasonality and Calendar Patterns
U.S. pod development
U.S. pollination
(Very high)
S. African, Argentine pollination S. Hem. pod development
U.S. freeze season
U.S. harvest
(Very low)
Sensitivity
U.S. planting
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
Jan
FIGURE 10.16 Weather sensitivity for soybeans and corn. Source:: Smith Barney.
separated into southern and northern hemisphere. Figure 10.16 combines the soybean and corn weather sensitivity charts8 to show the effects of both southern and northern hemisphere weather.
Measuring Weather Sensitivity While a weather sensitivity chart, such as the one shown in Figure 10.16, may appear to have a strong similarity to a standard seasonal chart, they are actually very different. Weather sensitivity is a measurement of potential price volatility. It could simply be the highest price that the market reached during a period in which the weather event occurred. Those more adept at statistics would want to record the increase in price relative to the average during those months in which weather was a factor and then show the price representing the 95% confidence level, about two standard deviations. A thorough approach to measuring weather sensitivity is to record the temperature each day and find out whether it is unusually far above or below the average. Information available from the NOAA (National Oceanic and Atmospheric Administration) will give you both regional weather and measurements of effective heat, in thermals. It is the cumulative effect of heat that is damaging to a crop, rather than a high temperature for one 8
Jon Davis, “Weather Sensitivity in the Markets” (Smith Barney, October 1994).
456
TRADING SYSTEMS AND METHODS
day. In addition, the amount of crop damage is not simply a linear relationship with rising temperatures but is more likely to start slowly and increase quickly once critical levels of time and heat are reached. The same is true of a drought. Advancements in hybrid seed production have made corn and other grains drought resistant. They can withstand long periods of dry weather. Many analysts have been unpleasantly surprised by recommending a long position in corn only to find that, even with low levels of rain, the harvest was a record crop. Measuring the variations in temperature and its effect on crop output and price is done using Heating Degree Days (HDD) and Cooling Degree Days (CDD), where HDDt = max(0,65°F – Average temperaturet) CDDt = max(0, Average temperaturet – 65°F) The daily values are then accumulated during specific critical months. For example, heating oil would be December, January, and February, a total of 90 calendar days, where t is the number of days from December 1 but no greater than 90, t
Cum H HDD Dt = ∑H HDD DDi i=1
The demand for heating oil can be closely estimated by recording the temperature relative to population, so that a widespread hailstorm in August does not have the same impact in Montana as it does in Ohio. This has an immediate effect on futures prices, and a ripple effect on related businesses. During sustained cold periods, increased production of heating oil will mean decreased production of gasoline, driving those prices higher. The Chicago Mercantile Exchange (CME) has made using heating degree days and cooling degree days easier by initiating futures contracts called U.S. Monthly Weather Cooling Degree Day futures, and the equivalent for heating degree days. In addition, there is a Seasonal Strip Cooling Degree Day futures contract (and heating degree days), which accumulates the next n delivery months of individual cooling degree day futures.
SEASONAL FILTERS Seasonal filters identify periods during the year in which a long or short position would be favored based upon a clear seasonal pattern. These periods should be chosen from the results using detrended data and median values; however, we have seen that most of the methods for finding the seasonal patterns give similar results. One method might show a low in corn in September and another in October, but September and October will be the two lowest months. The seasonality, and risk, can also be confirmed by creating a seasonal volatility chart. All of these values can be seen in heating oil, Table 10.7, using the percentage monthly price changes. The median values are lower than the averages for May through September and December and January, indicating that there are many months in which extreme prices distort the averages.
457
0.060 –0.061 –0.137 –0.060 0.010 –0.041 –0.050 –0.036 0.047 –0.002 –0.005 0.210 –0.206 –0.125 0.010 –0.270 –0.063 0.090 0.206 –0.002 0.042 –0.062 0.086 0.117 –0.094 0.031 0.089
46.2% 0.9% –0.2% 46.2% –27.0%
–0.001 –0.265 0.091 –0.049 0.000 –0.431 –0.101 0.140 –0.001 0.183 –0.068 –0.143 0.006 –0.005 –0.008 0.581 –0.112 –0.103 0.141 0.027 0.148 0.055 0.019 –0.033 0.113 –0.092 0.084
% Up mos 50.0% Average 2.4% Median –0.1% Max 58.1% Min –43.1%
Feb
Jan
1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011
72.0% 5.2% 4.9% 72.0% –29.4%
0.101 –0.170 0.097 0.064 0.046 0.013 –0.153 0.052 –0.059 –0.083 0.007 0.062 –0.003 0.032 0.354 –0.093 0.056 0.206 –0.294 –0.038 0.105 0.121 0.054 0.107 0.032 0.075
Mar
56.0% 2.8% 0.3% 56.0% –8.0%
–0.080 –0.011 0.010 0.102 –0.047 –0.036 –0.043 0.071 0.001 –0.025 0.071 –0.018 0.076 –0.034 0.004 0.102 –0.035 0.038 –0.056 0.039 –0.074 0.051 0.021 0.031 –0.014 0.055
Apr
34.6% –1.3% –4.8% 34.6% –17.1%
–0.033 –0.079 –0.048 0.067 –0.074 –0.051 –0.095 0.028 0.048 –0.024 0.018 –0.048 –0.171 –0.072 –0.101 –0.106 –0.059 0.021 –0.100 –0.056 0.049 –0.030 0.002 –0.018 0.136 0.208 –0.108
May
46.2% 2.0% –0.8% 46.2% –16.8%
–0.046 –0.022 –0.140 0.031 –0.168 –0.029 –0.049 –0.043 0.032 –0.036 0.027 –0.030 –0.008 –0.049 –0.001 0.143 0.131 –0.100 0.080 0.019 –0.026 0.103 –0.020 0.140 0.058 0.096 0.005
Jun
65.4% 3.6% 0.6% 65.4% –11.5%
–0.006 0.000 –0.093 0.014 0.066 –0.022 0.154 0.083 –0.022 –0.040 0.031 0.020 0.034 0.046 –0.088 0.148 –0.115 0.004 0.019 0.046 0.185 0.021 –0.010 –0.038 –0.102 0.004 0.006
Jul
65.4% 7.9% 3.2% 65.4% –9.5%
0.013 0.086 0.221 –0.064 –0.034 0.091 0.316 0.067 –0.017 0.064 –0.050 0.032 0.149 –0.072 –0.003 0.086 0.293 0.125 0.088 0.009 –0.021 0.261 –0.009 –0.020 –0.095 0.054 0.000
Aug
73.1% 6.5% 5.2% 73.1% –17.9%
0.052 0.073 –0.030 0.054 –0.090 0.115 0.392 0.006 0.057 0.032 0.001 0.002 0.124 0.126 0.186 0.086 –0.044 –0.179 0.067 –0.060 0.234 0.025 –0.122 0.109 –0.136 –0.087 0.082
Sep
42.3% –1.6% –2.0% 21.3% –27.7%
–0.080 0.069 –0.043 0.068 0.117 –0.020 –0.125 0.069 –0.060 –0.058 0.004 0.023 –0.045 –0.007 –0.042 –0.073 0.004 –0.050 –0.106 0.021 0.084 –0.142 –0.061 0.072 –0.277 0.213 0.024
Oct
Monthly Heating Oil Prices as a Percentage Difference from the Previous Month, 1984–2011
Year
TABLE 10.7 Nov
61.5% 2.3% 2.2% 61.5% –18.0%
0.000 0.022 0.084 –0.017 0.102 0.055 0.031 –0.102 –0.043 –0.110 0.009 0.036 0.053 –0.078 –0.180 0.168 0.085 –0.170 0.067 0.079 –0.039 –0.120 0.128 0.071 –0.125 –0.041 0.051
Dec
57.7% 3.6% 0.3% 76.2% –25.9%
–0.037 –0.087 0.120 –0.084 0.101 0.762 –0.144 –0.240 0.001 –0.024 0.024 0.150 –0.021 –0.071 0.003 0.053 –0.133 0.105 0.139 0.106 –0.151 0.070 –0.094 0.022 –0.259 0.075 0.056
458
80.0%
10.0%
70.0%
8.0%
60.0%
6.0%
50.0%
4.0%
40.0% 2.0%
30.0%
0.0%
20.0%
–2.0%
10.0% 0.0%
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
Percentage of Price Change
Percentage Up Months
TRADING SYSTEMS AND METHODS
% up months Average
–4.0%
FIGURE 10.17 The percentage of upward months compared to the average monthly changes for heating oil, 1984 to 2011.
The results at the bottom of Table 10.7 can be visualized in Figure 10.17 where both the percentage of up months and the average monthly changes are plotted. Using only these numbers, the most basic seasonal trades would be Hold longs from the end of February to the end of March, from the end of May to the end of August, and from the end of October to the end of December. Hold shorts from the end of March to the end of May and from the end of August to the end of October. Because these charts were based on average monthly cash prices, positions from the end of February should actually be averaged in over all of February, for example, 25% of the position each week. Using the price on the last day of the month, rather than the average, would make the results more practical for trading. Of the three long positions, May through August represents inventory accumulation and October through December the critical winter months where users stock up on oil for the balance of the winter. Those trades seem reasonable. The first one, February and March may be statistically correct but still very risky. A late winter cold spell would drive prices sharply higher. Prices jumped 40% from March to April 1982, and 20% during the same period in 1983. We must also consider that the Gulf War, which pushed prices higher from August 1990, conformed by chance to the seasonal pattern; in reality, it could have happened any time during the year. Some traders may choose to trade the numbers only, but an understanding of the fundamentals might encourage further analysis and a better way of assessing whether the trade has a good reward to risk ratio. Soybeans have similar issues. The classic seasonal trade is long from April 1 to June 1 (planting and crop development) and short from September 1 to November 1 (harvest). One commodity firm shows the highs in May/June and the lows in October and evaluates the seasonal moves as a post-harvest rally into the new year, then a tax-related producer selling and the maturing of the Brazilian crop leading into the notorious
459
Seasonality and Calendar Patterns
February break. Further, the spring rally from March 1 often continues into the May/ June planting, and the post-harvest rally begins by mid-November. This advice does not conflict with the standard seasonality.
Years with Similar Characteristics Seasonal studies often yield results that are not as clear as desirable, and these results may be rejected because of the obvious lack of consistency. Often, this is caused by a few years that conflict with the normal seasonal patterns due to special events. If the month-end returns for cash corn are averaged from 1990 through 2010, the pattern is not quite as expected, as seen in Figure 10.18. Instead of the lows occurring only during harvest, in October, there is a low at the end of June as well as the end of September. A small rally in August reflects those years when there was uncertainty during the growing season; however, the primary pattern is that prices in most years just decline into harvest then rally into winter to reflect the carrying charges of storing the new crop combined with some export news. These patterns can be more intuitive if the data is separated into similar years. For example, crop production is primarily determined by weather. Poor weather will cause sharp rallies during the growing season while good weather results in a dull, sideways market. The reaction to bad weather develops slowly. A drought is not caused by the first hot day but by prolonged days of sunshine and no rain. Similarly, delayed planting due to wet fields or a late winter will set the stage for an underdeveloped crop. A trader can see the characteristics of a developing weather market and enter a long position ahead of the rally. Another important distinction is between bull and bear years. Cash corn prices will be used from 1970 through 2010. These two patterns can be separated a number of ways, but for this example the bull years are those where the average price of July through December is greater than the average price of January through June. Of those 41 years, 16 were bullish and 25 bearish. The average price for each month is shown in Figure 10.19. The bearish years have a “normal” seasonal pattern, while the bullish years
Corn Month-End Returns
Corn Seasonal Pattern from 1990 5.00 4.00 3.00 2.00 1.00 0.00 –1.00 –2.00 –3.00 –4.00 –5.00 Jan Feb Mar
Apr May Jun
Jul
Aug Sep Oct
Nov Dec
FIGURE 10.18 Month-end average returns for cash corn, 1990 to 2010.
460
TRADING SYSTEMS AND METHODS
300 290 280 270 260 250
Avg Bull
240
Avg Bear
230 220 210 200 Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
FIGURE 10.19 Corn monthly average prices separated into bull and bear years.
are consistently higher each month. Some of this uniformity can be attributed to larger upward moves in the most recent years. Bullish and bearish years could be separated in other ways, the simplest being that the end of the calendar year is higher than the start of the year, or that the end of the crop year is higher than the start of the crop year. If we believe that normal seasonality causes low prices before planting, higher prices during the growing season, and lower prices at harvest, we can test the price this year against prior years to decide which pattern is now occurring. The current year prices can be compared against the previous 3-year or 5-year rolling average prices to decide relative value. This last method will be used in the next section.
Seasonal and Nonseasonal Market Patterns There are years when agricultural prices follow a normal seasonal pattern and years that are quite different, just as there are bullish and bearish years. If a strategy is to profit from the rally during the growing season or the decline into harvest, then it’s important to recognize whether the year is expected to have a normal pattern. There are many events that would cause nonseasonal patterns, such as large export commitments (increase in demand) or a previously bad harvest (decrease in supply), or even a large change in the value of the local currency. A poor harvest in the previous year will cause the new crop to start trading at a high price, in anticipation of continued short supply until the new crop yield can be assessed. Using corn as an example because it represents the largest and most seasonal of the U.S. crops, we can construct a simple model that anticipates a seasonal or nonseasonal year and profits from those moves. It can be done by comparing the current cash prices with the highest and lowest prices of the past 5 years. A nonseasonal year would be one that has abnormally high prices in January. A seasonal year is one with relatively low prices in April, or high prices in July. The rules would be
Seasonality and Calendar Patterns
461
For a seasonal year If this year’s price at the end of April is in the lower 50% of the high-low price range of the previous 5 years, then expect a normal seasonal pattern. Buy on the last day of April, then exit on the last day of July. If this year’s price at the end of July is in the upper 35% of the high-low range of the past 5 years, then Sell on the last day of July and exit on the last day of October. For a nonseasonal year If this year’s price at the end of January is in the upper 35% of the high-low range for the past 5 years, then Sell on the last day of January and exit on the last day of October. Table 10.8 shows parts of the spreadsheet available on the Companion Website, TSM Corn bull and bear years, seasonal patterns. The full spreadsheet includes 1974–2010 month-end prices. In order to generate seasonal trades, it is necessary to create a series of seasonal calculations as shown in the tables. The first block has the month-end prices. The second is the 5-year high. Because the data start in 1974, the first year of the 5-year high is 1978. The third block is the 5-year low, and the last block is the position of this year’s month-end price in the previous 5-year high-low range. That is calculated as, for example, similar to a raw stochastic, 100 × (January price – January 5-year low)/(January 5-year high – January 5-year low). Once we have the relative position, the seasonal rules can be followed. Table 10.9 shows the positions entered for the nonseasonal (bearish) trade, or the first seasonal (bullish) trade. In 2005 the price at the end of April was at the 8.1% level (out of 100%), near the low of the 5-year range; therefore, a seasonal long position was entered on the last day of April at 192.50. Seasonal trades entered in April are always closed out at the end of July, and, in 2005, that was at 215.50 for a profit of 23 cents, less costs. Because the July price was in the lower part of the previous 5-year range, 44.7%, no short was entered. Had it been above 50% a short would have been set at the July end-ofmonth price. Although there was a seasonal low in September–October, the relative low price in July made the second part of the seasonal trade too risky. The seasonal trade in 2007 showed the opposite situation. Prices for the entire year were at 5-year highs; therefore no seasonal longs would be set. However, the end of July was also at the 100% level triggering a seasonal short trade on the last day of July, at 294. Unfortunately, prices continued higher in a nonseasonal pattern, generating a loss for the trade. Perhaps the 100% level indicates that risk is too high. The nonseasonal trades look to profit from high prices at the beginning of the year and progressively lower prices during the year, reaching an expected seasonal low in October, following the new crop. Whatever short supply or strong demand caused prices to be high
462
TRADING SYSTEMS AND METHODS
TABLE 10.8
Spreadsheet Calculations for Seasonal and Nonseasonal Patterns Month-End Prices
Year
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2005 2006 2007 2008 2009 2010
183.50 203.00 380.00 469.50 353.00 328.50
196.00 211.50 402.50 519.00 340.50 358.50
196.00 215.50 340.50 532.00 385.00 321.50
192.50 221.50 338.50 566.50 381.50 350.50
201.00 222.50 378.50 555.50 416.00 334.50
196.00 215.50 315.00 680.50 338.00 332.00
215.50 213.00 294.00 537.50 334.50 365.00
185.50 214.50 299.50 534.50 318.00 393.50
167.50 237.50 333.00 441.00 327.50 470.50
169.50 305.00 359.00 364.50 343.50 561.00
176.00 367.00 372.00 325.00 374.00 515.50
200.00 365.00 425.50 378.50 376.00 590.50
253.00 253.00 299.50 534.50 534.50 534.50
238.00 238.00 333.00 441.00 441.00 470.50
239.50 305.00 359.00 364.50 364.50 561.00
235.50 367.00 372.00 372.00 374.00 515.50
235.50 365.00 425.50 425.50 425.50 590.50
185.50 185.50 185.50 185.50 185.50 214.50
167.50 167.50 167.50 167.50 167.50 237.50
169.50 169.50 169.50 169.50 169.50 305.00
176.00 176.00 176.00 176.00 176.00 325.00
188.50 188.50 188.50 188.50 200.00 365.00
0.0 99.3 100.0 100.0 58.5 100.0
0.0 100.0 100.0 100.0 89.2 100.0
0.0 100.0 100.0 76.0 100.0 100.0
24.5 100.0 100.0 80.2 78.0 100.0
5-Year High
2005 2006 2007 2008 2009 2010
263.50 263.50 380.00 469.50 469.50 469.50
287.50 287.50 402.50 519.00 519.00 519.00
302.50 302.50 340.50 532.00 532.00 532.00
306.50 306.50 338.50 566.50 566.50 566.50
293.50 293.50 378.50 555.50 555.50 555.50
248.50 248.50 315.00 680.50 680.50 680.50
236.50 236.50 294.00 537.50 537.50 537.50
5-Year Low
2005 2006 2007 2008 2009 2010
183.50 183.50 183.50 183.50 183.50 203.00
191.00 191.00 196.00 196.00 196.00 211.50
183.00 190.50 196.00 196.00 196.00 215.50
182.50 185.50 192.50 192.50 192.50 221.50
175.00 201.00 201.00 201.00 201.00 222.50
174.00 196.00 196.00 196.00 196.00 215.50
198.50 202.00 202.00 205.00 213.00 213.00
5-Year Relative Position
2005 0.0 2006 24.4 2007 100.0 2008 100.0 2009 59.3 2010 47.1
5.2 21.2 100.0 100.0 44.7 47.8
10.9 22.3 100.0 100.0 56.3 33.5
8.1 29.8 100.0 100.0 50.5 37.4
21.9 23.2 100.0 100.0 60.6 33.6
29.5 37.1 100.0 100.0 29.3 25.1
44.7 31.9 100.0 100.0 37.4 46.8
0.0 43.0 100.0 100.0 38.0 55.9
TABLE 10.9 Positions, Entry and Exit Prices, Profits and Losses for Seasonal Patterns Seasonal Trade #1
Seasonal Trade #2
Position
Entry
2005 2006 2007 2008 2009 2010
192.5 169.5 0 221.5 305.0 0 0 0 294.0 0 0 537.5 0 0 0 350.5 561.0 0
1 1 –1 –1 0 1
Profit/Loss
Total Profit/Loss
Total
Exit Reverse Exit Trade 1 Trade 2 Trade 1 Trade 2 1 + 2 All Patterns
0 –23.0 0 83.5 359.0 0 364.5 0 0 0 0 210.5
0 0 –65.0 173.0 0 0
–121.0 –37.5 –37.5 –37.5 –37.5 173.0
299.5 299.5 234.5 407.5 407.5 407.5
178.5 262.0 197.0 370.0 370.0 580.5
708.5 792.0 748.0 1026.0 1026.0 1236.5
463
Seasonality and Calendar Patterns
TABLE 10.10 Positions, Entry and Exit Prices, and Profits and Losses for Nonseasonal Patterns Year
Position
2005 2006 2007 2008 2009 2010
1 1 –1 –1 0 1
Entry
Exit
PL
PL Bear
Cum Bear
192.5 221.5 380.0 469.5 0.0 350.5
169.5 305.0 359.0 364.5 0.0 561.0
–23.0 83.5 21.0 105.0 0.0 210.5
0 0 21 105 0 0
530 530 551 656 656 656
in the previous year is likely to correct with the new crop. The first year in the table that a nonseasonal short is entered is 2007, shown in Table 10.10, where prices were at 5-year highs. Although they stayed at 5-year highs all year, prices did drop from the January level of 380 to the October harvest level of 369. It was not much of a correction, but still a net profit. Had we waited longer, the small profit would have disappeared completely. Figure 10.20 shows the performance of this method over 37 years, separating the results into the first and second seasonal trade (long then short), and the nonseasonal trade (short), then combining the results into the total profit (the average). Performance is good although there are years when there were no trades, as shown by the horizontal lines. Remember that this was intended to be a simple example to show that, in theory, grains follow a reasonably predictable pattern, helped along by nature. Not Quite So Easy However, to achieve these profits you would need to buy and sell cash corn. That is, when you buy corn you would be holding a warehouse receipt for 5,000 bushels of corn for each contract lot size. Selling short in January or July means promising to deliver corn at some future date. For most traders, that is not practical and perhaps impossible. The only choice is trading futures, but the futures price is never the same as the cash 1400 1200 1000 800
Seasonal 1
600
Seasonal 2
400
Total 1+2
200
Bear All
0 –200
06 20 0 20 8 10
04
20
02
20
00
20
98
20
96
19
94
19
92
19
90
19
88
19
86
19
84
19
82
19
80
19
78
19
19
19
76
–400
FIGURE 10.20 Performance of a seasonal system applied to cash corn prices.
464
TRADING SYSTEMS AND METHODS
price. It discounts future expectations. If everyone has the same opinion of what will happen between April and July, then on the last day of April, the price of December corn (the new crop) will already be much higher than the cash price, reflecting uncertainty during the growing year. Or, if a good new harvest was expected, then the December futures price would reflect the harvest lows as soon as possible. A more realistic scenario can be found by using only the December futures contract, the first new crop month. Each year, the new crop prices start on December 1 and trade until the last day of November in the following year. A seasonal chart can be constructed by taking the month-end differences just as before, but the November–December differences can’t be used because they reflect different contracts. A spreadsheet with this data and the seasonal chart can be found in the Companion Website along with all of the other seasonal charts in this chapter. Figure 10.21 shows the month-end average changes, which are quite different from the cash pattern. The lows are in June and September, indicating that traders normally anticipate a good crop and discount the final price as early as June before being surprised that the summer is still uncertain. This pattern can now be traded because it uses only December futures. Taking the obvious two major trends, the following seasonal trades can be isolated: 1. Sell December corn at the end of February, exit at the end of July. 2. Buy December corn at the end of July, exit at the end of October.
150 100 50
Mar
Jun Sep
–50
Dec
–100 –150
1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010
Monthly Price Change (cents per bushel)
Neither of these trades span the November–December months when we would roll into the next year’s new crop. The results of using these two seasonal trades are simple to calculate and are shown in Figure 10.22 and in the Companion Website as TSM Dec Corn Strategy. Surprisingly, the first seasonal trade, which expects prices to decline from February through July, is consistently profitable. The weather scares that always surround planting (too much rain), and then growing season (not enough rain) do not seem
FIGURE 10.21 December corn contract, monthly average changes from 1990 to 2010.
465
Seasonality and Calendar Patterns
Profit/Loss (cents per bushel)
500.00 400.00 300.00 200.00 Seasonal 1
100.00
Seasonal 2
0.00
Total 1+2
–100.00
2010
2008
2006
2004
2002
2000
1998
1996
1994
1992
–300.00
1990
–200.00
FIGURE 10.22 Results of two seasonal strategies using December corn futures.
to be significant. While there are some years with small losses, the overall performance of Strategy 1 is good. Not so with Strategy 2. Although it is perfectly logical to expect a price rally after harvest based on both storage costs (carrying charges) and export activity, the results of that strategy is at best a break-even with more volatility. Effects of Currency (Argentina) There was a time when the United States was the biggest exporter of grain and when currencies did not fluctuate very much. But at that time many currencies were backed by gold and not freely traded. Argentina is now the biggest producer in South America that has excess production; therefore, it competes directly with the United States on the world market. Let us assume the U.K. wants to import wheat and, for the sake of simplicity, we assume the value of the British pound remains the same against the U.S. dollar. Which country would the British buy from, the United States or Argentina? Looking at the changing value of the Argentine peso in Figure 10.23, there is a variation of 120%, from 5 to 11 pesos per USD, over the one year from May 2009 to May 2010. At the low point, 5 pesos to the dollar, the peso was strong and the price of Argentine wheat high; therefore, U.S. wheat is more attractive. At the high point, 11 pesos to the dollar, the peso would have been cheap, and the price of wheat in Argentina would have been attractive. There are many years in which the change in currency value is greater than the change in the product value. In all cases, when you combine the price fluctuations with the currency fluctuations, you get move volatility. Using Continuous Futures Knowing that only futures (or options on futures) will be traded, we looked at the seasonal patterns based on only trading one contract each year, December, the first new crop for corn. For most analysts, continuous, back-adjusted prices are the most readily available and easiest data to use. They also combine the most liquid part of each delivery month.
466
TRADING SYSTEMS AND METHODS
Argentine Pesos per USD
12 11 10 9 8 7 6 5 Jan-11
Nov-10
Sep-10
Jul-10
Mar-10
May-10
Jan-10
Nov-09
Jul-09
Sep-09
Mar-09
May-09
Jan-09
Nov-08
Sep-08
Jul-08
May-08
Jan-08
Mar-08
4
FIGURE 10.23 Argentine pesos per USD show large cyclic swings during the past 3 years.
In the interest rate markets, forex, metals, and equity index markets, back-adjusted data works for most strategies, and for trending methods in any market, back-adjusted data are fine. However, there are some strategies, such as arbitrage and seasonal trades, that need the exact prices at the time. And, for any percentage calculation that uses prices, a back-adjusted price gives the wrong result. Figure 10.24 shows the back-adjusted corn series using futures beginning in 1949. Prices on the far right are 2011, and are the same prices trading at this time. Each earlier contract is adjusted up or down according to the price gap between the two contracts on the roll date. Prices that become higher in the past are the result of upwards gap adjustments. That is, the more recent contract is trading at a higher price than the older contract. That would be normal for all corn contracts because it is a carrying-charge market (in contango) except for the switch from old crop to new crop, usually in December. Then
1200 1000 800 600 400
FIGURE 10.24 Back-adjusted corn prices suffer from upward gaps at most roll dates, causing historic prices to be much higher.
1/3/2009
1/3/2006
1/3/2003
1/3/2000
1/3/1997
1/3/1994
1/3/1991
1/3/1988
1/3/1985
1/3/1982
1/3/1979
1/3/1976
1/3/1973
1/3/1970
1/3/1967
1/3/1964
1/3/1961
1/3/1958
1/3/1955
1/3/1952
200 1/3/1949
Price (cents per bushel)
1400
467
Seasonality and Calendar Patterns
rolling into December from March, March from May, and July from September will usually require adding an adjustment factor to the older contract to raise those prices to the level of the newer data. The new crop, December, should be trading lower than the last old crop contract, September, so that adjustment is often downward. Given this very different historic picture of corn prices, can this data be used for trading seasonal patterns? As before, a seasonal chart can be constructed using back-adjusted futures, but only by subtracting the price of the previous month from the current month. Unlike cash, we cannot find the percent difference in price change. Using price differences adds a significant bias to more recent data, which have been much more volatile than past data. Figure 10.25 shows the average monthly price change over the 21 years from 1990 as well as the averages of the first 11 and last 10 year periods. The pattern is similar to Figure 10.21, which used only December futures. The seasonal pattern shows a low at harvest, the peak prices are not in June or July, and the volatility of the recent 10 years is far greater than the earlier 11 years. This reduces the importance of older data, but many analysts prefer giving more weight to more recent data. As long as you understand the biases of the data, you can work with it. The seasonal pattern based on futures suggests two clear strategies, the first is the same as the one using only December futures, but the second takes advantage of the month of December, which could not be used in the previous strategy because it was a different crop year. Sell at the end of February and exit at the end of July. Buy at the end of July and exit at the end of December. If these two methods are implemented, although with the complete benefit of hindsight, the results are shown in Figure 10.26. Strategy 1 is consistently profitable, as it was using only the December futures, while strategy 2 is slightly better when the month of December is used.
Price Change (cents per bushel)
20.00 15.00 10.00 5.00
Average
0.00
1990–2000
–5.00
2001–2010
–10.00 –15.00 –20.00
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
FIGURE 10.25 Corn monthly average price changes using futures market back-adjusted data.
468
TRADING SYSTEMS AND METHODS
600.00 Profits (cents per bushel)
500.00 400.00 300.00 200.00
Strategy 1
100.00
Strategy 2
0.00
Total 1+2
–100.00
2010
2008
2006
2004
2002
2000
1998
1996
1994
1992
–300.00
1990
–200.00
FIGURE 10.26 Performance of two seasonal strategies for corn based on back-adjusted futures prices.
Strategy 2, buying at the end of July, might be justified if the new crop size is known by then, which is possible. Then exiting at the end of December could capture the postharvest rally. The results, however, show that this is inconsistent, even though the seasonal pattern in Figure 10.25 seemed clear. The first method, selling at the end of January and exiting at the end of July seems completely contrary to seasonality but consistent with the idea of a nonseasonal year, where prices start high and end at harvests’ low. Using cash prices, July was expected to be the high. The consistency of the results, with 12 of 21 years profitable but the profits much larger than the losses, seems to justify the method. The confusing part is “Why is July the seasonal low?” An answer can be found by looking at the increasing volatility of monthly changes over the past 20 years, as seen in Figure 10.27. While volatility had been increasing at an December Corn, Average Monthly-End Changes Changes (cents per bushel)
10.00 5.00 0.00 –5.00
–10.00 –15.00 Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
FIGURE 10.27 Increasing volatility in price changes for corn, based on the March, June, September, and December futures contracts. Volatility has been increasing but has been extreme during the past 3years.
469
Seasonality and Calendar Patterns
orderly rate until 2007, it has been extreme for the past few years. Using back-adjusted futures means that we cannot divide the monthly price change by the futures price; therefore, the changes in the most recent years will overwhelm the older years. One solution is to divide the monthly price changes by the unadjusted futures prices, but that requires constructing a continuous but not back-adjusted series. That can be done using a data service such as CSI.
Seasonal Patterns in Stocks Carrying the same analysis into the equities markets, we can find many companies that are likely to have seasonal patterns. These will not be diversified holding companies, but those whose primary income is from a single, seasonal source. Many airlines qualify, as do firms in the travel and leisure sector. It is not clear that share prices of the major oil companies, such as Exxon-Mobil, vary directly with the price of oil. Refining margins and vertical integration of retail gas stations (with mini-markets) make the profitability of these companies much less dependent upon the varying cost of oil. Using AMR, the parent company of American Airlines, as an example, the familiar monthly returns are shown in Table 10.11 from September 1998 through April 2011. Along the bottom are the monthly averages as well as a selected set of averages, This selected set removed September and October 2001 as well as September 2008 through March of 2009. The first months removed reflect the 9/11 terrorist attack, in which American Airlines played an unwanted role. The second set isolates the worst part of the subprime mortgage meltdown, where business came to a near halt. When we remove the outliers we can be guilty of the same data manipulation that caused the end of Long Term
TABLE 10.11 Monthly Returns of AMR with Monthly Averages and Averages That Removed Selected Months Year
1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 Average Selected
Jan
Feb
–1.07 –19.70 –0.26 11.84 –56.06 26.64 –21.46 2.11 22.56 –0.64 –44.33 –10.48 –9.50
–5.63 –1.71 –14.94 4.65 –19.31 –7.32 –1.28 10.57 –8.02 –8.11 –31.14 32.80 –4.40
–7.72 –4.67
–4.14 –1.89
Mar
5.62 42.38 5.62 1.19 –10.26 –16.25 26.03 7.77 –10.65 –29.59 –22.00 –0.87 –4.15
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
1.73 –7.05 –0.18 –40.17 –58.98 4.09 –18.01 –11.20 12.06 –9.06 –4.94 45.60 2.45
20.96 16.51 0.00 –4.91 12.92 15.98 5.32 20.84 22.47 7.67 3.97 –32.20 25.84
–1.66 –4.13 2.11 17.36 64.19 –3.39 16.97 25.02 12.77 –11.75 –14.01 12.06 8.49
–9.96 10.09 17.19 4.40 –14.84 0.94 21.26 31.62 –5.41 –33.76 21.53 27.98 –9.00
–6.43 8.88 9.54 –3.50 10.57 11.50
4.77 3.38
19.24 6.84 8.51 –18.71 113.33 –10.84 –2.15 –8.91 –14.32 –2.77 49.22 –18.99
–6.80 –16.32 2.31 –2.42 41.52 1.50 23.21 0.08 8.66 –18.02 –6.51 3.93
4.90 –7.23 –7.34 –19.52 73.50 5.12 –6.12 3.08 –7.05 –28.79 –9.66 –11.60
–4.95 25.04 –2.71 –33.69 –15.00 –30.39 16.02 –13.45 –6.34 76.37 33.08 4.42
–9.65 –0.76 –8.99 –8.86 17.65 6.05 –10.39 –6.14 –0.69 14.40 2.06 –13.56
–0.40 10.04 1.40 10.04
2.59 2.59
–0.89 –0.89
4.03 4.03
–1.57 –1.57
470
TRADING SYSTEMS AND METHODS
15.00 10.00 5.00 Average Selected
0.00 –5.00 –10.00 Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
FIGURE 10.28 Seasonal patterns of AMR, all months and selected months of extreme crises removed.
Capital Management in the late 1990s. Caveat emptor. Both monthly patterns are shown in Figure 10.28. Surprisingly, the removal of critical months made little difference to the pattern, even over 13 years, which is a small period to judge seasonality. There seems to be a clear pattern of prices peaking in April and November–December, and falling to lows in September. We can guess that the year-end holiday season is the cause of strength, but we don’t know if the other patterns reflect the time when customers were actually flying or if it is when they purchased their tickets. We expect the summer to be a busy time for airlines; however those purchases may have come in April.
Seasonality for Trading Before analyzing a market for seasonal patterns, you must understand whether that market qualifies. Given the power of computers and the convenience of spreadsheets, it is possible to evaluate all stocks and all futures markets looking for patterns. Finding a monthly pattern does not mean that there is seasonality. Years ago, when computing power was just taking hold, there was an academic who discovered that, for the past 18 years, whenever there was a good coffee crop in South America, then next year there was a good wheat harvest in Europe. He delved deeper and found that the Gulf Stream, a well-known flow of warm water, passes by the eastern coast of South American and flows north all the way to Europe. Voilà! Having decided that the chances of 18 consecutive years of success was convincing, combined with a fundamental justification, he sold wheat the next year following a good coffee crop. Of course, that was the first year that the theory failed. It turns out that he had tested hundreds of combinations of causal effects, a crop in one location followed by a crop in another location, in order to find 18 consecutive years. We understand now that it was an early case of overfitting; however,
Seasonality and Calendar Patterns
471
the lesson to be learned is that there must be a clear fundamental reason to believe that there is a seasonal pattern. The computer is used to validate a belief, not to create one. By way of example, there is an interesting pattern that develops in livestock during a period of high grain prices. Most often, a farmer who also feeds cattle will send them to market early rather than pay the cost of high feed and then face the uncertainty of a profit when the cattle are ready to market. The decision to sell early puts immediate pressure on cattle prices in the short term but causes higher prices 3 to 9 months out, when there will be a shortage of supply. As grain prices move higher, selling the nearby cattle futures and buying the deferred can be a profitable strategy. Although metals are not subject to seasonal supply factors, copper, as well as most of the LME nonferrous metals, should have a significant seasonal demand component. All of them are primarily used in housing for plumbing, sheet metal, or stainless steel. More recently, commodities in general have seen an unprecedented rally due to fears of inflation as well as demand from the rising middle class in China, with India soon to follow. Seasonality must be hidden within these prices; however, the larger macroeconomic factors have overwhelmed them to the point where they are insignificant for now. Just as in the comparison of corn cash prices and futures prices, it is necessary to be realistic about which patterns to use. The systems and methods that follow are based entirely on seasonal patterns and may be used alone or as a filter for other strategies.
Seasonal Studies and Key Dates Most agricultural commodities exhibit traditional, reliable price moves at one or more periods throughout the year. The grains grown in the northern hemisphere have a high likelihood of a rally during the late spring and early summer, when the chance of drought has the greatest effect on yield. When prices show the normal harvest lows, followed by a modest rise and sideways pattern throughout the winter, the potential is good for a rally during the early growing season. When prices begin the new crop year at relatively low levels, the risk of holding a long position is small. Once prices have moved higher, there is rarely a season where a short sale of corn, soybeans, cotton, or sugar will not net a good profit within the two months before harvest begins. Seasonal studies are intended to provide information on when the largest move will occur. The following studies—Grushcow and Smith (1980), ContiCommodity (1983), and Bernstein (1986)—can be used to compare historic seasonality in some of the more active commodities. A summary of the results is shown in Table 10.12. Each study offers a different perspective on seasonality. Grushcow and Smith analyze both cash and individual futures markets over a fairly long period and present complete statistics; ContiCommodity used mostly the past 10 years (which ended in 1981), but included a unique volatility analysis; Bernstein, the most recently published study, gave the most complete background on calculations, including separate studies of bullish and bearish years and an exceptionally long time period for cash market analysis.
472
TRADING SYSTEMS AND METHODS
TABLE 10.12
Results of Seasonal Studies J-F
F-M
M-A
A-M
M-J
J-J
J-A
A-S
S-O
O-N
N-D
D-J
1.5 4.5 −1.5 50 62
−5.3 1.4 −3.2 54 63
−8.5 −7.5 −6.7 88 82
−1.3 −1.3 −3.7 63 60
.5 −6.4 5.4 83 82
2.1 1.8 1.5 71 70
−1.3 −11.7 −5 58 64
−25.8 −14.9 −20 83 74
−7.5 −46.7 −8 63 64
4.2 −9.8 10 75 76
5.8 −8.9 3 67 72
.3 2.1 2 79 70
.4 −.4 3 56 55
−.3 −.7 4 44 42
−.4 −1.3 −9 76 60
−.5 −.5 −9 64 71
−.1 −.3 −2 52 51
.4 −.2 2 72 62
.1 1.8 1 56 66
−.2 2.3 3 67 81
1.2 .2 −2 45 61
−2.3 .0 −2 45 40
−.3 .0 −13 56 67
1.7 −4.7 −4 56 62
−.7 −11.5 18 46 56
−.3 −2.0 2 55 56
.1 4.3 19 41 51
.3 −8.6 −10 64 59
−.5 4.7 −4 50 54
.1 2.2 −2 77 49
Corn
24 years* 10 years† 46 years‡ %* %‡
.5 2.2 −.6 58 52
−1.1 −1.3 2.0 58 60
1.6 −2.3 3.0 67 80
3.6 −1.2 2.9 92 72
3.4 2.3 2.3 50 45
.5 7.7 3.8 46 59
Soybeans
24 years* 10 years† 42 years‡§ %* %‡
7.4 7.5 8.4 9.5 6.4 −2.3 21.1 23.7 12.6 20.0 3 11 8 8 3 67 50 67 50 42 62 53 57 51 42
−.7 14.7 −1 38 37 Cattle
25 years* 10 years† 50 years‡§ %* %‡
−.4 1.4 1 64 52
.1 .2 12 60 70
.6 .8 13 48 59
.1 1.8 4 44 52
−.1 .4 −1 56 52
.4 −1.2 7 60 59
Orange Juice
10 years* 10 years† 34 years‡ %* %‡
−1.6 −1.9 27 78 6!
−.1 2.4 14 45 64
−.3 −1.1 4 67 50
−.9 −.7 −3 56 58
−.9 .0 −8 45 50
−.3 1.6 −1 45 65 Coffee
22 years* 8 years† 53 years‡§ %* %‡
−.2 −6.5 0 41 56
.9 1.8 −10 64 58
−.5 7.6 2 50 43
−.4 5.0 −4 50 53
.1 −.3 1 59 50
.1 3.3 4 46 48
*Grushcow and Smith (change in price), data ending 1978. †ContiCommodity (% change in seasonal factor), data ending 1981. ‡Bernstein (% change in seasonal factor), data ending 1985. §Approximate values. % refers to the reliability of monthly seasonality.
The number of years in the seasonal analysis counts heavily in determining the normal patterns. As Table 10.12 shows, the ContiCommodity results, based on only 10 years, are often quite different from the other two studies. For trading safety, it would be best to select those patterns that have proved reliable over many years; however, because the most recent 10 years may be most important for deciding if the pattern is still profitable, a trader must be able to identify nonseasonal, bullish, or bearish patterns.
Seasonality and Calendar Patterns
473
The conclusions that seem consistent throughout all studies are: Corn and soybeans. September and October show major harvest pressure. Cattle. An end of the year liquidation and mid-winter rally. Coffee and juice. No common moves in the three studies. Some commodities are more seasonally consistent than others. Both the coffee and orange juice markets were expected to show patterns that reflect a rise as the possibilities of a freeze increase; however, those patterns did not appear. Because we know that the freeze concerns must appear in the prices, we can infer that the normal seasonality of these products is distorted by the inconsistent and highly volatile periods that follow a freeze. These markets would be candidates for the bullish and bearish years study in which you compare only those years with common factors. The three studies shown here, as well as most others, include recommended trades based on key dates, which reflect the patterns in Table 10.12. By selecting those trades common to all of them, you have found those that are most reliable. In a summary by Bernstein, which catalogs commodities by those months with the highest reliability, the agricultural products are clearly the most seasonal. The only nonagricultural market that shows any consistent seasonality is copper. Although there may be interesting arguments for the forces of demand on silver, currencies, and financial markets, their inconsistency shows that they are not candidates for seasonal trading. Seasonal Calendar Because Bernstein’s work covers the cash markets over an extremely long period, it must be considered the most reliable source of basic seasonal patterns. Table 10.13 is part of the weekly seasonal calendar that appears in Seasonal Concepts in Futures Trading. The numbers in the table show those weeks with consistent historic moves. Weeks of 64% and higher represent upwards moves; weeks of 36% and lower are downward trends. This calendar can be extremely useful when combined with some simple trading logic that asks, “Is the market acting in a seasonal manner?” before the position is entered. It should also be noted that patterns in futures markets, whether a single contract or backadjusted data, will be different from the cash market. If you are trading futures, then you need to use futures patterns. Books on Seasonal Patterns It is not possible to summarize all the literature on seasonality here; however, there are a number of books that can be studied to take advantage of work already done. Seasonal Stock Market Trends: The Definitive Guide to Calendar-Based Stock Market Trading by Jay Kaeppel (Hoboken, NJ: John Wiley & Sons, 2009). The Almanac Investor: Profit from Market History and Seasonal Trends by Jeffrey A. Hirsch and J. Taylor Brown (Stock Traders Almanac, 2005).
474
22
23
27 27
31 64
29
22
72 66
35
27 35 27 35
35
66
37
31 37 23
72
79
37 33
33
37 33 31 75
25 31 29
33 76 33 66
22
33
70 66 35 22 27
33
23
37 37
76 66
64 81 64
29
31 35 64 37
76 33 36 63
22 83 82
18
29 28 82 29
64 29 26 35 31
64 70 64
64 66
64
31
May Soybeans
Jan Soybeans
Mar Soybeans
17
23 29
66 66 66 66 37 37
70 35 64 72
33
64 76 25
64
63
66 29
29
31
66
64 35
66 37
27 33
33
70 26
72 35
64 29 18
13 25
64
27
83 72
66
66 35
33
35
27
64
70
70 66
29
76 76
76
64
23
37 78 70 35 26
37 37 37
64 21 36 35
70 35
33 33
37 37 35 76 27 66
37
25 37
37 66
66 37 66
66 31 27
22
35 70
29 66
37
77
27
Dec Oats
66
Sep Oats
66 66
Jul Oats
May Oats
29
66
35 35 66
Dec Wheat
Sep Wheat
Jul Wheat
May Wheat
Mar Wheat
Dec Corn
Sep Corn
Jul Corn
76
Mar Oats
1 Jan 2 3 4 5 Feb 6 7 8 9 Mar 10 11 12 13 Apr 14 15 16 17 18 May 19 20 21 22 Jun 23 24 25 26 Jul 27 28 29 30 31 Aug 32 33 34 35 Sep 36 37 38 39 40 Oct 41 42 43 44 Nov 45 46 47 48 Dec 49 50 51 52
May Corn
Mar Corn
TABLE 10.13 Seasonal Calendar
35
64 35 33 35 64
66
31 79 64 29 66 64 66 29 35 35
33 33
35
66 27
25 37
64
33 70
28 37
37
66 37
66 70
66 66 37
64
35 64 35 70
64
35 23
64
25 29
64
66
33
37
70
64
64 72
70 75
81
66 64 63 15
66 64
66 25
31
66
33
66
76 29
20
35
28
64 29
75 31 76 66
25
35 35
35 35 37 75 35
76
66
70 37 72 66
66
76 76 64
71 75
64
33 27 33 72
70
66
66 64
33 66
70 27
66
66
70 27
70
Oct Live Cattle
Aug Live Cattle
Jun Live Cattle
Apr Live Cattle
76
64
29
29
70 29
37 66
66 37
66 64 64
37 37 35
77
66
70 64
66
75 64
66
33 29
66
66 76
37
35
17
36
Feb Live Cattle
Dec Soybean Oil
62
33 72 70
23
64 29
64 66 64 66 76
33 23 70
70
63
33
Sep Soybean Oil
Jul Soybean Oil
64
66
37
23 64 37
66
64 35
75 70
77
35 66 29
37 64
May Soybean Oil
33
Mar Soybean Oil
Dec Soybean Meal
Sep Soybean Meal
Jul Soybean Meal
May Soybean Meal
Mar Soybean Meal
Jan Soybean Meal
64
Nov Soybeans
Aug Soybeans
37 64
Sep Soybeans
Jul Soybeans
TABLE 10.13 (continued)
70 33 33 66
72
22 66 66 72
64
75 64
66
66 33 66
66 73
77 37
77
33 29 64 66
27
66 37
33 64 64 27
29
10 64
66 37 66
37 70
35
37 64 35
36 73 35
72 66
36
76
35 72
64 23
27
64 64
77 76
66 75
33 70
70 64 66
37
35 66
66
37 72
29 66
16 66 33
66 11
29 27
66
29 35
35 31
31
72 64 70
27
70 33 37
33 31 35 13 70 76 66
64 75
33 22
66 64
66 66
475
1 Ian 2 3 4 5 Feb 6 7 8 9 Mar 10 11 12 13 Apr 14 15 16 17 18 May 19 20 21 22 Jun 23 24 25 26 Jul 27 28 29 30 31 Aug 32 33 34 35 Sep 36 37 38 39 40 Oct 41 42 43 44 Nov 45 46 47 48 Dec 49 50 51 52
476
66 70 77 66 70 66 36 63 63 70
35 66 66
35 37
73 66 70 64 77 78 87 71 33
90 80 63 90 80 81 72 66 81
66
Dec Cocoa
Jul Cocoa
May Cocoa
Mar Cocoa
Aug Pork Bellies
Jul Pork Bellies
66 33 66 23
64 64 66 73 80 29 31
30 33 30 27 70 63 81 80 77 36 30 36 72 63 72 66 36 80 36 27
33 70
May Pork Bellies
33 63
72
Mar Pork Bellies
64 37 70 66 66 64 64 35 33 66 62 64 81 37 64 35 35 33 66 66 70 75 66
76 66 80 76 73 64 64 66
64
20 80 80 70
Feb Pork Bellies
Dec Live Hogs
Oct Live Hogs
Aug Live Hogs
Jul Live Hogs
Jun Live Hogs
Apr Live Hogs
Feb Live Hogs
Nov Feeder Cattle
Oct Feeder Cattle
Sep Feeder Cattle
Apr Feeder Cattle
Mar Feeder Cattle
Dec Live Cattle
TABLE 10.13 (continued)
27
35 26 27 35 31 70
37 70 64 35
66 66 64
35
64 35 27 27 68 79 31 38 78 66 23 22 38
37 29 27 35 64 66 17 35 33 35 23 37 33 70 66 70 76 77 75 72 64 77 66 72 66 77 64
37
27 36 72 63 36 63 30 63 80 63 72 70 70 30
70
27 33
66 76 66 72 70 76 66 37 38 73 66 70 66 66 37
64 66 64 36 64 33 64 83 81 70 77 33 66
33 70
31
29 27
35 22
36 82 83 71
70 70
84
66
31
35
35
73
37 66 64 77 76
66 76 64
33 29 23
29 33 37 70 66 33 75 72 64 72 64 66 72 66 70 29 77 70 80 25 33 33 77 27
64 33
64
64 66
72
31 35 29 35 37 35
35
25 31 64 29 26 29 12 16 27 22 31 64 70 31 37 37 75 33 75 64 76 76 77
66
35 64 33 33 35 35 27
73
33
81
75 80
26
64 36 36 33 36 29 36 35
36 63
63 72 66 66 27 82 66 76 36 75 70 66 72 36 63 27 37 36 63 66 63 82 64 11 35 36 33 64 76 72 66 70 68 36 64 66 72 64 75 66 75 83 72 90 66 75 63 63 70 72 70 63 63 66 64 64 72 75 75 64 70 72 66 66 33 72 83 83 18 33 35
64 66 80 66 63 37 36 64 36 66 36 33 63 35 63 23 23 81
Nov Lumber
Sep Lumber
Jul Lumber
May Lumber
Mar Lumber
Jan Lumber
Dec Cotton
Oct Cotton
Jul Cotton
May Cotton
75 76
72 80 66 63 75 72 72 66 36 35 29 33 27 70 33 36 64 36 70 66
36
75
Mar Cotton
36 72 35 72 36
29 64
37 73 73
Dec Coffee
75 87 86 75 64 35 33
63 27 18 66 35 63 70 66 72 35 36 25 70 66 37 36 36 33 37 36 80 75 66
66 64
70
Sep Coffee
Jul Coffee
May Coffee
Mar Coffee
Oct Sugar
63 66 27 75 63 72 81 91 75 63 33 70 35 66 64 72 33 83 72 33 75 36 36 36 66 66 66 72 37 63 63 63 66 75 27
77 70
35 35 29 33 62 72
68 68 33 35
Jul Sugar
May Sugar
Mar Sugar
Nov Orange Juice
Sep Orange Juice
May Orange Juice
Jan Orange Juice
TABLE 10.13 (continued)
66 66 30
28 69 69 71 69 15
64 69 66 64 63 76 21 7 28 72 28 30 35 16 33 35 69 30 15 25 35 36 7 33 70
37 18 37 64 70 68 37 35 31 35 70 75 66 29 26 68
30 27
70 70 66 23 37 31 35 69 29 70 37 66 75 69
68
37 30 72 15 ?
35 76
64
30 7 25 23 35 33 35 25 28 83 14 78 33 83 35 75 64
35
28 71
37 37 66
35 35 35 37 37 29 12
35 28 66 71
66 30 69 25 7 25 28 35 23 28
33 81 66 75 63 27 70 68 68 76 37 69 83 63 64 64 66 66 71 76 71
28
28
71 35 35 35 37 35 84 69 69 64 63 64 66 64 66 35 37 63 33 30 75 63 64 35 69 76 85 83 63 76 66 66
477
478
TRADING SYSTEMS AND METHODS
Seasonality: Systems, Strategies, and Signals by Jake Bernstein (New York: John Wiley & Sons, 1998). Trading Spreads and Seasonals by Joe Ross (Ross Trading, 1995). Seasonal Concepts in Futures Trading by Jacob Bernstein (New York: John Wiley & Sons, 1986). In addition, many books include sections on seasonality within more general coverage of price patterns and strategies.
SEASONALITY AND THE STOCK MARKET At the beginning of this chapter, Southwest Airlines was used as an example of a likely candidate for seasonality, and Figure 10.28 showed the seasonal pattern for AMR. Now we will look at the S&P for general patterns in the stock market. As with some of the other examples, S&P emini futures will be used because that is the most popular contract, although SPYs could also be used to reflect prices closer to the cash index. Because futures will be used, the price differences will be the basis for the monthly patterns, rather than the returns. To minimize the effects of higher prices, the data from 1982 to 2010 will be separated into the first 19 years and the last 10 years. The results are shown in Figure 10.29. We first see that the 19 years from 1982 to 2000 were far less volatile than recent years, with a clear decline during the summer months. In addition, the pattern from October through the end of November, or possibly December, has not changed. The theory is that investors come back from their summer holidays and move their money back into the market. They remove part of their investment at the end of the year for tax purposes. The old adage, “buy in May and go away” does not seem to be a good idea any more.
30.00
Monthly Price Changes
20.00 10.00 0.00
First 19
–10.00
Last 10
–20.00 –30.00 –40.00 Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
FIGURE 10.29 Seasonality of the S&P using back-adjusted emini futures.
479
Seasonality and Calendar Patterns
Average Monthly Returns
4 3 2 1 0 –1 –2 –3 Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
FIGURE 10.30 The DJIA average month-end cash prices, May 1998 through March 2011.
To show that it is not the discounting of futures prices that have caused this pattern, Figure 10.30 uses the cash Dow Industrials for the recent 12 years and averages the month-end returns. The pattern is very similar, peaking at the end of April, with a rally in October. The Dow is even less consistent than the S&P, but then it only has 30 stocks. Most of all, these charts show that patterns have changed. Global factors, economic crises, arbitrage, and different participants all play a role. Only the most significant patterns will survive over time.
The Holiday Effect for Stocks Arthur Merrill is acknowledged as the pioneer in seasonal timing of stocks, publishing his comprehensive work on this topic in 1966.9 In his studies of price movement before and after major holidays, Merrill demonstrates a strong bullish tendency in advance of a holiday with a weak day immediately following. Remembering the bullish bias of the stock market (about 54% of all days were higher from 1897 to January 1964), Merrill’s results are shown in Table 10.14. For trading, this would indicate the possibility of a sharp trending move prior to or throughout a holiday season.10 Kaeppel is more specific, recommending buying on the close of the third day before an exchange holiday and selling on the close two days later (one day before the holiday).11 9 Arthur
A. Merrill, Behavior of Prices on Wall Street (Chappaqua, NY: Analysis Press, 1966). It is currently available from Analysis Press, 3300 Darby Road, #3325, Haverford, PA. 10 An excellent summary of seasonal studies in the stock market can be found in Nelson F. Freeburg’s reports, Formula Research (Memphis, TN: Formula Research, Inc.), 4745 Poplar Ave., Suite 307, 38117-4408. Material from this section was drawn from Vol. VI, nos. 10–11, December 2000 and August 2001. Also recommended is Steve Moore, “Playing the Seasonals,” Active Trader 1, no. 8 (November 2000). 11 Jay Kaeppel, “The Stock Market, the Calendar, and You,” Technical Analysis of Stocks & Commodities (December 2002).
480
TRADING SYSTEMS AND METHODS
TABLE 10.14 Merrill’s Holiday Results Period Tested
Holiday or Holiday Period
1897–1964 1897–1964 1897–1964 1897–1964 1931–1965 1931–1965
Day prior to all holidays Day after all holidays Thanksgiving to New Year July 4th to Labor Day Before Christmas Before New Year
% Upward Moves
67.9% 50.8 74 69 74 75
Norman Fosback12 confirmed Merrill’s results by studying the returns based on a strategy that bought two days prior to a major holiday and exited on the day prior to the holiday, rather than waiting until the day following the holiday. Fosback’s strategy yielded returns of 880% from 1928 through 1975 with 70% of the trades profitable, while holding long positions during the remaining days of the year would have lost 41%. Therefore, the net gains for the year were all associated with the few days prior to major holidays. In addition, the returns on holiday trading were accomplished by a risk exposure of only a few days each year. According to an updated study by Freeburg, the strategy used by Fosback is still profitable, but not as impressive. Freeburg also showed that the same strategy was profitable for U.S. 30-year Treasury bond futures as well as corporate bonds.
The Month-End Effect It seems sensible that if you are willing to take the opposite position to the crowd, there are profits to be made. One such strategy takes advantage of month-end liquidation. Perhaps some investors close out positions before the end of the month in order to realize profits or losses; this is even more likely to happen at the end of a quarter or the calendar year. This effect could be helped by large funds that may exit positions to balance redemptions. Merrill, Fosback, Kaeppel, and Freeburg all confirm the success of a strategy that buys on the last day of the month, or the second-to-the-last day, then exits the trade on the fourth trading day of the new month. That takes advantage of large-scale, month-end liquidation, followed by resetting positions. Freeburg confirmed that this strategy was still viable for both the S&P Index and bonds, although not as profitable as when these markets had limited participation up to 1975. A similar study, where patterns are shown for days of the month, including more recent years, can be found in Chapter 15 for a selection of futures markets.
The Hirsch Strategy One of the most popular of all seasonal strategies was the work of Yale Hirsch. He simply bought on the first day of November and sold on the last day of April, holding the position for six months.13 In addition to satisfying certain tax requirements, this avoided the 12 13
Norman G. Fosback, Stock Market Logic (Chicago: Dearborn Financial, 1998). Nelson Freeburg, see footnote 10.
Seasonality and Calendar Patterns
481
period most traders consider the summer doldrums. The Hirsch strategy would have avoided the spectacular October losses as well as the disaster of 9/11/2001 but benefited from the subsequent recovery. Hirsch had discovered that virtually all gains in the stock market took place during those six months. Hirsch’s original strategy reinvested dividend income during the six months when you were not in the market. That advantage has diminished, but leveraged investing can replace that loss. Using futures, exchange traded funds, or leveraged funds available through Rydex and ProFunds can make up the difference.
The January Effect Another price pattern may be seen in the action of the stock market during the month of January. There are many investors who are not as anxious to trade in and out of the market as professional managers and speculators. It is perfectly sensible to look for a pattern in the way many of the long-term investors set positions at the beginning of the year, the result of a reallocation of their portfolios, or resetting positions liquidated before the end of the year for tax reasons. If January is a leading indicator of stock market movement throughout the rest of the year, a combination of patterns should be considered based on the few days immediately after the year begins, and the net market direction for the month of January.14 Using the Dow Industrials as a stock market indicator, the January pattern was viewed from 1900 to 1989 in two parts, 1900–1937 and 1938–1989. The results are shown in Figure 10.31 for all years, 1900-1989, and Table 10.15 for the 52 years ending in 1989.
FIGURE10.31 Results of January patterns. Source:: Jay Kaeppel, “The January Barometer,” Technical Analysis of Stocks & Commoditiess (July 1990).
14
Jay Kaeppel, “The January Barometer: Myth and Reality,” Technical Analysis of Stocks & Commodities (July 1990).
482
TRADING SYSTEMS AND METHODS
TABLE 10.15 The January Barometer Patterns, 1938–1989 S&P 500 Pattern
During First 5 Days of the Year
By the End of January
Expectations for Feb–Dec
1
Declines
Further decline
Bearish
Declines
Less decline, but loss for the month
Bearish
Declines
Gain for the month
Bullish
2 3 4
Advances
Further gains
Bullish
Advances
Less gain, but gain for the month
Bullish
Advances
Loss for the month
Bearish
5 6
Figure 10.31 shows that the early part of the century had no significant pattern. There were nearly the same number of bullish and bearish indications resulting in a larger number of incorrect predictions. The past 52 years are very different, with a much larger number of correct moves. One should note, however, that the ratio of up to down moves is more than 7:1. During the past 10 years it is likely that this pattern would continue to be successful if the prognosis was a bull market. To offset the market bias, the patterns shown in Table 10.14 can be used. The direction of the first five days, confirmed by a continuation in that pattern for the balance of January, is then followed by the same pattern for the year. In the case where the market changes direction after the first five days and nets a loss for the month, the pattern takes on the new direction for the balance of the year. To bring the January pattern current to 2010, we used the monthly returns for the Dow previously used to create Figure 10.30. For the 12 years ending in 2010 there were 7 profitable years; that is, when January went up, then the rest of the year was up, and when January was down the rest of the year was lower. However, results were volatile, and the net was only 14 points. We can conclude that there is still a confirmation of the method, but it is very weak. Geopolitical events can overwhelm these patterns. McGinley’s January Indicator John McGinley can confirm that January is significant for setting the bullish tone of the following year, but not for a bear market.15 In his recent study, if each of the first five trading days of January are up, buy the S&P and hold for the entire year. If the end of January is up, then buy on February 1 and hold as well, although the end of January trade is not as good as the first five days. McGinley states that, if the first 5 days are up at least 4%, the year has always been up. If we look at the most recent year in which this happened, 2010, the S&P Index (SPX) 15
John R. McGinley, by email, January 2010. He is the editor of Technical Trends, a service that evaluates indicator accuracy. Contact John [emailprotected].
483
Seasonality and Calendar Patterns
TABLE 10.16 McGinley’s January Rule Dow Jones Industrial Average
Total Signals (since 1942) No signal years Correct signals Number wrong Percentage right Chi Squared (highly significant #) Years average was up Years average was down Percentage up
44 24 35 8* 81.4! 15.7 47 20 70
S&P 500
40 28 32 7† 82.1! 14.8 43 24 67
*1966, 1973, 1974, 1981, 1984, 1990, 2000, 2002 1948, 1966, 1973, 1990, 1994, 2002 #>10.93 = greater than 999/1,000 it is not random †1946,
would have been entered at 1144.98 and ended the year at 1257.80, a gain of 9.85%. The next year, 2011, did not qualify. His performance summary is shown in Table 10.16. A Chi-Squared reading this high (>10.93) indicates the odds are less than 0.01% that this pattern could occur by chance. Half of the 24 years with no Dow signal were down.
Risks of September and October It is easy to point out the spectacular events of September and October: The tragedy of September 11, 2001; Black Monday on October 28, 1929; and the market crash of October 19, 1987. However, these months have other negative attributes that are not as noticeable. Freeburg has found 17 ricochet rallies in October since 1950. He defines a ricochet rally as a price rise of at least 5% within 10 days as measured from the S&P monthly low. June ran a distant second place with only 10 rallies. Therefore, while October may hold the record for the most volatile price moves and the most risk, it also has great opportunity for timing an entry into a new position. While not as spectacular as October, September seems to capture consistency in underperformance in both recent years and throughout the past 100 years. Is this a remarkable coincidence, or is it likely to continue? The argument seems strong that investor behavior would continue; however, September can be a profitable month simply by chance without much effect on the probabilities.
COMMON SENSE AND SEASONALITY Most comprehensive works on seasonality include not only agricultural markets but currencies, interest rates, and indexes. Very little is available on stocks. Common sense tells us that the major agricultural products follow a clear seasonal pattern based on Nature. This calendar cycle also applies to coffee, cocoa, and oranges, although competition
484
TRADING SYSTEMS AND METHODS
from South America has limited the extreme moves that resulted from a freeze in Florida’s orange groves. But grain seasonality has been slowly changing as Brazil continues to improve its production of soybeans, Asian countries become a greater factor, and farmers build more on-site storage to take advantage of higher prices and the cost of carry. Cattle and hog prices, dependent upon the cost of feed, and still marketed more actively in the fall because of weather, show a strong seasonal trend even though they have a growth and feeding cycle that is not confined to a calendar year. Livestock patterns have adjusted to long-term competition from Australia and New Zealand. These agricultural markets are reasonable candidates for seasonal analysis, but may require careful study to identify shifting patterns in competition and storage. What about Treasury bonds or the Japanese yen? Should we look for seasonal patterns in the financial markets? We can argue that certain listed companies and even market sectors are highly dependent upon seasonal business. However, can we say that the demand for money is higher in the summer than in the winter? Or that enough tourists convert their currencies to yen when they visit Japan during the summer that they effectively drive the value of the yen consistently higher? Are automobile exports from Japan stronger or weaker during a certain season, so that there is a predictable pattern? These scenarios are highly unlikely, and we have no assurance that cars will be sold off with the coming of winter in the way that grain must be harvested. In financial markets, most players can choose their time to act; they can hedge their commitments or wait for a better opportunity. There are some stocks that clearly qualify for seasonality, such as airlines that service nonbusiness customers, resort hotels, cruise lines, perhaps even luggage manufacturers. Holiday goers tend to book in the spring for summer vacations. And it is possible that mortgages spike in the spring and are at lows in the winter simply because shoppers are not looking for houses when the weather is bad. The study of seasonality should be limited to those markets that depend on weather and seasons, on Mother Nature or consumer behavior, either directly or indirectly. If you find a pattern in a market that cannot be clearly explained by fundamentals, it is best to avoid it.
Being Too Specific about Targets Nature is not precise, so selecting an optimal day of the year to enter a long position is not likely to work. Small shifts in fundamentals, such as the building of additional storage, allow farmers to change their selling habits slightly. The right day to buy or sell in 1975 is not likely to be the right day this year. Even weekly data may be too specific. Seasonal patterns are best seen using monthly data. The most we might expect is to know that the seasonal high in corn usually occurs in July but sometimes in June or August; the harvest lows are likely in September but could be in October or November. We must first be aware of the big picture and then study how the specific pattern develops each year. There are other timing tools, such as overbought and oversold indicators, that can help narrow the moment of opportunity within an expected window of time. If not, averaging into a position is always safe.
CHAPTER 11
Cycle Analysis
T
he cycle is another basic element of price movement, along with the trend and seasonality, but as a mathematical problem it can be more difficult to evaluate and is often avoided. But there are many different types of cycles, from agricultural to presidential election, and many of them are simple to evaluate and can improve trading. Cycles come in many forms—seasonality, production startup and shutdown, inventory or stocks, behavioral, and even astronomical. Seasonality is a special case of a calendar or annual cycle. Seasonality was covered in the previous chapter, and its special features are not considered here. Some of the cycles are clearly periodic, having regular intervals between peaks and valleys; others are more uniform in their amplitude or height but irregular in period. The most definitive and regular cycle remains the seasonal, which is determined by periodic physical phenomena, the changing of the year. This chapter will discuss the major commodity and financial cycles that most likely result from business decisions, government programs, and long-term market characteristics and phenomena. Short-term cycles are usually attributed to behavior and will be covered in Chapter 15, Pattern Recognition. There are a few important ways to find the cycle, the most common being trigonometric curve fitting and Fourierr (spectral) analysis. Both will require a computer and will be explained in the following sections. John Ehlers introduced Maximum Entropy Spectral Analysis (MESA), which finds price cycles based on small amounts of data, at the same time avoiding some of the problems inherent in other methods. Examples of solutions will be included in the explanation of the methods and applications that follows. Computer programs that solve the trigonometric problems can be found on the Companion Website as well as in Appendix 3, along with additional examples. Commercial software examples will also be used to show the classic solutions.
CYCLE BASICS The cycle, along with the trend and seasonality, comprise the three orderly components of price movement. The fourth is noise, which includes everything not accounted for in 485
486
TRADING SYSTEMS AND METHODS
the first three. To find any one component, we must remove the others. In earlier chapters we found that we can eliminate the trend by taking the first differences of the data; that is, subtracting the previous value from the current value. In the previous chapter on seasonality, we used the simple technique of subtracting a 1-year moving average (a 12-period average applied to monthly data) from the original price series to remove the seasonal pattern. Alternatively, statistical software will subtract this month’s average price from that of 12 months ago, or today’s daily price from that of 252 days ago in order to detrend the data. By finding the first differences and then subtracting the 1-year average, or by removing the 1-year differences, we are left with the cycle and the unaccountable price movement, which we call noise. Even when the seasonal pattern is eliminated, most cycles are still based on the periodic effects in our Universe. After the 1-year orbit of our planet around the Sun, there is the 28-day lunar cycle; converted to business days, this gives the very familiar 20-day reference that remains overwhelmingly popular among all analysts (also corresponding to four weeks). Other planetary effects, which should by no means be discarded off-hand, can be found in Chapter 14 under the topic “Financial Astrology.” The possibility cannot be eliminated that planetary motion may account for, besides seasonality, the effects of mass behavior, which can produce a consistent cycle that repeats with a fixed period.1 Cycles can be complex and difficult to see because there is often a combination of larger and smaller patterns, and cycles within cycles, all acting at the same time. Nevertheless, they exist, and they are real. The cycles that appear to be most important are either long-term or the sum of a number of subcycles that come together at peaks or valleys. This gives us a way to identify one point on a cycle; we must remember that, when the individual components are found, there may be a number of smaller patterns that cause this effect. Thinking about it as harmonics, just as in music, means that a smaller cycle is a fraction of the larger cycle, for example, its cycle length is ½, ½, ¼, . . . of the larger. When two cycles are synchronized, their peaks or valleys occur at the same time. Any price series can be decomposed into individual cycles, and represented as the sum of multiple cycles.
Observing the Cycle Before selecting a market for cycle analysis, it is necessary to observe that a dominant cycle exists; it is also useful to know why it exists in order to avoid uncovering spurious patterns. This is most easily done for markets in which you can clearly identify the fundamental or industrial reasons for cycles. The basis for a cycle could be a pattern of holding inventory, the fixed time needed for breeding and feeding of livestock, seasonality, the time necessary for closing a mining operation then starting it up again, expansion or contraction of business based on disposable income, the effects of government interest rate policy, or other economic factors.
1
See the section “The Moon,” in Chapter 14.
Cycle Analysis
487
The Cattle Cycle Using cattle as an example, Figure 11.1a shows a clear 9- to 11-month cycle in futures prices2 over a 6-year period from 1980 through 1985. The peaks and valleys vary by up to one month, making the pattern reliable for use as part of a long-term trading strategy. Although feedlots in the Southwest have made the supply of cattle more evenly distributed throughout the year, there are still a large number of ranchers in the North who send their cattle to market in the early fall to avoid the difficulties of feeding during a harsh winter. This causes generally lower prices in the Fall and higher prices in the mid-Winter when supplies are low. A similar pattern can be seen more recently in Figure 11.1b. During the past six years the peaks of the cycle are consistently 12 months apart, although the valleys are not as consistent, most often coming within a few months after the peaks. The overall picture shows that cattle prices continue to have a clear cycle, driven by the fundamentals of production. The Swiss Franc Cycle The Swiss franc cycle (denominated as Swiss francs/U.S. dollars on Chicago’s International Monetary Market) shown in Figure 11.2a is quite different.3 There are two likely cycles: the primary one (shown using letters at the peaks and valleys) and a subcycle (marked with numbers). The subcycle ranges from 24 to 35 weeks with a 40% variance compared to 20% for cattle. Most important, the cycle in the Swiss franc cannot be attributed to any specific fundamental cause. There is certainly a long-term cycle based on the strength and weakness of the U.S. economy with respect to the Swiss economy, or the relative attractiveness of U.S. interest rates. There is also the general ebb and flow of the U.S. trade balance and, of course, investor behavior. Unlike cattle, these patterns do not need to be rigid. Looking at Swiss franc prices from 1997 through 2002 there are obvious peaks and valleys that continue a cyclic pattern (see Figure 11.2b). Although they are crisp in appearance, the cycle now has an average period of about 38 weeks with a range from 30 to 52 weeks. The new cycle falls about midway between the periods of the previous primary and subcycles. Although the cycles seem clear, the change in period and the variance between cycle tops will make a systematic strategy difficult.
Basic Cycle Identification A simple way to begin the search for major cycles is to look at a long-term chart, displayed as weekly rather than daily prices. The dominant half-cycle can be found by locating the obvious price peaks and valleys, then averaging the distance between them. A convenient tool for estimating the cycle length is the Ehrlich Cycle Finder.4 Developed in 2 Jacob
Bernstein, “Cycle and Seasonal Price Tendencies in Meat and Livestock Markets,” in Todd Lofton, ed., Trading Tactics (Chicago: Chicago Mercantile Exchange, 1986). 3 Jacob Bernstein, The Handbook of Commodity Cycles (New York: John Wiley & Sons, 1982). 4 More information and a cycle-finding tool can be found on www.stanehrlich.com.
488
TRADING SYSTEMS AND METHODS
(a)
11 mo
10 mo
11 mo
11 mo
13 mo
11 mo
(b)
9 mo
10 mo
12 mo
12 mo
12 mo
10 mo
FIGURE 11.1 (a) 9- to 11-Month cycle in live cattle, 1980–1985 futures prices. (b) The cattle cycle, 1997–2002.
1978, it is an expanding device with evenly spaced points, allowing you to align the peaks and valleys and to observe the consistency in the cycle. For finding a single pattern, it is just as good as some of the mathematical methods that follow. It is best to have at least eight cycle repetitions before concluding that you have a valid cycle. Cycles can be obscured by other price patterns or market noise. Strong trends, such as the ones in Swiss francs (Figure 11.2a) or the seasonal movement of crops, may overwhelm a less pronounced cycle. Classic cycle identification requires that these noncycle factors first be removed by detrending and then by deseasonalizing. The resulting data will then be analyzed and the trend and seasonal factors added
489
Cycle Analysis
(a)
B
33
33
A
28
D
E
35
27
C
26
E
24 G
(b)
41
52
33
26
30
39
FIGURE 11.2 (a) Cycle in Swiss franc futures, 1975–1979. The lettered peaks and valleys show the choice for a primary cycle; the numbered peaks and valleys show a likely subcycle. (b) Cycle in Swiss franc futures, 1997–2002.
490
TRADING SYSTEMS AND METHODS
back once the cycle has been found. To find a subcycle, the primary cycle should be removed and a second cycle analysis performed on the data. This can be a tedious process. In order to bypass these steps, the methods that follow (trigonometric regression and spectral analysis) can locate the dominant cycle and subcycles at one time using an integrated process.
The Business Cycle The global business cycle, as distinguished from industry cycles, is the result of macroeconomic events, such as recessions, inflation, and government economic policy. Figure 11.3, a product of the Princeton Economic Institute, shows that this cycle is about 8.6 years, or about 4 years from top to bottom in each cycle. Although this chart dates from 1997, it seems remarkably accurate in capturing the tech bubble that ended in 2000, the downturn that followed, ending in 2003, the rally preceding the 2008 subprime crisis, and the extreme fall of the market and the economy afterward. It shows the bottom of this cycle in 2011, which we all hope is true.
The Kondratieff Wave Much of the popularity of cycles is due to the publicity of Nicolai Kondratieff’s 54-year cycle, known as the K-wave, or more recently, the long wave. During its documented span from about 1780 to the present, it appears to be very regular, moving from highs to lows and back again. In Figure 11.4 the Kondratieff wave is shown with major events
1989.95
1987.8
1992.1
1988.875 1991.025 5
1985.65
Feb 28 2007 2007.15
1998.95
1996.4
Jan 3 2005 2005
2000.7
1997.475 1999.625
1994.25
2009.3
2005.075 2008.225
2002.85 Nov 6 2002
2015.75
2013.60
2017.90
2014.68 2016.83
2011.45
2020.05
FIGURE 11.3 The 8.6-year business cycle. Source:: The Princeton Economic Institute, available on www.financialsense.com.
Cycle Analysis
491
FIGURE 11.4 The Kondradieff Wave. Source:: Walker, Jeff, "What K-wave?" Technical Analysis of Stocks & Commodities (July 1990).
(particularly wars) that have contributed to its pattern.5 With only three full cycles completed, it is difficult to tell if the overall trend is moving upwards, or whether the entire pattern is just a coincidence. The forecast of the K K-wave, shown in Figure 11.4, corresponds to a sharp decline in wholesale prices due at about the year 1990, the millennium’s equivalent to the depression of the 1930s. In fact, the 1990s posted remarkable gains in the stock market, peaking at the beginning of 2000. According to the chart pattern, this peak should be followed by 10 to 20 years of downturn in the economy, in which case we are in the middle, having experienced a major correction in 2008. It should be noted that the peaks of the four waves are of different duration, 1870 being the shortest and the recent one in 2000 the longest. Although we all accept the existence of an economic cycle, pinpointing the peaks and valleys is impractical. Even if the 54-year period varied only by 10%, we could be entering an investment position 5 years too soon or too late. Determining long-term cycles for any market has the same problem—the actual price pattern will never correspond exactly to the predicted peaks and valleys that most often come at regular intervals. Fortunately, there are other choices. Shorter-term cycles do not need to have the same constant period, and the way in which cycles interact with other strategy components will make them more flexible. However, some investors will want to keep this big picture
5
Jeff Walker, “What K-Wave?” Technical Analysis of Stocks & Commodities (July 1990).
492
TRADING SYSTEMS AND METHODS
concept, both the business cycle and the Kondratieff wave, as a general guide to investment timing.
Presidential Election Cycle Of all the events that move the market, the presidential elections have been the most consistent. The patterns stem from the motivation of the incumbent party to provide good economic news to the voters prior to the election year, and as far into the election year as possible. Stock market action during the election year is always more erratic, as parties battle over the value of each other’s actions. Typically, the year preceding the election (year 3 in the president’s term) posts the strongest gains for the market, followed by a reasonably strong election year. (See Table11.1.) Some analysts have been more specific by starting on October 1 of the previous year. The two years after the election show returns below average as the reality of politics reasserts itself and the new administration tries to implement campaign promises that turn out to be unpopular. More recently, it is only in the first year that the president can push for serious reform. Beginning in the second year, the mid-term elections of members of Congress become more important. There is the additional possibility that there is an eight-year cycle that should be watched;6 however, the eight-year period should be most informative if it represented only those years in which the same president was in office. Actions by a president who cannot be reelected are likely to be different from one who seeks another term; therefore, we should expect a different pattern. This can be made more intricate by studying the patterns preceding and following a change of party, all of which have a fundamental basis in the behavior of the political parties and the voters.
TABLE 11.1 The Presidential Election Cycle, 1912–1992, Based on the Percentage Returns of the Dow Jones Industrial Averages Pre-election year Election year Post-election year Mid-term year Average year
11.0% 7.0 4.7 2.3 6.3%
Source: Adam White.
6 Articles
by Adam White, “The Eight-Year Presidential Election Pattern,” Technical Analysis of Stocks & Commodities (November 1994); Arthur Merrill, “The Presidential Election Cycle,” Technical Analysis of Stocks & Commodities (March 1992); and Michael J. Carr, “Get out the Vote and into Stocks,” Futures (February 1996), all show very similar results for the four-year election pattern.
493
Cycle Analysis
TABLE 11.2 Election Year Analysis for Years in Which the Stock Market Began the Year within 8% of the Previous 2-Year Highs
Year
1936 1944 1952 1956 1960 1964 1968 1972 1980 1984 1992 Average
1. Previous Year
2. First 2 weeks (1–10)
3. Primaries (10–83)
4. Preconvention (83–161)
5. Preelection (161–195)
6. Election to year-end (195–253)
7. (2) + (4) + (6)
41.82 19.45 16.15 27.25 8.48 18.89 20.03 10.82 12.31 17.53 26.30 19.91
2.76 1.63 1.60 −1.78 −2.49 1.79 0.26 1.41 2.26 1.27 0.80 0.86
4.64 −0.84 −2.82 5.42 −5.75 4.44 −0.10 3.39 −5.42 −5.01 −2.72 −0.44
11.91 9.27 8.02 3.16 2.94 3.03 1.44 5.30 18.57 4.27 2.14 6.37
−0.62 −0.86 −2.49 −6.65 −7.13 2.52 4.39 −1.78 −0.20 0.41 −0.23 −1.15
5.85 3.14 5.47 2.38 8.49 0.06 4.25 4.88 7.66 0.63 5.87 4.43
20.52 14.04 15.10 3.76 8.95 4.88 5.95 11.59 28.49 6.17 8.82 11.66
Source:: Michael Carr, Logical Information Machines.
More sophisticated computer software, such as that provided by Logical Information Machines,7 a Chicago firm, can produce a very interesting, closer view of how voters respond to election politics. Table 11.2 breaks the election year into seven periods between the key events for those years in which the stock market began the election year within 8% of its 2-year high price (days refer to business days): 1. The returns of the year preceding the election year. 2. The first 10 days of the new year, typically a strong period (days 0–10). 3. Through the State of the Union address and the primaries (days 10–83). 4. Waiting for the conventions (days 83–161). 5. Preelection blahs: the actual campaign (days 161–195). 6. The election to year-end reaction (days 195–253). 7. Combined periods (2) + (4) + (6).
Combining the three periods (2), (4), and (6), which have strong upward biases, gives consistently positive results. Even if the newly elected party fails to deliver on its campaign promises, traders could have already converted those marketing gimmicks into stock market profits.
7
See www.lim.com.
494
TRADING SYSTEMS AND METHODS
TABLE 11.3
Updated Presidential Election Cycle Based on S&P Futures
Cycle
S&P Total Returns
Preelection Election 1st year 2nd year
16.4 69.5 (30.0) 48.3
Presidential Cycle from 1983 to 2010 In our rapidly changing world, it is always interesting to see if the market reality continues to support expectations. In fact, using the S&P futures and calculating the year-end returns, the results (in Table 11.3) confirm our new expectations of the presidential cycle. There are moderately good returns in the preelection year, but excellent returns in the year of the election as all candidates and parties promise whatever is necessary to get elected. Reality follows in the first year of office, when the president attempts to fulfill campaign promises but also takes this one opportunity for economic reforms that are likely to be unpopular, such as budget reductions and tax increases. A better year follows ahead of the mid-term elections, which have become a more important political event than in the past.8
UNCOVERING THE CYCLE Before resorting to the highly mathematical methods for finding cycles, there are some simple approaches that may serve many traders. For example, if you believe that the dominant cycle has a 20-day period, then you simply create a new price series by subtracting the current data from a 20-day moving average. This removes the trend that may obscure the cycle. This is the same method used for removing seasonality, which subtracted the values of a one-year trend from the corresponding prices. Alternatively, you can take the 20-day differences (p ( t – pt–20), which effectively removes the 20-day trend. Most oscillators, such as a stochastic or RSI, can also serve to identify a price cycle; however, if you want to see the peaks and valleys of a 20-day cycle, you will need to use a calculation period for the oscillators that is no more than 10 days.
Removing the Trend The cycle can become more obvious by removing the price trend. While we traditionally only use one trendline to do this, the use of two trendlines seems to work very well in 8 Gerald Appel states, “There is a clear election-year cycle, where the election year is +10%, year after +4.5%, 2 years before next −1.25%, and the year before +20%.” Technical Analysis: Power Tool for Active Traders (Upper Saddle River, NJ: FT Prentice Hall, 2005), 94.
495
Cycle Analysis
most cases.9 First smooth the data using two exponential moving averages, where the longer average is half the period of the dominant cycle (using your best guess), and the shorter one is half the period of the longer one. Then create an MACD indicator by subtracting the value of one exponential trend from the other; the resulting synthetic series reduces the lag inherent in most methods while removing the trend. Using Triangular Weighting One method for enhancing the cycle is the use of triangular weighting instead of exponential smoothing. The weighting is triangular because it creates a set of weighting factors that are smallest at the ends and largest in the middle, and typically symmetric. You must first decide the calculation period and the weighting factor for the center price. For practical purposes, it is only necessary to give the center price the weight of 2.0. Because there needs to be a center price, the triangular weighting method will eliminate the oldest price if the calculation period is an even number. The weighting factors begin with the value 2.0/(P (P/2), and increase by the same value. If the calculation period P = 10, the weighting begins at t − P + 2, or t − 8, eliminating the oldest value in order to have an odd number of prices. The weighting factors, wi, are then 0.4, 0.8, 1.2, 1.6, 2.0, 1.6, 1.2, 0.8, and 0.4. The triangular average is TMAt = (w1 × Pt−P −P+2 × w2 × Pt−P −P+3 + . . . + wP− P 1 × Pt) / P Enhancing the cycle requires that you calculate two triangular averages, one of which is half the period of the other, then take the difference of the two. The smooth curve of the triangular MACD in Figure 11.5 shows the enhanced cyclic pattern of IBM
FIGURE 11.5 9 In
A 20-10 triangular MACD applied to IBM.
his article “Finding Cycles in Time Series Data,” Technical Analysis of Stocks & Commodities (August 1990), A. Bruce Johnson credits John Ehlers for his work in the use of two exponential trends. See John Ehlers, “Moving Averages, Part 1” and “Moving Averages, Part 2,” Technical Analysis of Stocks & Commodities (1988).
496
TRADING SYSTEMS AND METHODS
FIGURE 11.6 A 252-126 triangular MACD applied to back-adjusted corn futures.
(shown for one year) based on 63 days (about the number of days in a calendar quarter) under the assumption that cycles are likely to be related to periodic earnings releases. Figure 11.6 uses a full year, 252 days, as the primary cycle, with back-adjusted corn prices covering more than five years. While this method creates a smooth representation of cyclic movement, it has the characteristics of a momentum indicator because the peaks and valleys are not quite evenly spaced and the amplitude of the cycles varies considerably. However, the smoothness of the indicator allows you to anticipate the major changes in the direction of prices. A program, TSM Triangular MACD, is available on the Companion Website.
Terminology Before getting technical about the measurement and calculation of cycles, there are a few terms that describe most of the concepts discussed throughout this chapter. Note that the use of wave and cycle are interchangable. Cycle or wave. A recurring process that returns to its original state. Amplitude (a). The height of the wave from its horizontal midpoint (the x-axis). Period (T). T The number of time units necessary to complete one wavelength (cycle). Frequency (ω). The number of wavelengths that repeat every 360°, calculated as ω = 1/T. T Phase. A measurement of the starting point or offset of the cycle relative to a benchmark wave. Phase angle. Locates the position within the cycle measured as the minute hand of a clock moving clockwise, where 0° is three o’clock. Left and right translation. The tendency for a cycle peak to fall to the left or right of the center of the cycle.
497
Cycle Analysis
Trigonometric Price Analysis Although there is statistical software that can find the cycle period with little trouble, some analysts still find it useful to know just how it can be done. Cycles can be found using the trigonometric functions sine and cosine. These functions result in what are called periodic waves because they repeat every 360° or 2 π (2 pi) radians, where π = 3.141592. Because radians can be converted to degrees using the relationship 1 degree =
2π 360
all the work that follows will be in degrees. A simple sine wave fluctuates back and forth from +1 to −1 (0, +1, 0, −1, 0) for each cycle (one wavelength) as the degrees increase from 0° to 360° (see Figure 11.7). To relate the wavelength to a specific distance in boxes (or days, on graph paper), simply divide 360° by the number of boxes in a full wavelength, resulting in the box size (in degrees). For example, a 100-box cycle would give a value of 3.6° to each box or day. The wavelength can be changed to something other than 360° by using the frequency, ω, as a multiplier of the angle of the sine wave, ϕ, sin ω ϕ If ω > 1, the frequency increases and the wavelength shortens to less than 360°; if ω < 1, the frequency decreases and the wavelength increases. Because ω is the frequency, it gives the number of wavelengths in each 360° cycle. To change the phase of the wave (the starting point), the value b is added to the angle sin (ω ϕ + b)
FIGURE 11.7
Sinusoidal (sine) wave.
498
TRADING SYSTEMS AND METHODS
FIGURE 11.8 Compound sine wave.
If b is 180°, the sine wave will start in the second half of the cycle; the phase value b serves to shift the wave to the left. The amplitude can be changed by multiplying the resulting value by a constant a. Because the sine value ranges from +1 to −1, the new range will be +a to −a (Figure 11.8). This is written a sin(ω ϕ + b). There are few examples of price movement that can be represented by a single wave; therefore, two sine waves (or more) must be added together to form a compound wave: y = a1 sin (ω1ϕ + b1) + a2 sin (ω2ϕ + b2) Each set of characteristic variables, a1, ω1, b1, and a2, ω2, b2, can be different, but both waves are measured at the same point ϕ at the same time. Consider an example that lets the phase constants b1 and b2 be zero. Then y1 = 3 sin 4ϕ y2 = 5 sin 6ϕ y = y1 + y2 Figure 11.8 shows the individual regular waves y1 and y2, and the compound wave y over the interval 0° to 180°. Note that both y1 and y2 began the normal upward cycle at 0°; by 180°, however, they are perfectly out of phase. During the next 180°, the two waves come back into phase. When combining periodic waves, it is useful to know the maximum and minimum amplitude of the resulting wave. Because the peaks of the two elementary waves do not necessarily fall at the same point, the maximum amplitude of either wave may not be reached. A mathematical technique called differentiation is used to find the maximum
499
Cycle Analysis
and minimum amplitudes. The first derivative, with respect to angle ϕ, is written dy/ y/dϕ or y′, where y is the formula to be differentiated. The rules are: d d (sin φ ) cos φ ; (cos φ ) (cos sin i φ dφ dφ d (sin ωφ ) cos c ωφ dφ d (sin ( φ b)) c ( φ b) dφ d ( a1 si ( 1φ b1 ) + a2 in (ω 2 b2 )) dφ = a1
1
s(ω 1 + b1 ) + a2
2
c (ω 2 + b2 )
Applying this method to the previous example, y = 3 n 4φ + 6 s 5φ dy = y ′ = 12 cos 4φ + 20 20 c dφ
5φ
The points of maximum and/or minimum value occur when y′ = 0. For y1′ = 12 cos 4φ , the maxima and minima occur when 4ϕ = 90° and 270 (ϕ = 22½° and 67½°) (Figure 11.8). For y2′ = 30 cos 5φ , the maximum and minimum values occur at 5ϕ = 90° and 270° (ϕ = 18° and 54°). It must be pointed out that the first derivative identifies the location of the extreme highs and lows, but does not tell which one is the maximum and which is the minimum. The second derivative, y′′, calculated by taking the derivative of y′, is used for this purpose: Iff y′(x) = 0 and y′′(x) > 0, then y(x) is a minimum. Iff y′(x) = 0 and y′′(x) < 0, then y(x) is a maximum. Then, y1 = 22½° and y2 = 18° are maxima and y1 = 67½° and y2 = 54° are minima. Anyone interested in pursuing the analysis of extrema will find more complete discussions in a text on calculus. Rather than concentrating on these theoretical aspects of curves,10 consider a practical example of finding a cycle in the price of scrap copper, shown in Table 11.4 and charted in Figure 11.9. The price peaks seem evenly spaced, occurring at mid-1966, January 1970, and January 1974, about four years apart. The solutions to these problems are tedious; therefore, calculations will be performed using the Fortran programs, TSM Single Frequency Trigonometric Regression and TSM 2-Frequency Trigonometric Regression, given on the Companion Website. These can be easily adapted to any programming language. 10 A more detailed presentation of trigonometric curve fitting can be found in Claud Cleeton, The Art of Independent Investing (Upper Saddle River, NJ: Prentice-Hall, 1976), Chapter 8. The material covered in this section is carried further in that work.
500
TRADING SYSTEMS AND METHODS
TABLE 11.4 Dealer’s Buying Price, No. 2 Heavy Copper Scrap at New York* Average Quarterly Price (cents per pound) Year
1st
2nd
3rd
4th
1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979
22.12 23.18 28.23 46.22 36.51 39.75 38.94 47.70 25.40 32.74 36.82 66.56 32.06 38.22 37.08 35.07 51.12
22.46 24.56 33.77 51.48 29.30 30.07 42.95 46.98 29.45 33.53 45.07 70.06 31.46 43.24 38.72 40.23 63.71
22.17 25.57 35.90 40.76 30.36 29.08 43.38 35.78 27.15 30.01 55.13 47.30 35.75 45.46 34.01 41.63 59.56
22.00 30.59 40.05 40.16 36.42 32.13 46.23 27.35 28.48 29.25 65.51 35.62 36.46 38.96 33.00 44.95 63.38
*Based on prices from the American Metal Market.
The results obtained by using actual copper prices will not be as clear as using fictitious data. It is important to be able to understand the significance of practical results and apply them effectively. Older data is used under the assumption that business and economic cycles were clearer before globalization and geopolitical crises.
FIGURE 11.9 Copper prices 1963–1979.
501
Cycle Analysis
Because trigonometric curves fluctuate above and below a horizontal line of value zero, the first step is to detrend the data using the least-squares method. This results in the equation for a straight line representing the upward bias of the data. The value of the regression line is then subtracted from the original data to produce copper prices that vary equally above and below the line from positive to negative values. The straight line y = a + bx, which best represents the trend, can be found by solving the least-squares equations (also see Chapter 6): n ∑ xy xy − ∑ x ∑ y n ∑ x 2 − ( ∑ x )2 1 a = (∑ y − b ∑ x ) N b=
To do this, let x be the date and y be the price on that date. For convenience, instead of letting x = 1967, 1967¼, 1967½, . . . , let x = 1, 2, 3, . . . . The solution, using the program on the Companion Website (or the hand-calculation method in Chapter 6, is y = 28.89 + 0.267x 7 Figure 11.9 shows the original copper prices and the regression line. The original prices can now be detrended using the equation above, subtracting the line values from the corresponding prices. Complete step-by-step results for this example can be found with the programs on the Companion Website. The detrended data is now used in the general trigonometric single-frequency wave: yt = a cos ωt + b sin ωt The variable t replaces ϕ in order to consider the angle in integer units rather than in degrees. This will be more convenient to visualize and to chart. To find the frequency ω, it is necessary to first solve the equation cos ω
1 2
α =0
using the system of equations,
α y2 = y1 + y3 α y3 = y2 + y4 α yn
= yn − 2 + yn
This is expressed as a summation (similar to least-squares) in which the values for c and d must be found:
where c = yn d = yn−1 + yn+1
α Σ c2 = Σ cd
502
TRADING SYSTEMS AND METHODS
Summing the detrended values c2 and cd gives Σc2 = 6338.4 and Σcd = 9282.2, resulting in α = 1.464. The value for α is substituted into the intermediate equation and solved for the frequency ω : cos
1 2
(1.464) (1 464) 0 cos ω = 0.732
ω = 42.9 The period T is 360/42.9 = 8.4 calendar quarters. The last step in solving the equation for a single frequency is to write the normal equations: aΣ cos2 ωt + bΣΣ cos ωt sin ωt = Σyt cos ωt aΣ sin ωt cos ωt + bΣ sin2 ωt = Σyt sin ωt and solve for a and b, where t = 1, . . . , 40, and ω = 42.9. As in the other solutions, a computer program is best for finding the sums (using detrended data) necessary to solve the equations. The sums are aΣ cos2 ωt
Σ sin ωt cos ωt Σ sin2 ωt
Σyt cos ωt
Σyt sin ωt
Then, a and b can be found by substituting in the following equations:
∑y ∑ sin ∑y a= b=
i
t
t
2
t∑ cos 2 ωt
t∑
2
t
ωt −∑ cos ωt si ωt
t b∑
∑ cos
∑ y cos ωt
2
ωt sin ωt ωt
The results a = −0.603 and b = 1.831 give the single-frequency curve as: yt = −0.603 cos 42.9t + 1.831 sin 42.1t Taking t = 1 to be 1967 and t = 68 to be 1979 ¾ and adding back the trend, the resulting periodic curve is shown in Figure 11.10. The single-frequency curve shown in Figure 11.10 matches seven out of the eight peaks in copper; however, it is not much more than could have been done using the Ehrlich Cycle Finder. A single-frequency curve can be created simply by identifying the most dominant peaks, averaging the distance (period), and applying the single-frequency formula.
2-Frequency Trigonometric Regression The combination of more than one set of sine and cosine waves of varying amplitudes and frequencies creates a better fit than a single-frequency solution. This is analogous to
503
Cycle Analysis
FIGURE 11.10 Copper prices 1963–1979 with single frequency copper cycle manually scaled to approximate amplitude.
the use of a second-order (curvilinear) solution instead of the first-order linear. The equation for the 2-frequency cycle is yt = a1 cos ω1t + b1 sin ω1t + a2 cos ω2t + b2 sin ω2t To find the results of this complex wave, apply the same techniques used in the singlefrequency approach to the detrended copper data. The algebra for solving this problem is an expanded form of the previous solution, and the use of a computer is a requirement (available on the Companion Website and described in Appendix 3). The frequencies ω1 and ω2 are found by solving the quadratic equation: 2x2 − α1x − (1 + α2 / 2) 2 =0 where x = cos ω, using the standard formula: x=
α 1 ± α 12 + 8(1 + α 2 / 2) 4
The same least-squares method as before can be used, derived from the general form: α1 (yn + yn+22) + α2yn+1 = yn−1 + yn+3 The least-square equations for finding α1 and α2 are: α1Σ c2 + α2Σ cd = Σ cp α1Σ cd + α2Σ c2 = Σ dp
504
TRADING SYSTEMS AND METHODS
where c = yn + yn+2 d = yn+1 p = yn−1 + yn+3 These equations can be solved for α1 and α2 using: ∑ p ∑ c 2 − ∑ cp ∑ cd ∑ 2 ∑ c 2 − ( ∑ cd )2 ∑ p − α 2 ∑ cd α1 = ∑ c2
α2 =
Then, ω1 and ω2 are calculated from the two solutions x1 and x2 of the quadratic equation. The next step is to solve the normal equations to find the amplitudes a1, b1, a2, and b2: a1Σ cos2ω1t + b1Σ cos ω1t sin ω1t + a2Σ cos ω1t cos ω2t + b2Σ cos ω1t sin ω2t = Σ yt cos ω1t a1Σ sin ω1t cos ω1t + b1Σ sin2 ω1t + a2Σ sin ω1t cos ω2t + b2Σ sin ω1t sin ω2t = Σ yt sin ω1t a1Σ cos ω2t cos ω1t + b1Σ cos ω2t sin ω1t + a2Σ cos2 ω2t + b2Σ cos ω2t sin ω2t = Σ yt cos ω2t a1Σ sin ω2t cos ω1t + b1Σ sin ω2t sin ω1t + a2Σ sin ω2t cos ω2t + b2Σ sin2 ω2t = Σ yt sin ω2t Once the sums are obtained, the final step is to create a 4 × 5 matrix to solve the four normal equations for the coefficients a1, b1, a2, and b2. When plotting the answer, it will be best to plot the original 2-frequency equation in its component forms as well as in combination: yt′ = a1 cos ω1t b1 sin sin i ω1 t yt′′= a2 cos ω2 t b2 sin sin i ω2 t yt
yt′ + yt′′
where a1 = 3.635 b1 = −0.317 a2 = −0.930 b2 = 0.762 The solution to the 2-frequency problem gives the following values:
α1 = 0.535,
x1 = 0.830
α2 = 0.133,
x2 = −0.764
and
505
Cycle Analysis
FIGURE 11.11 Two-frequency trigonometric approximation.
and finally the frequencies:
ω 1 = 33.9
and
ω 2 = 139.8
correspond to 10.6 and 2.6 calendar quarters (Figure 11.11).
Fourier Analysis: Complex Trigonometric Regression Developed by the French mathematician Jean Baptiste Joseph Fourier, Fourier analysis is a method of complex trigonometric regression, which expresses any data series as a series of sine and cosine waves of the same type as discussed in the previous section. It should be understood that Fourier analysis, or the more popular and efficient Fast Fourier Transform (FFT ( T), is not reliable unless the data is stationary, that is, it does not change in a disorderly way over time. Agricultural products are most likely to be candidates for this method, but stocks that have changed in price and changed in structure (such as those with new acquisitions that offer diversification), would not be candidates. In this section FFT will be applied to both corn, to see if the results are similar to the seasonality results from the previous chapter, and Southwest Airlines, which represents a company dependent on seasonal travel and without diversification. For best results,
506
TRADING SYSTEMS AND METHODS
it may be necessary to remove the rate of inflation or the USD exchange rate from the series to make it stable. Basic Fourier Calculations Assuming that there is a cycle and that there are N data points in each repetition of this cycle, the Fourier method of analysis shows that the N points lie on the regression curve: yi
( N / 2)
⎛
k=1
⎝
∑
1
uk cos
2π ki 2π ki ⎞ + vk sin i ⎟ ( N / 2) ( N / 2) ⎠
where the regression coefficients uk and vk are given by: N
1 uk = N ( / 2)
∑y cos (2Nπ/ki2) , k
1,2, ,
N 2
1 ( N / 2)
∑y sin (2Nπ/ki2) , k
1,2, ,
N 2
vk =
vN / 2 = 0
i
i =1 N
i
i =1
It is important to see that the mean of all the points on one cycle is equal to the value1. The N values of yi will have the property N
∑y
i
N
i =1
Applying the Fourier series to the seasonal component will help clarify this method. Seasonal data form the most obvious cycle. Using average monthly prices, detrend the data to avoid letting the trend overwhelm the cycle, letting N = 12. It is also known that seasonally adjusted prices will vary about the mean; hence the weighting factors will have the same property as the above equation. With this information, the trigonometric curve that approximates the seasonality can be generated and compared with the results of other methods.11 Excel provides Fourier analysis as an analytic add-in under Tools/Data Analysis. Instructions and examples will follow in the section “Using Excel’s Fourier Analysis.” Spectral Analysis Derived from the word spectrum, spectral analysis is a statistical procedure that isolates and measures the cycles within a data series. The specific technique used is the Fourier series as previously discussed, although other series can be used. 11 A
continuation of this development can be found in Warren Gilchrist, Statistical Forecasting (London: John Wiley & Sons, 1976), 139–148; a more theoretical approach is to be found in C. Chatfield, The Analysis of a Time Series: Theory and Practice (London: Chapman and Hall, 1975), Chapter 7.
Cycle Analysis
507
When studying the cycles that comprise a data series, it is important to refer to their phase with respect to each other. Phase is the relationship of the starting points of different cycles. For example, if one cycle has the same period as another but its peaks and valleys are exactly opposite, it is 180° out of phase. If the two cycles are identical in phase, they are coincident. Cycles with the same period may lead or lag the other by being out of phase to various degrees. A tool used in spectral analysis to visualize the relative significance of a series’ cyclic components is the periodogram. Weighting the cyclic components in the periodogram will yield the more popular spectral density diagram, which will be used to illustrate the results of the spectral analysis. Density refers to the frequency of occurrence. Figures 11.12a and 11.12b show the spectral density of a series composed of three simple waves (D ( is the Fourier series made up of waves A, B, and C). C 12 The cycle length, shown at the bottom of the spectral density chart, corresponds exactly to the cycle length of the component waves A, B, and C. The spectral density, measured along the left side of Figure 11.12b, varies with the amplitude squared of the cycle and the magnitude of the noise, as well as random price movements, which tends obscures the cycle. In Figure 11.12b, the result is based on a series composed of only three pure waves. Had there been noise, of the same magnitude as the underlying cycle amplitude, those cycles identified by the spectral analysis would have been completely obscured. Readers who have studied ARIMA will recognize the similarity between the spectral density and the correlogram. As in trigonometric regression analysis, the other basic price components can distort the results. A noticeable trend in the data must be removed, or it may be interpreted as the dominant cycle. The familiar methods of first differencing or linear regression can be used to accomplish this. The seasonal component is itself a cycle and does not need to be removed from the series. Because spectral analysis identifies both the seasonal and cyclic component, the success of the results will depend on the strength of these waves compared to the noise that remains. In applying this technique to real data, it would not be surprising to see the results demonstrated in Figure 11.13. Three subcycles of length 10, 20, and 40 days are shown as part of a 250-day (seasonal) cycle. Notice that, as the cycle lengthens, the width of the spectral density representation widens. This does not mean that the wider peaks are more important. The trader is most interested in those cycles with greater spectral density, corresponding to a larger price move. The minimum amount of data necessary to find these cycles must include the full cycle that might be identified. For example, to see any seasonal pattern, a minimum of 12 months is needed. More data are better when using spectral analysis to confirm the consistency of the cycle. A single year is not enough to support any seasonal findings.
12
William T. Taylor, “Fourier Spectral Analysis,” Technical Analysis of Stocks & Commodities (July/August 1984).
508
TRADING SYSTEMS AND METHODS
FIGURE 11.12 Spectral density. (a) A compound wave D, formed from three primary waves, A, B, and C. (b) Spectral density of compound wave D.
509
Cycle Analysis
FIGURE 11.13 10-, 20-, and 40-day cycles, within a 250-day seasonal.
Weighting Factors The most important part of spectral analysis is finding the proper estimators, or weighting factors, for the single-frequency series of cosine waves. When looking for long-term cycles, the trend and seasonal components must be removed because the method of spectral analysis will consider these the dominant characteristics and other cycles may be obscured. As in the other trigonometric formulas, the basic time-series notation is used, where yt, t = 1, 2, . . . , N are the data points and yˆ t will be the resulting estimated points on the spectral analysis. Then yˆ t ( ) =
N −1 ⎞ 1⎛ c + 2 ∑ ck cos ω k ⎟ π⎝ ⎠ k =1
where ck =
N k
∑
( yt
i =1
y )( yt + k N
y)
Methods of performing spectral analysis vary due to the choice of weighting functions that compensate for the fact that the accuracy of ck decreases as k increases. The two most popular techniques for handling this problem introduce an estimator λk called a lag window and a truncation point M < N so that the values of ck for M < k < N are no longer used and the values of ck for k < M are weighted by λk. The spectral analysis approximation is then written: yˆ t ( )
1⎛ λc π⎝
M
∑λ c
k k
k =1
⎞ cos ω k ⎟ ⎠
510
TRADING SYSTEMS AND METHODS
where λk can be either of the following: Tukey window 1 λk = ⎛ 1 + 2⎝
s
πk⎞ M⎠
0,1,
k
,M
Parzen window ⎧ ⎛ ⎪1 − 6 ⎝ ⎪ λk = ⎨ ⎪2 ⎛ 1 − ⎪⎩ ⎝
2
k⎞ k + 6⎛ ⎞ ⎠ ⎝ M M⎠ k⎞ M⎠
3
3
0≤k≤ M ≤k 2
M 2 M
Using a Fast Fourier Transform Program There are computer programs that apply a Fast Fourier Transform to perform a spectral analysis and create a Fourier power spectrum such as the one in Figure 11.12b. Anthony Warren’s approach13 can be found on the Companion Website, TSM Fast Fourier Transform, written by John Ehlers in BASIC program code. The program detrends the data and reduces endpoint discontinuity, which can produce large unwanted cycles. This is accomplished by multiplying the data by a bell-shaped window and extending the endpoints to give a more definitive structure to the detrended data, without affecting the results (as discussed in the previous section). A second filter is applied using selected moving averages. The moving average will reduce or eliminate the importance of those cycles, which are equal to or shorter than two times the length of the moving average period, letting the more dominant cycles appear. For example, the use of a 10-day moving average will eliminate cycles of length less than 20 days (frequencies greater than 12.5 per year). Figure 11.14 shows the output of the computer program. Subsequent works by Warren and Hutson14 present a computer program to calculate moving average–weighted filters using linear, triangular, and Hanning weights. Interpreting the Results of the Fourier Power Spectrum Both Figures 11.12b and 11.14 show a power spectrum resulting from a Fourier transform. Figure 11.12b is an ideal representation, where the cycles stand out with no ambiguity; Figure 11.14 is more realistic, showing both the dominant cycles and a certain amount of variance around those values. In the power spectrum, the cycle power shown 13 Anthony
Warren, “A Mini Guide to Fourier Spectrum Analysis,” Technical Analysis of Stocks & Commodities (January 1983). A very useful series of articles on spectral analysis has been published in Technical Analysis beginning in January 1983, authored by both Anthony W. Warren and Jack K. Hutson. Much of the information in this section was drawn from that material. 14 Anthony Warren and Jack K. Hutson, “Finite Impulse Response Filter,” Technical Analysis of Stocks & Commodities (May 1983).
511
Cycle Analysis
FIGURE 11.14 Output of spectral analy