~~~ Training Algo Trading Strategies ~~~
For optimizing an algo trading system, different strategy parameter values are backtested with historical price data for finding the best suited value. For example, imagine an automated trading system that buys and sells a Forex position when the price curve crosses its Simple Moving Average (SMA), and puts a stop loss at a certain distance from the price. This strategy can be trained to determine the best suited SMA period between 30 and 300 bars, and the optimal stop distance between 10 and 100 pips.
Contrary to popular belief, the main purpose of training or optimizing is not getting the highest backtest profit. A proper algo trading parameter optimization has 3 main purposes:
A live trading algo system should also be able to automatically re-train itself in regular intervals with recent price data or recent trading results. In this way the system stays permanently adapted to the market.
If the strategy uses a machine learning algorithm, such as a neural net or decision tree, training works a bit differently. It generates a set of data values - named 'signals' or 'features' - and a training target, such as a price changes or trade return. This allows the algorithm to learn predicting future prices or the outcomes of future trades. This process is repeated in intervals for keeping the learning algorithm up to date. This is rules training or model training, as opposed to parameter training. Since rules or models training bears a high danger of overfitting, out-of-sample or walk-forward backtesting is mandatory.
The wrong way to optimize a trading system - and the right way
For parameter optimization, algo trading software often uses Genetic Algorithms or Brute Force optimization in order to find the highest performance peak in the parameter space. That's the main reason why so many perfectly optimized strategies fail miserably in live trading. These methods do not produce robust strategies. They generate panda bears that are perfectly adapted to a specific historical data set, but won't survive anywhere else.
Zorro prefers a different method. Its default Ascent optimizer does not seek performance peaks, but stable performance plateaus, and places the parameters into their 'sweet spots'. This does not necessarily produce the best backtest performance, but it produces robust strategies with better live trading results. For special purposes, conventional genetic or brute force optimization is also available, and external optimization modules, for instance in R packages, are also supported.
There's also another difference to conventional strategy training. Most platforms have a menu for entering the parameters and training settings. Zorro has no such menu. Training is coded in the strategy script just like anything else (see the machine learning script as an example). This makes optimization an integral part of the strategy and allows automated re-training the strategy while trading live.
Parameter training normally requires thousands of backtests
with different parameter sets. The speed of the
is therefore essential for effective optimization. Zorro can
optimize a multi-parameter intraday portfolio system in a few seconds. To
achieve this, it uses massive parallel processing by activating
multiple processor cores.