Trading Systems by Urban Jaekle and Emilio Tomasini
- Why you need it: This book will set you in the right direction in coding and testing a system
- Where you can get it: Trading Systems: A New Approach to System Development and Portfolio Optimisation
- How it will help your trading: You will create more robust and well-tested systems that will ultimately be more profitable
Trading Systems has changed my life. That’s a stretch, but it’s true. I have been working on writing automated trading systems for a some time now, and this book has given me direction and focus to that task. Previous systems that I have written were done by finding all the details and rules of a manual trading system, and coding each one into the automated system, trying to figure out which rule might take precedence, and whether one rule of the trading system might be more important than another. I’ve come up with what I thought were moderately profitable trading systems, only to see them under-perform in the real world. Enter Trading Systems, which clearly showed me I was doing things backwards, and that there were much better and more reliable ways to test a system’s viability.
The most important thing I learned from this book is that the trading system itself can be be very simple; actually, it must be very simple. The example the authors use throughout the book is the LUXOR system, which is the simplest of moving-average cross-over systems, probably the first trading system anyone learns. Tomasini shows that the system tested against historical data does well; it is profitable with very simple trading rules. Even better, the LUXOR system is free; he tells you where you can download it. The code is presented in EasyLanguage, but it is simple enough that you can translate it into Metatrader or Ninjascript, or whatever your language of choice.
The next important thing I learned is that once you have run some tests to show that the system is basically profitable, there is a correct order of what to do next. In my own previous work, I threw in indicators, trading rules, stops and profit targets, Money Management rules, and everything all at once; but Tomasini is clear that the very first thing you should do is get the trading algorithm to work well on its own. Then, add a filter to two to weed out some bad trades; in the book he adds a time-of-day filter to limit when the system can trade.
Only then do you start thinking about stops, trailing stops and profit targets. In the world of discretionary trading, that’s crazy talk. In my manual trading, I have always been taught that you determine your stop at the same time you determine where you will place the trade. That idea gets drilled into us at every trading class and lecture — Use stops! But in automated trading, the algorithm must be profitable even without stops. In fact, after adding stops to the program, the total profit doesn’t change very much. What does change is the drawdown; using stops, especially trailing stops, drastically reduces drawdown on the account.
The last thing that gets added into the system is money management (or the trademarked term “Position Sizing”); once a good money management system is coded in, the system goes from profitable to uber-profitable. A simple money management rule is that the system will always trade only 2% of the account’s equity. As the equity increases, so does each trade size.
Tomasini spends the majority of this first section of the book on back testing and optimization; dozens of interesting graphs show the testing results after each change is made to the code. His graphing software is making me a bit jealous, and I’ve got it on my list to figure out how he does those graphs so that I can do my own.
One thing that is interesting about optimization is that you have to be clear about what you are optimizing: profits, or percentage of profitable trades, or the average trade, or minimizing drawdown. These various goals need to be clear your mind before you begin optimizing. It’s not enough to say that you want the system to make as much money as quick as possible. If you optimize only for net profit, and ignore drawdown numbers, your system may well wipe you out before you get to profit.
The important lesson of back testing is that over-optimization will make a trading system look good with historical data but perform poorly in the real world. Tomasini spends a lot of time explaining how to not over-optimize. One of those methods is to use walk-forward analysis. What that means is that you use a portion of your historical data to optimize your algorithm’s parameters, and then another portion of the data to test those parameters. In other words, you use half of your data for training the system, and the other half (the “unseen” half) for testing. This is known as “in sample” data and “out of sample data”. These are really important concepts, and make all the difference in the world on creating a profitable system. Walk-forward analysis keeps moving the window of in-sample and out-of sample data forward through time, and each time you get parameter results that are little better than before; by “better”, I mean more robust, and more likely to work well long-term.
Two more concepts Tomasini describes for testing the robustness of a system are timescale changes and Monte Carlo analysis. Timescale changes just means that if you have tested and optimized your system using 1-hour chart data, then you run the tests against 30 minute or 4-hour chart data, and see how it performs. If your system still does moderately well, you likely have a good system.
Monte Carlo analysis sounds so cool that I just like saying the words: “Monte Carlo Analysis”. Monte Carlo Analysis is a tool that checks for the worst case drawdown scenarios. The analysis re-organizes the order of your trades randomly, and shows you various scenarios. Your beginning equity and ending equity are still the same, but the order in which the trades are taken is randomized a number of times. Some of the equity curves will be better, and some will be worse. The analysis shows the worst case scenario on the drawdown on your account for the trading system you are testing.
Finally, Tomasini recommends periodically re-optimizing your system. Markets change over time, so if you re-optimize and re-analyze your system periodically, you can keep it generating good profits.
This is probably one of the best books I have read on my particular niche of trading systems; if you have any thoughts of developing a profitable automated trading system, you need to ready and apply Trading Systems.
(Note: The second part of the book is on portfolio optimization, which is a topic I will cover in a later entry.)