Recently I read a very good book on algorithmic trading:
The book is an easy read and it was very eye-opening for me. It outlines (and justifies) the process of building and testing strategies that use technical analysis to guess the most probable outcome for the future.
From the author’s experience, it takes around 100-200 trading ideas to yield one tradable system. Ideas can be as simple as „Buy Monday” (buy Monday at open, set a stop loss at x and sell Monday at close – to speculate the addiction of investors who could not gamble during the weekend and will come looking to buy during the first day of the week) to as complex as employing a dozen technical indicators and chart patterns, set up complex trendlines, wait for multiple confirmations in agreement etc. But in general keeping it logical (based on clearly explainable patterns) and simple is the best way to avoid curve-fitting.
When testing a strategy on past data, the book makes a very clear distinction between:
- Historical back testing – almost always prone to curve fitting and disappointment;
- Out-of-sample testing – better at predicting future performance of a strategy, but still limited;
- Walk-forward analysis – the most reliable way to quickly evaluate the future performance and optimize based on past data;
- Real-time testing – best if you can afford to test for a long period.
The steps for testing a strategy are:
1. Preliminary Analysis – based on live data or walk forward analysis, 5-10 years of data and at least 30-100 trades for each trading rule in the strategy, with commissions and slippage (1-2 ticks/round turn for market and stop orders, 0 for limit orders). Important to look at: profit; no of trades; profit factor (over 1, preferably 1.5); average trade net profit; average losing trade; Tharp expectancy = (average $ winners * win % expectancy + average $ losers * lose %) / (- average $ losers) -> should be over 0.1; maximum drawdawn; equity curve (slope – as close as possible to a 45 degree angle straight line; flat periods; drawdown periods).
2. Detailed Analysis – Monte Carlo simulation that generates a large number of ways to rearrange the trades from the past and computes statistically the risk of a total ruin (if more drawdowns happen in a sequence – should be <10%), the median maximum drawdown (<40%), median annual return (>40%), return/drawdown ratio (>2.0) and the probabilities of certain annual returns – and helps compute the account size required for successful trading of the strategy.
3. Incubation – a 6-month period in which a strategy is tested on live data in a paper trading account and results are compared to expectations
4. Diversification +position sizing – on multiple time intervals, multiple markets, multiple targets, multiple contracts, multiple strategies. Diversification helps a lot, if done correctly (i.e. between markets that have as little correlation as possible) to decrease drawdowns, decrease the necessary capital for a portfolio of strategies and thus increase overall return on investment.
In addition, the book and the vibrant market of strategies in TradeStation made it clear to me that discretionary trading based on the trader’s limited memory/experience (i.e. untested strategies) has very little chance to compete with properly tested, fine-tuned and continuously optimized automated systems. No serious runner would try to outrun a Porsche or Ferrari, or even a Kia, and no serious weight lifter would compete with a crane – so why do so many traders insist on playing against the machines that are clearly vastly better at processing huge amounts of data, remembering everything and continuously computing the optimal parameters for the strategies?