Download presentation

Presentation is loading. Please wait.

Published byDustin Roylance Modified over 3 years ago

1
A real-time adaptive trading system using Genetic Programming QF5205 : Topics in Quantitative Finance Donny Lee Nadim Mouchonnet

2
Summary 1.Introduction 2.Genetic Algorithm and Genetic Programming 3.Trading System 4.Genetic Program 5.Results

3
Introduction Many traders use indicator based trading rules … but they may be loss making (see chart) Double Objective Create a system than trades and make profit Emulate the behavior of a technical trader Motivation: “Can a technical trader consistently make a profit?” and “should a technical trader or trading system adapt to market conditions or is it better to use a static system?”

4
Introduction(2) Results using only a single strategy, backtested on historical data. Stochastic strategy: Buy when indicator crosses the 20% mark from below and sell when it crosses the 70% mark from above. Simple moving average strategy: Buy when the slow lag (50 day look back) crosses the fast lag (20 day look back) from below and sell when vice versa.

5
Introduction(3) Using the stochastic strategy on SIA stock from 02/11/10 to 08/26/10. Loss is $0.30.

6
Introduction(4) Using the SMA strategy on KEP stock from 02/11/10 to 08/26/10. Loss is $0.27.

7
Introduction(5) Using the GBPUSD for a period of 3 months Bloomberg can summarize a whole bunch of strategies

8
Introduction(6) Using the GBPUSD for a period of 3 months Parabolic SAR

9
Genetic Algorithm and Genetic Programming (1) GA is an iterative system … aiming to find near-optimal solutions … to multi-extremal problems … by imitating the process of evolution Rule is : SURVIVAL OF THE FITTEST

10
Genetic Algorithm and Genetic Programming (2) GA representation consists of binary strings of fixed length. Search space is finite GA needs to be initialized … … by random sampling Difference between GA and GP is that GP allows string length to vary within the solution space.

11
Trading System : Data Analysis carried out on spot FX ticks for GBP/USD from CQG Data Factory and Future Source from 1994 to 1997 CQG : gathered from various FX brokers Future Source : live feed from the Omega TradeStation utility (major banks FX quotes) Got bid and ask and transforms them into mid Data aggregated into OHLC

12
Trading System : Software Imitating the technical trader i.e. chooses technical strategies from a range of popular trading rules GP based rule selection engine choosing combinations of such strategies Cash management filter exits strategies when losses > user-defined threshold Each backtested strategy returns : Profit, max drawdown, Modified Stirling ratio, number of trades Transaction costs are taken into account with various slippage depending on trading time

13
Trading System : Software

14
Trading System : Strategies 6 Rules used : simple moving averages crossover, adaptive moving averages, price channel breakout, stochastic, relative strength index, commodity channel index 3 Connectors : AND / OR / XOR (00/01/10) System rules allowed to use different frequencies/lags Strategies ranked by stirling ratio (when return is positive) or by absolute return when negative.

15
Genetic Program Representation of a strategy. A strategy of ours can be represented graphically.

16
Genetic Program(2) From a graphical understanding of a strategy, we can translate to a strategy structure. or a binary string representation.

17
Genetic Program(3) Or a binary string representation.

18
Genetic Program(4) This is essential as we ultimately need to convert our strategy into a binary string for our GP to work. Each strategy can be written in the form RULE | CONDITION | CONNECTOR | RULE | CONDITION | CONNECTOR | ……… | ACTION

19
Genetic Program(5) From there, we can form our binary string representation for our GP. I.e., consider the rule “BUY if AMA TRUE AND CCI FALSE OR RSI TRUE” It would be represented in binary as, 1000011111

20
Genetic Program(6) Now with each strategy represented as a binary string, we perform the following in each iteration. 1.Initialize population 2.Calculate Fitness 3.Crossover 4.Mutate

21
Genetic Program(7) We initial the population with a certain number of strings which will represents the strategies we will use. 1.Assume there are a maximum of k included indicators and a minimum of j. We may construct rules from a total of I indicators. 2.Generate U uniform pseudo-random integer variables V where 1 <= V <= I. For indicators to be used, we write a ‘1’ in the structure part, otherwise a ‘0’. 3.Generate U uniform pseudo-random binary variables corresponding to the indictor bit for each indicator. 4.Assume there are C connectors allowed. For each indicator, we generate a fixed width binary of D(1,C) and write it next to the corresponding indicator bit.

22
Genetic Program(8) At each trial over a user-defined period, each of these strategies is tested by simulating their trading performance over historical data. There are many ways to assess performance. The Stirling ratio – profit divided by maximum drawdown – is often used by traders to assess performance. For Crossover and Mutation, we would pick a strategies with a certain top % in their Stirling ratio.

23
Genetic Program(9) Crossover is the process of cutting strategy string pairs at points and exchanging tails and heads to make a new a pair. Only the best s% are considered for crossover. For those strings rank i, the probability of selecting this string is A cut point is selected uniformly pseudo-randomly and ‘head’ and ‘tail’ parts are exchange.

24
Genetic Program(10) An example of a Crossover, suppose the following two pairs of strings are selected along with a uniformly distributed random number: 1010001010 and 1100111100 and 3 0100100111 and 0001101110 and 8 Crossover: 101|0001010 and 110|0111100 becomes 1100001010 and 1010111100 01001001|11 and 00011011|10 becomes 0100100110 and 0001101111

25
Genetic Program(11) Mutation is the process of randomly changing appropriate bits in a strategy string and is executed in a bitwise manner. Elitist model: top-ranked 5% of strings are not mutated. Number of strings mutated = Mutation Rate x No. of Strings. M uniform pseudo-random integer are generated between 1 and B, length of each string, without replacement. Each corresponding numbered bit is then mutated (‘0’ becomes ‘1’ and ‘1’ becomes ‘0’)

26
Genetic Program(12) Example of a mutation. Strings are of length 10 and four pseudo-random integers are generated and arranged in ascending order – 3, 5, 7, 8. The following strings are mutated as follows: 1010001010 becomes 1000100110 1100111100 becomes 1110010000 0100100110 becomes 0110001010 0001101110 becomes 0011000010

27
Genetic Program : Summary Step 1 Initialize : Generate 100 strategies randomly Step 2 Crossover strategies using 50% of the best strategies Step 3 Mutate the strategies outside the best 5% Step 4 Repeat Steps 2 & 3 until convergence of the solutions

28
Results : Test Step 1 : In Sample backtesting using 15- minute data used to determine the 20 best strategies during Q1 1994 Step 2 : Out Sample trading using the best 20 strategies over the next quarters and assess the performance in live trading conditions

29
Results : Improvement of solutions (1)

30
Results : Improvement of solutions (2)

31
Results : Profit

32
Results : Further work Periodic reoptimization as performance decreases as time out of sample increases Parallel optimization

33
Our experience Unsuccessful Programming in the Java framework 1 solution : using the Technical Analysis tool of Bloomberg’s Excel Add-in

Similar presentations

Presentation is loading. Please wait....

OK

Genetic Algorithm.

Genetic Algorithm.

© 2018 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on tourism and hospitality Ppt on new company act 2013 Ppt on corruption in hindi language Ppt on nitrogen cycle Ppt on velocity time graph Ppt on sources of energy for class 8th Ppt on revolution of the earth and seasons worksheet File type ppt on cybercrime convention Ppt on inertial frame of reference Ppt on dc power supply