Download - Index Trading Using Grammatical Evolution
-
8/6/2019 Index Trading Using Grammatical Evolution
1/20
INDEXTRADING USING
GRAMMATICAL EVOLUTION
Munagala Venkatesh
200701237
Supervisor
Prof. Samaresh Chatterji1
-
8/6/2019 Index Trading Using Grammatical Evolution
2/20
INDEX
Problem definition
Introduction Technical indicators
Genetic algorithm
Mapping process Fitness function
Results
AnalysisAcknowledgement
References2
-
8/6/2019 Index Trading Using Grammatical Evolution
3/20
PROBLEM DEFINITION
Implementing the index trading model
developed by Dr. Anthony Brabazon.
Improving the performance of the
system by changing the genetic
parameters.
3
-
8/6/2019 Index Trading Using Grammatical Evolution
4/20
INTRODUCTION
Index trading is an example of program trading
where a fixed amount of money is invested in themarket index (or fixed amount of investment is
sold out) based on the trading signal buy (or
sell) generated by the trading system.
The trading system uses technical indicators for
generating the trading signal.
Enumeratively trying all possible combinations is
very difficult.4
-
8/6/2019 Index Trading Using Grammatical Evolution
5/20
TECHNICAL INDICATORS
Moving average:They compare current price with the moving average of theprice.
Current price > moving average increasing trend
Ma(int, day)
Momentum:price(t) / price(t-x)
Reduction in upward momentum market over brought
Reduction in downward momentum market over sold5
-
8/6/2019 Index Trading Using Grammatical Evolution
6/20
GENETIC ALGORITHM
Initially N candidate solutions encoded in thebinary strings are selected for first generation.
Fitness is calculated for each of them usingfitness function defined for that specific problem.
Select a pair of binary strings from the currentpopulation, the probability of selection being anincrease function of fitness.
With probability pc crossover the pair to form twooffsprings and with probability pm mutateoffsprings at each position and finally add themto the new population. 6
-
8/6/2019 Index Trading Using Grammatical Evolution
7/20
GENETIC ALGORITHM (CONTINUED)
Repeat the previous two steps until the size of
new population becomes N.
Now replace the current population with new
population for the next generation of algorithm.
After several generations best solution is evolved.
7
-
8/6/2019 Index Trading Using Grammatical Evolution
8/20
GENETIC ALGORITHM (CONTINUED)
Selection:
1.) Roulette wheel2.) Tournament selection
Replacement1.) General
2.) Steady state
8
-
8/6/2019 Index Trading Using Grammatical Evolution
9/20
MAPPING PROCESS
::=
::= (,) | (,) |
|
::= f_and | f_or
::= greater | lesser
::= + | - | *
::= | ma( , day ) | momentum ( , day) |trb ( , day)
::= 1 | 2 | 3 | 4 | 5 | 10
9
-
8/6/2019 Index Trading Using Grammatical Evolution
10/20
MAPPING PROCESS (CONTINUED)
11100010111000011101001010010100101010..
Codons are generated for the binary string taking 8bits at a time and converting to an integer.
226 225 213 83 .
::= greater | lesser
Two possibilities, so we use the formula
rule = c mod r; c=codon value, r= no. of possibilities.In our example rule = c mod 2
if rule = 0, we choosegreater
if rule = 1, we choose lesser10
-
8/6/2019 Index Trading Using Grammatical Evolution
11/20
MAPPING PROCESS (CONTINUED)
Consider the following codon string
225 84 150 34 167 45
Start with the start symbol
::= , only one possibility225 mod1=0
::= (,) | (,) |
| 11
-
8/6/2019 Index Trading Using Grammatical Evolution
12/20
MAPPING PROCESS (CONTINUED)
There are 4 possibilities. Take the nest codon 85
85 mod4 = 1, so choose second possibility (,)
With the next codon 150, use production rule for the
non-terminal from left-side.
In this way the codon string can be mapped to a
solution like
f_and ( lesser ( trb ( 4 , day ) , trb ( 3 , day ) ) , lesser (
momentum ( 1 , day ) , momentum ( 3 , day ) ) )12
-
8/6/2019 Index Trading Using Grammatical Evolution
13/20
FITNESS FUNCTION
The fitness is calculated over the FTSE data set
of 440 days.
Using the solution formed from the grammar
trading signal (buy or sell ) is generated.
According to it $1000 is invested in the market or
shares for $1000 are sold out.
The total profit gained over 440 days is assignedas fitness to the solution.
13
-
8/6/2019 Index Trading Using Grammatical Evolution
14/20
RESULTS
Replacement: Steady
stateSelection:Roulette wheel
wheel
Replacement: General
Selection: Roulettewheel
Training period
(days)
Profit
(US$)
Train (75 to 440) 4834
Test 1 (440 to 805) 5968
Test 2 (805 to 1170) -2466
Test 3 (1170 to 1535) 2805
Test 4 (1535 to 1900) 866
Training period
(days)
Profit
(US$)
Train (75 to 440) 2838
Test 1 (440 to 805) 4988
Test 2 (805 to 1170) 279
Test 3 (1170 to 1535) 2325
Test 4 (1535 to 1900) 81214
-
8/6/2019 Index Trading Using Grammatical Evolution
15/20
RESULTS (CONTINUED)
Replacement: Steady
stateSelection: Tournament
Replacement: General
Selection: Tournament
Training period
(days)
Profit
(US$)
Train (75 to 440) 4921
Test 1 (440 to 805) 5182
Test 2 (805 to 1170) 1666
Test 3 (1170 to 1535) 2238
Test 4 (1535 to 1900) 1356
Training period
(days)
Profit
(US$)
Train (75 to 440) 4584
Test 1 (440 to 805) 5780
Test 2 (805 to 1170) -2225
Test 3 (1170 to 1535) 2746
Test 4 (1535 to 1900) 97115
-
8/6/2019 Index Trading Using Grammatical Evolution
16/20
ANALYSIS
Results for the model
developed by AnthonyBrabazon.
Selection: Steady state
Replacement:Tournament
Training period
(days)
Profit
(US$)
Train (75 to 440) 3071
Test 1 (440 to 805) 5244
Test 2 (805 to 1170) -1376
Test 3 (1170 to 1535) 1979
Test 4 (1535 to 1900) 1568
Training period
(days)
Profit
(US$)
Train (75 to 440) 4921
Test 1 (440 to 805) 5182
Test 2 (805 to 1170) 1666
Test 3 (1170 to 1535) 2238
Test 4 (1535 to 1900) 135616
-
8/6/2019 Index Trading Using Grammatical Evolution
17/20
CONCLUSION
More profit ($15363) is obtained in case 3 in whichselection method and replacement strategy is tournament
and steady state respectively.
Best individuals of past generations are retained in futuregenerations as we used steady state replacement and atthe same time using tournament selection there is a
possibility of generating better children with worst parents.
Thus the results justified the efficiency of genetic algorithmparameters.
The time taken for each run of the genetic algorithm is lessthan a minute and sometimes it is very fast also, so we canmany solve many np-hard problems which requiresexponential time using the evolutionary programmingapproach.
17
-
8/6/2019 Index Trading Using Grammatical Evolution
18/20
ACKNOWLEDGMENT
I would like to thank Prof.Samaresh Chatterji for
his proper guidance and who was always there tohelp me whenever I faced the problem.
18
-
8/6/2019 Index Trading Using Grammatical Evolution
19/20
REFERENCES
NYSE(2005). Market Information-Quick reference sheet,http://www.nyse.com
Anthony Brabazon, Michael ONeill (2006) Biologically inspiredalgorithms for financial modeling. pp. 183-192 ISBN 3-540-26252-0
Melanie Mitchell (1996), An Introduction to Genetic algorithms, pp.1-15, ISBN-81-203-1358-5.
Murphy, John J. (1999). Technical Analysis of the Financial markets,New York: New York institute of finance.
Brock, W., Lakonishok, J. and LeBaron B. (1992). Simple technical
trading rules and the stochastic properties of stock returns, Journalof finance, 47(5):1731-1764.
Glassman, R. (1973). Persistence and loose coupling in living systems,Behavioral science18:83-98. 19
-
8/6/2019 Index Trading Using Grammatical Evolution
20/20
THANK YOU
20