How to time the stock market Using Artificial Neural Networks and Genetic Algorithms



Similar documents
Neural Network Stock Trading Systems Donn S. Fishbein, MD, PhD Neuroquant.com

Mechanical Stock Trading Systems That Really Work Neural Networks and Genetic Algorithms

Neural Network and Genetic Algorithm Based Trading Systems. Donn S. Fishbein, MD, PhD Neuroquant.com

Identifying Short Term Market Turns Using Neural Networks and Genetic Algorithms

Stock Market Dashboard Back-Test October 29, 1998 March 29, 2010 Revised 2010 Leslie N. Masonson

Trading Systems Series

An Unconventional View of Trading Volume

Pair Trading with Options

One of the primary challenges traders deal with is

Development of Trading Strategies

How to Trade Intra-Day Gold and S&P500 with Low Risk Setups. by Chris Vermeulen

Chapter 2.3. Technical Analysis: Technical Indicators

Technical Analysis. Technical Analysis. Schools of Thought. Discussion Points. Discussion Points. Schools of thought. Schools of thought

Market Seasonality Historical Data, Trends & Market Timing

New Scan Wizard Stock Market Software Finds Trend and Force Breakouts First; Charts, Finds News, Logs Track Record

STREET SMARTS I. Planetary 2 Library. Introduction: Benefits: L I B R A R I E S

Managed Futures Counter-Trend vs. Trend Following. Executive Briefing

Chapter S AND BOLLINGER BANDS

The Logic Of Pivot Trading

The Golden Nugget That Makes Traders Wealthy Trading. AAPL, RIMM And Gold Stocks. The Four Stages of Stocks

I Really Trade. Trading Patterns for Stocks & Commodities. Introducing The False Break Buy and Sell Pattern

Advanced Trading Systems Collection MACD DIVERGENCE TRADING SYSTEM

Trend Determination - a Quick, Accurate, & Effective Methodology

Monthly Barometers, Investing in Dow Stocks

Implementing Point and Figure RS Signals

This can also be accomplished for traders with a protective put. Again you own one contract for the put for every 100 shares you own.

An ETF Trading Strategy:

Strategies for Trading Inverse Volatility

UNUSUAL VOLUME SYSTEM

Stock Market Trends...P1. What Is Automated Trading...P2. Advantages & Disadvantages...P3. Automated Trading Conclusion...P4

Technical Indicators Explained

Sunday, September 15, 13. Trade E-mini Futures without Indicators

How to see the market context using CCI Written by Buzz

Professional Trader Series: Moving Average Formula & Strategy Guide. by John Person

Pattern Recognition and Prediction in Equity Market

Guidelines to use with Fibonacciqueen trade setups!!!

BULLS ON WALL ST. 60 DAY TRADING BOOTCAMP

Commitment of Traders How to Follow the Professionals

Chapter 2.3. Technical Indicators

Neural Network Applications in Stock Market Predictions - A Methodology Analysis

The Shark Attack System

A Quick Tutorial in MACD: Basic Concepts. By Gerald Appel and Marvin Appel

Exchange-Traded Funds

Contrarian investing and why it works

Using Order Book Data

Comparing E-minis and ETFs

Trade for Big Profits: The Top Stock Methodology

Using Historical Probabilities to Trade the Opening Gap

Seasonality COVER. F1) Seasonal Trend in Heating Oil Price F2) Construction of a Seasonal Chart

3 Reasons Most People Never Make Money in the Stock Market. 5 Steps you MUST know before spending another Rand

Finanzdienstleistungen (Praxis) Algorithmic Trading

Retracement Or Reversal. Kennsei Trading, Inc. Chief Trader Dinger

Chapter 1 The Investment Setting

(NASDAQ: MNGA) Magnegas Corporation. Bullish. Investment Highlights

How To Trade An Exchange Traded Fund

Soft Computing In The Forecasting Of The Stock Exchange Of Thailand

How to Screen for Winning Stocks

How to put momentum strategies in context to achieve high percentage winning trades. Suzanne Bodlovic

REASONS TO TRADE STOCK INDEX FUTURES

Exit Strategies for Stocks and Futures

AbleTrend. Why Haven t Investors Been Told These Facts? Look inside to discover: Buyers. Call Free (888)

New York Traders Expo 2012

Chapter 3.1. Hedging with CFDs

Commodity Channel Index

This is Price Action Trading and Trend/Pattern Recognition.

My Daily Trading Preparation. Establishing Risk Parameters and Positions

WATTS TRADING GROUP. A Smarter Way To Trade. A Simple Way to Trade the 2-minute S&P

These Two Words Just Made Us 37% In 3 Months. "These Two Words. Just Made Us 37% In 3 Months"

The Secret to Day Trading How to Use Multiple Time Frames for Pinpoint Entry and Exit Points

How I Trade Profitably Every Single Month without Fail

FUTURES STRATEGY: Short-term CCI p. 10. ADJUSTING TO stock index futures shift p. 14. STRADDLES, STRANGLES, and volatility p. 16

HEAT UP YOUR PROFITS!

As a professional floor trader at the Chicago Board of Figure 1 Trade, I have studied many trading

INFERRING TRADING STRATEGIES FROM PROBABILITY DISTRIBUTION FUNCTIONS

Core Trading for a Living

Using ADX to Trade Breakouts, Pullbacks, and Reversal Patterns. By Puneet Jain CFTe

Factual statements in this course are made as of the date the course was created and are subject to change without notice.

About Hedge Funds. What is a Hedge Fund?

Trading Intra-Day is All About Finding an Edge (May 2008)

Perspective. Economic and Market. Has Stock Market Stability Increased Vulnerability?

Pivot Trading the FOREX Markets

A Guide to the Insider Buying Investment Strategy

The Big Shadow Trade

Trading with the Intraday Multi-View Indicator Suite

Brief Overview of Futures and Options in Risk Management

Why the E.A.S.Y. Method?

Lecture 23: Pairs Trading Steven Skiena. skiena

27PercentWeekly. By Ryan Jones. Part II in the Series Start Small and Retire Early Trading Weekly Options

COMPARATIVE ANALYSIS BETWEEN THE FUNDAMENTAL AND TECHNICAL ANALYSIS OF STOCKS

I Day. article. In. you but. I just. Entry. Trend. I risk. 2.5% per. equity. a "runner" trading

Technical Indicators Tutorial - Forex Trading, Currency Forecast, FX Trading Signal, Forex Training Cour...

MOVING AVERAGE CONVERGENCE-DIVERGENCE (MACD) A Market Timing Indicator

The 5 Exit Heroes. Exiting Your Forex Trades For Maximum Profits

How to Collect a 162% Cash on Cash Return

NO PART OF THIS E-BOOK MAY BE REPRODUCED FOR PERSONAL OR COMMERCIAL PURPOSE WITHOUT THE EXPRESS PERMISSION OF MARKET GEEKS LLC

No duplication of transmission of the material included within except with express written permission from the author.

Transcription:

How to time the stock market Using Artificial Neural Networks and Genetic Algorithms Donn S. Fishbein, MD, PhD Neuroquant.com ABSTRACT Despite considerable bad press that market timing has received in the past year, it remains the linchpin of successful investing. Although simple timing strategies can improve on buy-andhold performance, they suffer from several limitations. Artificial neural networks and genetic algorithms (ANN/GA) address some of these limitations, and offer a more flexible method to develop high performance market timing strategies. This paper will comment briefly on conventional market timing techniques, review continuing results of ANN/GA systems described by the author, and introduce a new ANN/GA market timing system. INTRODUCTION Market timing has gotten a bad name in the past year. Certain unethical or fraudulent mutual fund trading practices, specifically late trading and mutual fund zone arbitrage, were referred to in the press as market timing, and have contributed to the misunderstanding that all market timing is unethical or illegal. Market timing is not only legal, but a necessary strategy to profit in all market conditions. The very movement of the market is a function of investors and speculators trying to buy low and sell high - the very definition of market timing (Timertrac). Market timing refers to buying and selling investments based on a prediction of how well the market will perform in the future. A wide range of techniques are available for market timing, some of which have been reviewed in earlier papers (Fishbein, 2001, 2002) and elsewhere (Acheli). There are those who contend that market timing does not improve investment returns. Two closely related theories, that of efficient markets and market random walk, state that all that known about market valuation is incorporated into the current market price, and therefore the next price movement will be random, and therefore unpredictable. It is surprising how long-lived these theories have been when they are so easily disproved. THE FOUR PERCENT SWING SYSTEM Few things are harder to put up with than the annoyance of a good example. Mark Twain The good example is this case is the 4% Swing investment strategy, developed by Ned Davis of Ned Davis Research. The system is easy to explain and quickly disproves the theory that market timing doesn t work. Marty Zweig popularized the percent swing system in a 1986 book entitled Winning on Wall Street (Zweig, 1986). The system logic is very simple. Originally based on weekly closes for the Value Line Composite index, the system buys after a four percent

rise above a prior weekly low and sells after a four percent decline from a prior weekly high. The system can be followed on a chart without a computer. The system was profitable during a 19- year back-test period from 1966 to 1985, prior to its publication, and has remained profitable since its publication. Figure 1-4% Swing System NASDAQ-100 Trust (QQQ) 1999-Apr 2004, Weekly Bars; Buys Indicated By Up Arrows Below Price Bars, Sells By Down Arrows Above Price Bars The system meets the criteria of broad applicability and robustness for traditional technical analysis systems. First, it works well across different instruments, such as stocks, market indices, and futures. The above chart shows the indicator applied to the Nasdaq-100 exchange traded fund QQQ, which didn t come into existence until decades after the first description of the percent swing system. Second, it works well across different time frames such as hour, day, and week bars. Finally, its parameters, the percent upswing necessary to trigger a buy and the percent downswing necessary to trigger a sell, are not particularly critical. The system works with a wide range of values, and is therefore robust. Although its gains are not spectacular, it has beaten market averages in both back tests and forward tests since its introduction. Using the 4% swing system over the past four decades would have allowed you to miss much of the 1973-74 bear market, miss the 1987 crash entirely, and miss most of the recent bear market. The four percent swing system logic guarantees that a significant move in either direction will not be missed. While adequate to demonstrate that technical analysis has merits, the percent swing system also demonstrates the weaknesses of simple nonadaptable systems with fixed parameters. Although its logic is good at capturing trending market moves, it does poorly in a range bound market. It subjects its adherents to whipsaws, in which signals are triggered just as a minor move is completed and the

market reverses to the opposite direction. A more adaptable system might be able to recognize trending from trend-less markets, and only fire signals when a trending market was detected. Alternately, parameters could be dynamically adjusted to better fit current market conditions. The tradeoff for robustness and general applicability in the four percent swing system is somewhat lackluster performance. Although the system beats market averages over long periods of time, it suffers from poor performance during trend-less market periods. When average market swings are less than 4%, the system doesn t trigger. When swings are between 4% and 8%, the system triggers and loses money with each trade. The markets on average do not trend strongly, and therefore it is up to periods of strong trend to make up for the losses suffered in trend-less markets. The weaknesses of the four percent swing system, mainly its lack of adaptability to changing market conditions, can be ameliorated in several ways. Rules could be constructed to attempt to identify whether the instrument was trending or not, and apply the four percent swing only during strong trends. During range-bound conditions, other trading systems could be used, or the trader could simply remain flat (Fishbein, 2001). THE ADAPTABILITY OF NEURAL NETWORK BASED INDICATORS By their nature, properly constructed ANN/GA trading systems are adaptable to changing market conditions. In an earlier paper (TCF 2003), ANN/GA trading systems initially described between 2000 and 2002 were reviewed. All remained profitable during the 2002 to 2003 period, without any change in their network design. The AMA 2 SMA system was first presented in 2001 and subsequently discussed several additional times (Fishbein 2002, 2003). It is based on a specialized neural network construct, a general regression neural network (GRNN), to calculate a smoothed, adaptive moving average of the closing price. The relationship SMA 1 < AMA < SMA 2 is evaluated, where AMA refers to the adaptive moving average, and SMA 1 and SMA 2 are simple moving averages whose parameters are determined by a GA. The same expression is evaluated for triggering long and short trades, with only the parameters for each SMA differing. Separate training and evaluation periods are typically not employed with systems based on GRNNs, because these systems are never predicting the training set. Rather, they perform a comparison of today s bar with all of the bars in the training set. The output they produce is in effect a weighted average of all of the outputs of those bars which are similar to today s bar. The AMA 2 SMA system has remained profitable in each year since it was introduced. In the year ending on April 8, 2004, the system returned 26.5% trading the Dow Jones 30 exchange traded fund (DIA), 12.7% trading the S&P 500 exchange traded fund (SPY), and 80.1% trading the Nasdaq-100 exchange traded fund (QQQ). During this same period, the buy-and-hold return for QQQ was 41.7%. TREND QUALITY INDICATOR NEW INDICATORS and their ANN/GA ADAPTATION

One of the most productive uses of ANN/GA in market timing is to make small, incremental improvements to existing timing systems. David Sepiashvili described the Trend- Quality Indicator in a recent article in Technical Analysis of Stocks & Commodities (Sepiashvili, 2004). The author defined two indicators, the Q-indicator and the B-indicator, which attempt to measure the strength of an existing trend. The Q-indicator is unbounded, while the B-indicator is an oscillator which varies between 0 and 100. The implication is that stronger trends are more sustainable and therefore easier to trade. Sepiashvili s article is insightful, and looks at trend identification in a unique way. The author provides that the indicators may then be used to recognize trends and their strengths. To use these indicators to trade financial instruments mechanically, they need to be incorporated into a system, with entry and exit rules at a minimum. This usually involves setting parameters for each indicator which determine whether the indicator favors a long, neutral, or short position. Establishing parameters involves choosing fixed values, and furthermore optimizing these values for the time period and specific instrument under consideration. When more than one indicator is being used, the question of how to weight each indicator and how to combine them to yield a single buy, hold or sell signal also arises. The process of optimizing a system is complicated, and runs the risk of curve-fitting, in which parameters are selected that best fit the historical data but do not predict future data. ANN/GA offer another approach for turning indicators into a full-blown trading system. The indicators are used as inputs to a feed-forward, back-propagation neural network, usually in combination with the closing price. The neural network is trained using historical data, holding back a portion of the data for walk-forward testing. The neural network establishes a complex, non-linear relationship between the indicators and the desired output, namely long, hold or short. The risk of overoptimization of the network is reduced by limiting both the size of the neural network and the optimization time. A genetic algorithm can be used at the same time to optimize fixed values contained within the indicators. Finally, the held back out-of-sample data is tested with the fully trained and optimized network to assess whether it yields profitable results. The Q-indicator and B-indicator are calculated using several intermediate indicators, which in turn are based on the closing price and two exponential moving averages (7 and 15 day). All of these indicators, along with the closing price itself, are used as inputs to a feed-forward backpropagation neural network, which seeks to predict the per cent change in the closing price 10 days in the future. Based on this prediction, buy and sell signals are generated. The fixed parameters are optimized using a genetic algorithm. The networks are trained using 30 months of daily closing prices for the Nasdaq-100 and S&P 500 exchange traded funds, QQQ and SPY respectively. The systems were always in the market, either long or short.

Figure 2 Trend Quality Indicator: Top-QQQ Close 2001-2004; Middle - QIndicator and BIndicator; Bottom: TQI Trading Strategy, Buys Indicated By Up Arrows Below Price Bars, Sells By Down Arrows Above Price Bars The networks performed well during the training and testing periods, which encompassed the period from Jan, 2001 to March, 2004. Results were evaluated trading a fixed number of shares for each trade, with allowances for commission costs. During this period, the QQQs (Nasdaq-100) lost 0.7% annualized, while the network trading the QQQs gained 41.3% (64.6% training, 21.9% out-of sample testing) annualized. The SPYs (S&P 500) lost 5.0% annualized, while the network trading the SPYs gained 26.0% (31.9% training, 14.6% out-of-sample testing) annualized. In both cases, the networks trained with indicators of the Trend Quality Indicator significantly outperformed buy-and-hold. SUMMARY Investment returns can be improved by using market timing strategies. Conventional market timing techniques do not generalize well across all markets and time frames. In addition, they require considerable trial and error to arrive at a workable set of indicators and parameters. ANN/GA offer a method to develop customized indicators for specific financial instruments and time frames, and can aid in successful market timing and trading. REFERENCES Acheli SB. Technical Analysis from A to Z. http://www.equis.com/free/taaz/ Fishbein DS. Trading Financial Markets with Neural Networks and Genetic Algorithms. Trenton Computer Festival Proceedings, 2001.

Fishbein DS. Neural Networks and Genetic Algorithms: Another Tools for the Technical Analysis of Financial Markets. Trenton Computer Festival Proceedings, 2002. Fishbein DS. Mechanical Stock Trading Systems That Really Work. Trenton Computer Festival Proceedings, 2003. Neuroquant.com: www.neuroquant.com Sepiashvili D. Trend Quality Indicator. Technical Analysis of Stocks & Commodities, Vol 22:4, April 2004, pg. 14-20. Timertrac.com: www.timertrac.com Zweig, M. Winning of Wall Street. 1986, 1997(revised), Warner Books, 282 pg.