One of the questions that I often get asked about strategy design is, “how do you design a robust mechanical trading strategy?”
To understand how to build a robust mechanical strategy it is important to understand what a robust mechanical strategy is. A mechanical strategy is simply a quantified decision stream that leads either a “trading robot” or the trader himself to determine position size, entries, exits and stops all in a completely hands off fashion – in other words if you have a working mechanical system your input is not needed (or if so to a very limited degree). Additionally, for a mechanical strategy to be robust, it must capitalize on a “trading edge”. This can be anything from a statistical edge (trending) to an executionary edge (arbitrage). Furthermore, this strategy must hold up over an extensive period of trades historically (at least several hundred) and must hold up in future trading (which can be simulated).
A mechanical system has several advantages that discretionary traders do not such as the ability to perform quantitative and data mining analysis quickly and over extended historical periods. Additionally, mechanical systems can alleviate some of the emotional distress that accompanies discretionary trading – particularly among new traders. However, it is important to recognize that mechanical trading has several disadvantages as well. The first being that you must be able to quantify each and every trading decision that the system will make, secondly the mechanical system will have to be periodically adjusted (just like a discretionary trader adjusts their methods) either through inherent adaptivity, optimization, or diversification. Lastly, mechanical systems only work if one puts in the tremendous amount of time and effort required to program, test, debug, and continually adjust it.
To design any mechanical strategy it is important to consider three things before anything else: 1) your objective for that system, 2) your market, 3) your timeframe. Once you have determined this, it is easy to find your essential methodology because there are only 4 ways to trade any market: 1) trend trading, 2) momentum trading, 3) reversion to the mean trading, 4) and fundamental trading. Once you have determined your objective, market, timeframe and method you are ready to attempt to put together your first strategy. Many of you are probably thinking at this point, “what if I don’t know any of that stuff?”
If you are already an experienced discretionary trader this should not prove to be overly difficult. However, if you do not have extensive experience you will have to find a method that works. This method can be as simple as a moving average cross long/short to as complicated as a continually adjusting collaborative neural network that is genetically re-optimized daily. The very best way for the inexperienced trader to build a new system is to test ideas. This can be done in two ways – visually or programmatically. For someone without extensive programming experience, the best would be to start with what I call “candle by candle” back testing. This is performed by taking an idea (such as a moving average crossover) and testing it with historical data on the given market and time frame by moving your charts forward from the past into the future and trading the way the system would – without future knowledge of the markets.
This method is how I tested my first ten “strategies”, four of which I still continue to trade today (including two that were designed by Phil McGrew which I tested using this method and still trade today). Here is an example of how I tested Phil's indicators (with my own exits). However, I had to test nearly fifty or sixty ideas to get down to those ten strategies that work, and finally refine the process until I had found four of those ten systems that I found tradable. To give you an example of how time consuming this process is, I tested these ten strategies extensively often looking at over 2 years of 15 minute bars and “executing” hundreds of trades. I spent nearly 700 real hours doing this testing (and I’m pretty quick with a chart and excel). It sounds like a lot of work right? Well it was, but it also gave me a feel for those markets that is nearly as good as having traded those markets in real time.
After doing this for some time, I felt that there had to be a more effective way to test ideas. And there is – programmatic testing. Programmatic testing again can be very easy – a simple moving average cross is a simple thing to program in nearly any programming language. However, the difficulties that can destroy the beginning programmatic trader are nearly endless. Many popular trading packages do not trace your equity position tick by tick, rather it is tracked bar by bar (and if you’re trading daily bars you can imagine the problems). Also, ideas that I had tested extensively by hand sometimes were difficult to program. I have had so many experiences where I miscoded a critical concept (even by a slight degree) and this ended up giving drastically different results than my hand testing. Without the knowledge that it was the code that was incorrect, I might have falsely dismissed many trading ideas that were in fact valid. This coding problem is haunting if you think about it.
Additionally, at this level of programmatic trading it is very important to consider factors of minimizing inputs (degrees of freedom) and utilizing flexible inputs. An example of this would be to utilize a 3 ATR stop instead of a 60 pip stop so that as the prices and volatility of the market fluctuate your stop is not being taken out because of random noise. Other ways that you can improve the robustness of your strategy include utilizing realistic fills and commissions and ensuring that your limit orders would have actually been filled (this is not as easy to test in some software as it should be). Optimization is another useful tool to consider at this point in your strategy testing career. This is a powerful but two edged sword. Utilization of genetic algorithms and similar “hill climbing” techniques are a common way to ensure that your optimization does not give you a single point anomaly, but rather that there are similar input values surrounding your inputs that give similar equity graphs. Walk forward testing is another useful tool that can help you achieve realistic results and see for yourself whether a strategy would have been successful on data that was not optimized (similar to the future).
Going further into programmatic trading, after having experienced many pitfalls, I feel that I ought to be able to test more than one idea at a time. In fact, ideally I would like to test many ideas, over multiple time frames and multiple markets. Right now this is the work that I am involved in designing and I feel that this will help me analyze the markets with the speed and precision that will take my trading to the next level. This is the arena of the best strategy designers, where statistical data mining, market analysis, timeframe analysis, technical analysis, fundamental analysis, and money management are combined with realistic evolutionary testing into a single package.
As you can see, advanced programmatic testing and trading is a complex arena. I myself am still learning and by no means consider myself an expert. The good news is that successful robust mechanical strategy creation and implementation can be done in as simple or as complex a manner as you choose. After all, the very simple strategies tested and/or designed with candle by candle backtesting are still a cornerstone of my trading methodology.
Save to del.icio.us
Will Your Trading Success Truly Last?
1 day ago