Dr. Howard Bandy, the author of this book has university degrees in computer science, engineering, mathematics and physics. He is specialized in artificial intelligence and applied mathematics. He has been programming successful stock trading systems and was a senior research analyst for a CTA company. The book is about quantitative trading systems that rely on mathematics and are programmable. It doesn’t include fundamentals or discretionary technical analysis like chart patterns.
Published already in 2007, this is not a new book. I am sure the technology has improved rapidly since then but I was suggested to read the book for quant trading ideas. I will list the topics covered and some main points about it that caught my eye.
Quantitative analysis
It removes judgment for subjective chart patterns, defines mathematically precise indicators, makes use of computer simulations and applies statistical validation.
Data
End-of-day, delayed intraday and real-time data. High-quality models depend on high-quality data. The author uses AmiBroker software for his quantitative work and AmiQuote can communicate with most data sources available where you can get a subscription. Choose a data vendor with good reputation and keep using that vendor – consistency is more important here than accuracy.
Trading system overview
Traders are constantly looking for new inefficiencies in the markets because markets change and old systems stop working.
The most important part regarding psychology in trading systems is that if a system is not your own made, you will start questioning its performance and lose confidence in taking the signals.
As a side note, Bandy writes about his bias for trading systems that have a high winning rate and short holding periods. This is the opposite of my few previous reads about trend-following that in nature has a low winning rate with big winners and longer holding periods. This makes studying Bandy’s work even more interesting for me, I don’t want to keep myself biased towards one way, instead trying to understand different approaches to better develop my own portfolio of strategies.
Measuring success
The goal of a trading system is to maximize the objective function score for every time period, especially for out-of-sample data. Only you can decide which trading system is good and which is not. You probably know your subjective preferences for a trading system like annual gain, maximum drawdown, frequency of trading, length of holding period. If you don’t know that, you can run AmiBroker optimization to examine the results. Think about which benchmark you want to compare your results to.
One component of measurement that is absolutely necessary is expectancy. You need to have a positive expectancy to trade the system. Expectancy is the average profit per trade taken over all trades. Annual account growth rate depends on expectancy and trading frequency. There are many different metrics the author outlines in his book. I personally focus on three metrics: win rate, average win / loss, profit factor.
AmiBroker
Software to develop and test quantitative trading systems. The author lists up other alternative software like TradeStation, MetaStock and why he recommends AmiBroker – simple coding language, end-of-day data easily available, affordable. Keep in mind that the book was published in 2007 and the technology has developed a lot since then.
Issue selection
The ideal issue to trade has enough data, price movement is reasonable and matches our expectations, there is enough liquidity, offers enough profit potential and we can form some kind of quantitative strategy around it.
Entries and exits
Over 40 order types in Interactive Brokers at the time of publishing this book (2007)! Most common are MKT, LMT, STP, STP LMT, MOC. Same point that Adam Grimes brought up in his book: using LMT order you are guaranteed to be filled on all losing trades but not always on winning trades. How to develop and test entries / exits. What are random signals and future leaks.
Functions and indicators
Functions are mathematical expressions that perform some sort of calculations. AmiBroker has an extensive library of functions available like price based, composites, date / time, lowest / highest, math functions, indicators, moving averages, statistical functions, string manipulation, time frame functions and much more. If a function you need is not there already, you can program it using the AmiBroker AFL language. Most popular indicators are included in AmiBroker and you can also program your own.
Trending systems
Two of the most popular trend following systems are moving average crossover and breakout. It is then anticipated that the price may run longer in the same direction. The author shows a test how simple moving average crossover doesn’t work for trend following, or at least works opposite to general wisdom. I think a single test on an individual name doesn’t prove a significant point and there should be more to draw a conclusion. As I understand, Bandy might have an opposite bias to trend following and I don’t want to seem biased myself, but one of the factors of trend following is diversification in different names – you don’t know which one takes off and gives a big trend. The author believes that breakout systems in general don’t work anymore because they became too popular among traders. He states that breakout systems have a win rate of only 30% which I have actually read elsewhere, too. That means you may hit a big winner but need to take many smaller losses to get one.
Mean reversion systems
Mean reversion works on the fact that prices oscillate around their equilibrium, the price can become overbought or oversold and the target is reversion to the mean. The price of an issue can be in a trend or a trading range. Mean reversion systems work well in trading ranges because they take counter-trend positions. This can hurt a lot in a trend and therefore it needs to have a proper exit mechanism in place.
Seasonality systems
Commodities often have seasonalities. The author shows a test of a seasonality pattern based on the end of month data which besides in-sample worked well on out-of-sample data. His last test based on the moon’s cycle shows how in-sample test was very profitable but the out-of-sample test was completely different and lost considerable amount of money. In Bandy’s tests the in-sample data ranges from 1995 – 2005 and the out-of-sample period is 2005 – 2007, in my opinion the latter period is too short, there wasn’t even a bear market in that two years time which makes the results questionable.
Pattern systems
It can be used to identify potentially profitable setups in almost any market regime. Tests include “buy after three down days” as a mean reversion system and “buy after three up days” as trend following.
Anticipating signals
If one works with end-of-day data, then how to anticipate a signal on close. One option is to screen the market before close and decide where to get in, but another option is to use MOC (market-on-close) order type with your trading system.
Sector analysis
Sector funds usually have less noise and a higher signal to noise ratio which makes the analysis easier, but the profit from trading one is usually less than trading an individual component.
Rotation
This style of trading means you have active positions at all times and based on some metric you rotate money between a selection of issues. Let’s take sectors, for example. You list up the sector ETFs and rank them based on some metric. You go long some, maybe short the others. In a set period of time or based on some event, you go through the list again and replace the ones not meeting your requirements with appropriate ones. This method can be used to beat the broad market index by looking for inefficiencies in market sectors separately.
Portfolios
One of the strongest features of AmiBroker is to manage a portfolio. A portfolio may consist of a single set of parameters applied to all issues in a group, or specific parameter values applied to individual issues, or several different trading systems.
Filters and timing
Filters are extra parameters that allow or block a trade. It could be data from another market or timeframe, signal from the broad market, combination of indicators etc.
In-sample and out-of-sample
In-sample is the part of data that you use to discover and learn patterns, out-of-sample data is where you test the system if it works or is just random noise. Optimization is organized search. A long period of data is necessary to get enough trades and provide statistical validity. Optimization runs on in-sample data but what matters is the results of out-of-sample, that can estimate future performance. Out-of-sample data must always be a later period of time that begins right after in-sample to be sure that the model has a predictive value going forward.
A system doesn’t need to do well in all market conditions. One can use a tight stop loss to be out in unfavorable market conditions; track the system performance; apply a filter to decide when the system is in sync with the market.
Don’t expect out-of-sample performance to be as good as in-sample. In-sample data is where you train the model and out-of-sample will usually have more noise in data.
Walk forward testing
Walk forward testing is a process for automating the search for a profitable model that adapts to changing market conditions. Every new out-of-sample period becomes in-sample as time goes by which is followed by a new out-of-sample period and so forth until the model goes to live trading. If you start live trading without acceptable results from out-of-sample testing, then your testing starts with real money.
Survivor bias
Just like track records of good money managers are kept and shared but nobody remembers the ones who failed, stocks that got de-listed are often not included in backtests. For example, testing all names of the S&P500 index would exclude the ones that performed poorly, fell to the bottom of the list and were eventually replaced by better companies. This means one should get price data of all the stocks that once were in the index for the time period being tested.
Monte Carlo analysis
This is a popular form of analysis described in many books. It randomly simulates a trading system to show all kinds of different variations a trading system could have played out. Howard Bandy claims his research has shown that stops hurt all systems. I personally don’t recommend ruling out stops. It can be this one time that wipes you out of the game because you didn’t have a stop loss in place.
Conclusion
Characteristics of the markets change over time also because traders develop and trade new models. These models eventually remove those inefficiencies from the market that they were built upon. Such models will probably never work again. All trading systems will eventually fail. This is why traders are constantly developing new trading systems.
With intraday bars there will be more bars over the same amount of trading days. This makes the model more sensitive, detecting changes hidden in the daily data. The more data points, the more robust statistical validation. On the other hand, bad data from the vendor can make errors in trading signals, the end-of-day approach is therefore more reliable and possible errors can be detected and removed better. Choose a data vendor with good reputation and keep using that vendor – consistency is more important here than accuracy. Be mindful if the historical data is adjusted for large dividend distributions. AmiBroker’s Split tool can be used to correct unadjusted splits.
Staged approach to system design:
1) objective function, trading frequency, order style
2) amount of trading account, type of positions, category and issue selection, leverage, level of risk
3) entry / exit conditions, in-sample / out-of-sample data, optimization, validity test
Don’t forget this book was written in early 2007. While I’m sure most general wisdom and a lot of the methods for developing a quant model haven’t changed, I think technology has improved so much during the last decade that programming is easier now for starters. Also, quant trading has definitely improved with much more high-frequency in the game. It would be more beneficial to go thru this book by having AmiBroker installed on your computer and trying things out at once. I know AmiBroker is still being used by professionals in the field and it has been getting updates.
Quantitative Trading Systems by Howard Bandy book link
Share this post