Short articles on topics in systematic trading

 

 

Newsletter
Article Library
Videos
What's New
About Us
Site Map
Search

 

 

 

 

Other Articles...

Systematic Trading: Benefits and Risks

Getting Starting With Systematic Trading

Elements of a Profitable Trading Strategy

Top Ten Systematic Trading Methods

Tools for Strategy Building

Building Trading Systems Using Automatic Code Generation

Trading Article Library

 

Michael R. Bryant, Ph.D. Building Trading Systems Using Automatic Code Generation

 by Michael R. Bryant

 

 

 

As more and more traders have moved to automated trading, the interest in systematic trading strategies has increased. While some traders develop their own trading strategies, the steep learning curve required to develop and implement a trading system is an impediment to many traders. A recently developed solution to this problem is the use of computer algorithms to automatically generate trading system code. The goal of this approach is to automate many of the steps in the traditional process of developing trading systems.

 

Automatic code generation software for building trading systems is often based on genetic programming (GP), which belongs to a class of techniques called evolutionary algorithms. Evolutionary algorithms and GP in particular were developed by researchers in artificial intelligence based on the biological concepts of reproduction and evolution. A GP algorithm evolves a population of trading strategies from an initial population of randomly generated members. Members of the population compete against each other based on their fitness. The fitter members are selected as parents to produce a new member of the population, which replaces a weaker (less fit) member.


Two parents are combined using a technique called crossover, which mimics genetic crossover in biological reproduction. In crossover, part of one parentís genome is combined with part of the other parentís genome to produce the child genome. For trading system generation, genomes can represent different elements of the trading strategy, including various technical indicators, such as moving averages, stochastics, and so on; different types of entry and exit orders; and logical conditions for entering and exiting the market.


Other members of the population are produced via mutation, is which one member of the population is selected to be modified by randomly changing parts of its genome. Typically, a majority (e.g., 90%) of new members of the population are produced via crossover, with the remaining members produced via mutation.


Over successive generations of reproduction, the overall fitness of the population tends to increase. The fitness is based on a set of build goals that rank or score each strategy. Examples of build goals include various performance measures, such as the net profit, drawdown, percentage of winners, profit factor, and so on. These can be stated as minimum requirements, such as a profit factor of at least 2.0, or as objectives to maximize, such as maximizing the net profit. If there are multiple build goals, a weighted average can be used to form the fitness metric. The process is stopped after some number of generations or when the fitness stops increasing. The solution is generally taken as the fittest member of the resulting population, or the entire population might be sorted by fitness and saved for further review.


Because genetic programming is a type of optimization, over-fitting is a concern. This is typically addressed using out-of-sample testing, in which data not used to evaluate the strategies during the build phase is used to test them afterwards. Essentially, each candidate strategy constructed during the build process is a hypothesis that is either supported or refuted by the evaluation and further supported or refuted by the out-of-sample results.


There are several benefits to building trading systems via automatic code generation. The GP process enables the synthesis of strategies given only a high level set of performance goals. The algorithm does the rest. This reduces the need for detailed knowledge of technical indicators and strategy design principles. Also, the GP process is unbiased. Whereas most traders have developed biases for or against specific indicators and/or trading logic, GP is guided only by what works. Moreover, by incorporating proper trading rule semantics, the GP process can be designed to produce logically correct trading rules and error-free code. In many cases, the GP process produces results that are not only unique but non-obvious. These hidden gems would be nearly impossible to find any other way. Lastly, by automating the build process, the time required to develop a viable strategy can be reduced from weeks or months to a matter of minutes in some cases, depending on the length of the input price data file and other build settings.
 

 

To comment on this article, click here.

horizontal rule

 

If you'd like to be informed of new developments, news, and special offers from Adaptrade Software, please join our email list. Thank you.

 

Join Our Email List
Email:  
For Email Marketing you can trust

 

 

 

As Featured On EzineArticles

 

 

Copyright © 2004-2015 Adaptrade Software. All rights reserved.