• No results found

The Continually Adaptive Trading Engine^

5.4 Evolutionary Framework

Instead o f trying to develop effective trading systems by hand, a genetic search of possible trading systems built on these indicators would not only be a very elegant method o f evaluating a large number o f different strategies, but would also unlock the possibihty o f continually evolving systems that change and mutate to match current market conditions. The system has then been developed to sustain a large population of systems that are constantly breeding with each other, evolving and mutating, that will always be searching for trading systems that are better attuned to the current

market. Then only the systems that have been performing best in the recent past are used for trading. This is done by only acting on signals from individual systems whose recent performance exceeds some threshold. The recent mean return is required to be greater than the sum of the trading costs and a moderate mean return per trade.

One way to visuahse this is as a having ‘moving window rules buffer’ where rules are constantly moving in and out of the cache with new rules being created from the genetic algorithms operators (crossover and mutation). The system will not necessarily predict a market character in the future, but instead when a particular market character is estabhshed it wiU attempt to produce a good trading strategy to exploit it. Due to the concurrent nature o f the development o f multiple solutions by a G A, this approach is similar in many respects to holding a portfoho o f trading rules, which in turn represents a diversification o f trading strategies. The Markovitzian analogy [Mark52] has been taken further than this, as it is required that the individual solutions are not highly correlated, and so the risk associated with the portfoho is reduced.

5.4.1 Strategy Representation

A key aim is to keep a large number of systems as genetic “stock” at hand, so that as the market changes, the system will either already have a suitable set o f systems in hand, or very quickly be able to assemble such systems that will be most effective in the short and medium term future. If effective trading systems exist within this framework, it is likely that they will be found (or close approximations to them).

Table 5.3: Anatomy of a strategy

Buy Strategy

SeU Strategy

Stop Loss

Strategy Parameter Parameter Strategy Parameter Parameter % drop

Type p i P2 Type PI P2

Moving Average

12 day 25 day Range

Breakout

15 days 4

Each system is as described before in section 5.3, with a strategy for buying and a strategy for selling, each with a few attendant parameters, and a stop loss. Each strategy type could be one of moving average, trading range breakout or relative strength. If the chosen strategy does not have a second parameter then this field is

ignored. It is the eventual aim to extend this framework to allow a much more sophisticated mode of operation, but the present framework allows a moderate level of complexity, and is sufficient to demonstrate the concept.

To illustrate the present scheme, the encoding o f a plausible strategy is shown in Table 5.3, where the system buys if the 12 day moving average is higher than the 25 day moving average. The position is closed if the price doesn’t make a breakout in 15 days, or if the price drops by 4%.

5.4.2 Genetic Trading

It is straightforward to test a trading system based on the above fi’amework. Daily price data is fed into the machine which makes buy/sell decisions on information that would have been available at the time. The only equivalent o f training in this approach is that of an initialisation period where the algorithm is run through a given set o f data in order to produce good ‘genetic fragments’ (parts o f trading strategies), that may later be used to produce good trading rules. The system keeps a record o f its recent behaviour as the daily data is submitted, although sometimes it may not be possible to perform an exact evaluation o f its effectiveness. For instance, if a trading rule is yet to close a position, or has never opened one at all, then any evaluation of its effectiveness must be incomplete. To protect rules that may be worthwhile but are too new to have developed a track record, the current realisable return from an open position is used as a proxy to the system performance. To prevent rules that are new and completely untested from squandering capital on unproven strategies, the recent performance of a strategy must exceed some threshold. This threshold is a combination of the trading costs and a moderate mean return per trade.

This system is not based on the conventional GA model o f generational replacement and fitness-based probabilistic selection. The population is kept constant but is replaced in an iterative manner. This is so that the GA can continue to run while the individual evaluations are being performed, which takes place on a rolling basis. It is important to recognise that the evaluations are only ever partially defined. Unusually for a GA, the objective is not to get the population to converge. In some respects this is similar to Harvey's SAGA[Harv92] which is a GA also designed not to converge. Instead, the objective is a diverse set of good rules and as many good fragments as

possible so that in an unforeseen shift o f the market, the system can (if need be) rapidly assemble completely new rules. However, if there is no selection pressure, the mean fitness of the population will not increase. Selection pressure is then exerted by selecting either a weak or duphcate rules from the existing rule set for replacement by the new individuals that are created by crossover and mutation. Duphcate rules are removed before weak rules. A weak rule may still add value but a duphcate rule wih not increase the information contained in the rules. Random rules are generated occasionahy to maintain a fundamental genetic diversity.