Automating the Win: in Search of the Perfect Trading Machine
By AC Turkmen
I will not start this article by pretending that I’m an expert quant. All I am, an analytics expert whose day job is on a different research field but applies the same logic and principles to a moonlighting passion: currency trading.
This article assumes elementary knowledge of quantitative trading and trading algorithm development (JForex development) concepts, and will try to introduce some analytical insight to Forex strategy development.
Where It All Begins
The only thing for certain with quantitative trading is that it is still one big question mark. A lot of the lore on developing the cutting-edge trading machine or the Holy Grail of statistical arbitrage seems to be either extremely well-guarded or merely a legend. Nevertheless, one could easily spot that many financial institutions are relying heavily on quantitative researchers, even with their secrets behind high walls.
Without proper tools and training, many passionate personal traders online will teach themselves statistics, some software development, and technical analysis to pull together a strategy, which is then tested on demo accounts / small-cap accounts in order to prove their concept.
Trading strategy competitions have proved to the world that self-taught hackers and traders can form consistently winning algorithms and bring in pips. How then, can such an algorithm be developed, and what to watch out for?
Any quantitative trading algorithm is a “model” of the trader’s decision making mechanism, sterilized of trader psychology, but without the added benefit of intuition or complex calculations based on qualitative inputs. The model is developed (or in data mining terms “trained”) on the trading insights of the trader, and tested at the market.
A model has the huge benefit of being scalable. If the process is somewhat universal, it could be applied to a hundred different securities simultaneously, something impossible to do with good old eyeballing. The algorithm could process hundreds of different securities at virtually any time frame to spot opportunities.
The How To
Although a number of techniques are discussed, there are a few principal approaches to crafting the winning trading strategy.
1. The Mechanic
Number one is what I will call the “nuts and bolts”, where a seasoned technical analyst / trader will conceive a trading strategy that seems to be working due to a number of inefficiencies in the market. After getting the underlying mechanism more or less laid out, the trader codes a simple algorithm that automates the decision process. The algorithm is usually pretty straightforward and rigid in its structure.
The advantage behind this approach is the immense load of qualitative reasoning that can be built into the model. A trader who figures that during the last two hours of market X, commodities A and B demonstrate weak trends, he can safely code his strategy with these criteria in mind. The strategy could even be backtested to check if it would make sense in the past.
The disadvantage is that it lacks the specific statistics that could be uncovered only through machine learning. Furthermore, this type of strategy would be subject to faster “decay”, that is, as the dynamics behind the strategy erode, the yields on the strategy will also depreciate.
This type of strategy is best suited for seasoned traders who are willing to trade in a semi-automated strategy, actively managing a portfolio of trading algorithms and carefully reading the market.
2. The Fitter
The second approach is what I will call the fitter. The fitter is an approach that uses extensive backtesting and optimization to craft a winning strategy. The process usually starts by choosing a set of indicators of the trader’s taste; forming a combination of these indicators and throwing “configurable” parameters throughout the code. The trader can then rely on past data and the processing power of the computer to optimize the best combination of these parameters.
The weakness of this approach is quite obvious: overfitting. Overfitting is a data mining term used when machine learning algorithms learn the training data so well and down to so little detail that they are useless with other data. When this design route is followed, the end result is not a strategy that has “learned how to trade the EUR/USD” but a strategy that “memorized how EUR/USD was to be traded over a specific period in time”.
However, the fitter approach brings the advantage of scalability, harnessing the processing power of the computer to evaluate strategies against alternatives, a process that could otherwise take years on a spreadsheet.
3. The Gambler
The third and final approach is the gambler. This approach uses a simple rule-of-thumb strategy for low-pip trades and high risk-reward ratios and exposure, to try and score maximum gains. This is the kind of strategy that would end up in a trading strategy competition rather than a bank’s HFT server.
It’s intuitive to any Forex trader that higher exposure leads to significantly lower sustainability, and sustainability is the problem with the gambler. The trade can indeed triple overnight or run aground in an hour.
Through three “extremes”, we have explored the different approaches to designing a trading algorithm. So where’s the optimal solution? Probably somewhere in between these three approaches, depending highly on the security to be traded, time frame, etc.
Moving from the weaknesses and strengths, I believe a simple checklist can be devised to craft powerful Forex strategies:
- If it’s not robust, it’s not a strategy. The term robust, in this context, refers to the reliability of the strategy under different market conditions and within time. Backtesting an algorithm over a year or month and looking at bottom-line results is not the best approach when crafting robust strategies, instead consistency of gains per position, per day/week, and reward per variation (Sharpe ratio) should be watched out for.
- More is less. The simpler and more appealing to business sense the model, the more chances of profits. If the trading strategy consists of a decision tree with endless branches and leaves or looking compositely at ten indicators to make a decision, it’s probably overfitting and will last very short before it’s useless. If the strategy is developed more with “the Fitter” approach above, always make sure the strategy appeals to business acumen (it should either follow trends, or revert means, and do this somewhat symmetrically)
- Know your risk. In a backtest, a strategy with risk-reward ratio of 5 (50 pips of stop-loss, 10 pips of take-profit) can easily appear to be profitable, however a strong tide can easily put your strategy out of business. Remember that we’re coding our strategy for scalability in the first place, which means we can maximize gains with a sensible amount of risk and exposure.
- Have a philosophy and appeal to trading acumen. In my opinion, any trading strategy must have a governing philosophy that can be put in words. For example, “my strategy tries to spot strong medium-term trend formations” is a good one, whereas “my strategy looks at EMA, DEMA, TEMA and Bollingers to do amazingly complex calculations and get the answer” is not.
- See both sides. If your strategy is taking only one side of the coin (going long or short), it can’t be run 24 hours and must be supervised. Especially in trending markets, these strategies have a higher tendency to try and look for mean-reversions, and fail monstrously.
- It doesn’t have to be unsupervised. Another misconception with the trading strategy is that one would switch it on, fly out to Mauritius, lie on the beach for a week and come back to find one’s funds doubled. This is hardly the case, and the more common use of algorithms is as signal generators. A trader could manage a portfolio of strategies and make governing decisions depending on his interpretation of the market, or run many strategies simultaneously to diversify the risk.
(1) Look out for robustness (return for average position), (2) control exposure, (3) appeal to business sense and keep it simple, (4) leverage the power of computing. These are the keys, in my belief, to a powerful Forex strategy. Happy trading!