SlideShare une entreprise Scribd logo
1  sur  18
Case study: Using Grammatical Evolution to develop trading rules.
buy buy buy sell sell sell sell An automatic trading system decides when to buy and sell based on a certain rule set If we base the rules on moving averages (colored lines) one possible rule would be: buy, if yellow crosses above purple
The following  BNF  (Backus–Naur Form) grammar makes it easy to describe a whole  universe of different rule sets. <S> ::= <tradingrule> <tradingrule> ::= sigdn = ifelse(<signal>,-1,0);sigup = ifelse(<signal>,1,0); <signal> ::= (<signal>) AND (<signal>)|(<signal>) OR (<signal>)|<var> <relop> <var> <relop> ::=  <=  |  >= <var> ::= sma5|sma10|sma20|sma40|sma80|sma160
Such automatically generated trading rules can be tested on historical data. If we define a criterion for the quality of a trading rule we can then create an  algorithm that searches for the best possible set of trading rules. Grammatical Evolution
GEVA 2.0 That is the setup used for the result on the following slides.
BNF grammar The encoding and the grammar distinguishes Grammatical Evolution from Evolutionary Algorithms / Programming.
The following settings were used to construct a simple trading system. BNF grammar Settings for the genetic search algorithm
sigdn = ifelse( ( sma40 <= sma20 ) | ( sma160 >= sma80 ) ,-1,0); sigup = ifelse( sma5 <= sma10 ,1,0);  The winning trading rules after 100 generations are: The following formula has been used to calculate the fitness of each rule set.
The best trading rules applied to the S&P 500 from 2000-01-02 to 2008-12-05. This is not an realistic test for real world performance, please notice remarks on next slide.
Remarks: ,[object Object]
No commission was included, which might explain the many trades on the short side. But, It clearly shows that the algorithm was capable to find trading rules that make intuitively  sense and are profitable under the circumstances we provided. Further experiments with complexer grammar with more realistic settings is needed to obtain  further insides.
Software used ,[object Object]
R
R-package Quantmod and many more
 
 
Further examples of BNF to construction of trading rules.
 

Contenu connexe

Similaire à GEVA Case Study: Using Grammatical Evolution to Develop Automatic Trading Rules

PorfolioReport
PorfolioReportPorfolioReport
PorfolioReportAlbert Chu
 
Using Java & Genetic Algorithms to Beat the Market
Using Java & Genetic Algorithms to Beat the MarketUsing Java & Genetic Algorithms to Beat the Market
Using Java & Genetic Algorithms to Beat the MarketMatthew Ring
 
Deep Learning in Python with Tensorflow for Finance
Deep Learning in Python with Tensorflow for FinanceDeep Learning in Python with Tensorflow for Finance
Deep Learning in Python with Tensorflow for FinanceBen Ball
 
Stock price prediction using Neural Net
Stock price prediction using Neural NetStock price prediction using Neural Net
Stock price prediction using Neural NetRajat Sharma
 
Exante algotrading
Exante algotradingExante algotrading
Exante algotradingEXANTE
 
Droolsand Rule Based Systems 2008 Srping
Droolsand Rule Based Systems 2008 SrpingDroolsand Rule Based Systems 2008 Srping
Droolsand Rule Based Systems 2008 SrpingSrinath Perera
 
gatheral_financialrisks_paris2014.pdf
gatheral_financialrisks_paris2014.pdfgatheral_financialrisks_paris2014.pdf
gatheral_financialrisks_paris2014.pdfTomHardy96
 
Algorithmic Trading and its Impact on the Market
Algorithmic Trading and its Impact on the MarketAlgorithmic Trading and its Impact on the Market
Algorithmic Trading and its Impact on the MarketIRJET Journal
 
Quantitative finance 101
Quantitative finance 101Quantitative finance 101
Quantitative finance 101Martin Froehler
 
Quantitative finance 101
Quantitative finance 101Quantitative finance 101
Quantitative finance 101Martin Froehler
 
Stock trade wire review
Stock trade wire reviewStock trade wire review
Stock trade wire reviewNazmul Shakil
 
Friends let real friends use MySQL 8.0
Friends let real friends use MySQL 8.0Friends let real friends use MySQL 8.0
Friends let real friends use MySQL 8.0SaverioM
 
How to add and delete ont on the olt device
How to add and delete ont on the olt deviceHow to add and delete ont on the olt device
How to add and delete ont on the olt deviceHuanetwork
 
Expert Advisor Technology Ver2
Expert Advisor Technology Ver2Expert Advisor Technology Ver2
Expert Advisor Technology Ver2guest125891
 
solidity programming solidity programming
solidity programming solidity programmingsolidity programming solidity programming
solidity programming solidity programmingMohan Kumar Ch
 
Databricks-EN-2.pdf
Databricks-EN-2.pdfDatabricks-EN-2.pdf
Databricks-EN-2.pdfrutgermcgeek
 

Similaire à GEVA Case Study: Using Grammatical Evolution to Develop Automatic Trading Rules (20)

PorfolioReport
PorfolioReportPorfolioReport
PorfolioReport
 
10.1.1.129.1408
10.1.1.129.140810.1.1.129.1408
10.1.1.129.1408
 
Using Java & Genetic Algorithms to Beat the Market
Using Java & Genetic Algorithms to Beat the MarketUsing Java & Genetic Algorithms to Beat the Market
Using Java & Genetic Algorithms to Beat the Market
 
Deep Learning in Python with Tensorflow for Finance
Deep Learning in Python with Tensorflow for FinanceDeep Learning in Python with Tensorflow for Finance
Deep Learning in Python with Tensorflow for Finance
 
Stock price prediction using Neural Net
Stock price prediction using Neural NetStock price prediction using Neural Net
Stock price prediction using Neural Net
 
Exante algotrading
Exante algotradingExante algotrading
Exante algotrading
 
Droolsand Rule Based Systems 2008 Srping
Droolsand Rule Based Systems 2008 SrpingDroolsand Rule Based Systems 2008 Srping
Droolsand Rule Based Systems 2008 Srping
 
gatheral_financialrisks_paris2014.pdf
gatheral_financialrisks_paris2014.pdfgatheral_financialrisks_paris2014.pdf
gatheral_financialrisks_paris2014.pdf
 
Algorithmic Trading and its Impact on the Market
Algorithmic Trading and its Impact on the MarketAlgorithmic Trading and its Impact on the Market
Algorithmic Trading and its Impact on the Market
 
Quantitative finance 101
Quantitative finance 101Quantitative finance 101
Quantitative finance 101
 
Quantitative finance 101
Quantitative finance 101Quantitative finance 101
Quantitative finance 101
 
Dynamic stopcharts
Dynamic stopchartsDynamic stopcharts
Dynamic stopcharts
 
Algo Trading
Algo TradingAlgo Trading
Algo Trading
 
Stock trade wire review
Stock trade wire reviewStock trade wire review
Stock trade wire review
 
Friends let real friends use MySQL 8.0
Friends let real friends use MySQL 8.0Friends let real friends use MySQL 8.0
Friends let real friends use MySQL 8.0
 
How to add and delete ont on the olt device
How to add and delete ont on the olt deviceHow to add and delete ont on the olt device
How to add and delete ont on the olt device
 
Expert Advisor Technology Ver2
Expert Advisor Technology Ver2Expert Advisor Technology Ver2
Expert Advisor Technology Ver2
 
Rsockets ofa12
Rsockets ofa12Rsockets ofa12
Rsockets ofa12
 
solidity programming solidity programming
solidity programming solidity programmingsolidity programming solidity programming
solidity programming solidity programming
 
Databricks-EN-2.pdf
Databricks-EN-2.pdfDatabricks-EN-2.pdf
Databricks-EN-2.pdf
 

Dernier

(办理原版一样)QUT毕业证昆士兰科技大学毕业证学位证留信学历认证成绩单补办
(办理原版一样)QUT毕业证昆士兰科技大学毕业证学位证留信学历认证成绩单补办(办理原版一样)QUT毕业证昆士兰科技大学毕业证学位证留信学历认证成绩单补办
(办理原版一样)QUT毕业证昆士兰科技大学毕业证学位证留信学历认证成绩单补办fqiuho152
 
2024 Q1 Crypto Industry Report | CoinGecko
2024 Q1 Crypto Industry Report | CoinGecko2024 Q1 Crypto Industry Report | CoinGecko
2024 Q1 Crypto Industry Report | CoinGeckoCoinGecko
 
Managing Finances in a Small Business (yes).pdf
Managing Finances  in a Small Business (yes).pdfManaging Finances  in a Small Business (yes).pdf
Managing Finances in a Small Business (yes).pdfmar yame
 
NO1 Certified Black Magic Specialist Expert In Bahawalpur, Sargodha, Sialkot,...
NO1 Certified Black Magic Specialist Expert In Bahawalpur, Sargodha, Sialkot,...NO1 Certified Black Magic Specialist Expert In Bahawalpur, Sargodha, Sialkot,...
NO1 Certified Black Magic Specialist Expert In Bahawalpur, Sargodha, Sialkot,...Amil baba
 
Stock Market Brief Deck FOR 4/17 video.pdf
Stock Market Brief Deck FOR 4/17 video.pdfStock Market Brief Deck FOR 4/17 video.pdf
Stock Market Brief Deck FOR 4/17 video.pdfMichael Silva
 
Tenets of Physiocracy History of Economic
Tenets of Physiocracy History of EconomicTenets of Physiocracy History of Economic
Tenets of Physiocracy History of Economiccinemoviesu
 
NCDC and NAFED presentation by Paras .pptx
NCDC and NAFED presentation by Paras .pptxNCDC and NAFED presentation by Paras .pptx
NCDC and NAFED presentation by Paras .pptxnaikparas90
 
『澳洲文凭』买科廷大学毕业证书成绩单办理澳洲Curtin文凭学位证书
『澳洲文凭』买科廷大学毕业证书成绩单办理澳洲Curtin文凭学位证书『澳洲文凭』买科廷大学毕业证书成绩单办理澳洲Curtin文凭学位证书
『澳洲文凭』买科廷大学毕业证书成绩单办理澳洲Curtin文凭学位证书rnrncn29
 
《加拿大本地办假证-寻找办理Dalhousie毕业证和达尔豪斯大学毕业证书的中介代理》
《加拿大本地办假证-寻找办理Dalhousie毕业证和达尔豪斯大学毕业证书的中介代理》《加拿大本地办假证-寻找办理Dalhousie毕业证和达尔豪斯大学毕业证书的中介代理》
《加拿大本地办假证-寻找办理Dalhousie毕业证和达尔豪斯大学毕业证书的中介代理》rnrncn29
 
Market Morning Updates for 16th April 2024
Market Morning Updates for 16th April 2024Market Morning Updates for 16th April 2024
Market Morning Updates for 16th April 2024Devarsh Vakil
 
Vp Girls near me Delhi Call Now or WhatsApp
Vp Girls near me Delhi Call Now or WhatsAppVp Girls near me Delhi Call Now or WhatsApp
Vp Girls near me Delhi Call Now or WhatsAppmiss dipika
 
Bladex 1Q24 Earning Results Presentation
Bladex 1Q24 Earning Results PresentationBladex 1Q24 Earning Results Presentation
Bladex 1Q24 Earning Results PresentationBladex
 
PMFBY , Pradhan Mantri Fasal bima yojna
PMFBY , Pradhan Mantri  Fasal bima yojnaPMFBY , Pradhan Mantri  Fasal bima yojna
PMFBY , Pradhan Mantri Fasal bima yojnaDharmendra Kumar
 
The Triple Threat | Article on Global Resession | Harsh Kumar
The Triple Threat | Article on Global Resession | Harsh KumarThe Triple Threat | Article on Global Resession | Harsh Kumar
The Triple Threat | Article on Global Resession | Harsh KumarHarsh Kumar
 
magnetic-pensions-a-new-blueprint-for-the-dc-landscape.pdf
magnetic-pensions-a-new-blueprint-for-the-dc-landscape.pdfmagnetic-pensions-a-new-blueprint-for-the-dc-landscape.pdf
magnetic-pensions-a-new-blueprint-for-the-dc-landscape.pdfHenry Tapper
 
原版1:1复刻温哥华岛大学毕业证Vancouver毕业证留信学历认证
原版1:1复刻温哥华岛大学毕业证Vancouver毕业证留信学历认证原版1:1复刻温哥华岛大学毕业证Vancouver毕业证留信学历认证
原版1:1复刻温哥华岛大学毕业证Vancouver毕业证留信学历认证rjrjkk
 
NO1 Certified Amil Baba In Lahore Kala Jadu In Lahore Best Amil In Lahore Ami...
NO1 Certified Amil Baba In Lahore Kala Jadu In Lahore Best Amil In Lahore Ami...NO1 Certified Amil Baba In Lahore Kala Jadu In Lahore Best Amil In Lahore Ami...
NO1 Certified Amil Baba In Lahore Kala Jadu In Lahore Best Amil In Lahore Ami...Amil baba
 
The Core Functions of the Bangko Sentral ng Pilipinas
The Core Functions of the Bangko Sentral ng PilipinasThe Core Functions of the Bangko Sentral ng Pilipinas
The Core Functions of the Bangko Sentral ng PilipinasCherylouCamus
 
government_intervention_in_business_ownership[1].pdf
government_intervention_in_business_ownership[1].pdfgovernment_intervention_in_business_ownership[1].pdf
government_intervention_in_business_ownership[1].pdfshaunmashale756
 
Role of Information and technology in banking and finance .pptx
Role of Information and technology in banking and finance .pptxRole of Information and technology in banking and finance .pptx
Role of Information and technology in banking and finance .pptxNarayaniTripathi2
 

Dernier (20)

(办理原版一样)QUT毕业证昆士兰科技大学毕业证学位证留信学历认证成绩单补办
(办理原版一样)QUT毕业证昆士兰科技大学毕业证学位证留信学历认证成绩单补办(办理原版一样)QUT毕业证昆士兰科技大学毕业证学位证留信学历认证成绩单补办
(办理原版一样)QUT毕业证昆士兰科技大学毕业证学位证留信学历认证成绩单补办
 
2024 Q1 Crypto Industry Report | CoinGecko
2024 Q1 Crypto Industry Report | CoinGecko2024 Q1 Crypto Industry Report | CoinGecko
2024 Q1 Crypto Industry Report | CoinGecko
 
Managing Finances in a Small Business (yes).pdf
Managing Finances  in a Small Business (yes).pdfManaging Finances  in a Small Business (yes).pdf
Managing Finances in a Small Business (yes).pdf
 
NO1 Certified Black Magic Specialist Expert In Bahawalpur, Sargodha, Sialkot,...
NO1 Certified Black Magic Specialist Expert In Bahawalpur, Sargodha, Sialkot,...NO1 Certified Black Magic Specialist Expert In Bahawalpur, Sargodha, Sialkot,...
NO1 Certified Black Magic Specialist Expert In Bahawalpur, Sargodha, Sialkot,...
 
Stock Market Brief Deck FOR 4/17 video.pdf
Stock Market Brief Deck FOR 4/17 video.pdfStock Market Brief Deck FOR 4/17 video.pdf
Stock Market Brief Deck FOR 4/17 video.pdf
 
Tenets of Physiocracy History of Economic
Tenets of Physiocracy History of EconomicTenets of Physiocracy History of Economic
Tenets of Physiocracy History of Economic
 
NCDC and NAFED presentation by Paras .pptx
NCDC and NAFED presentation by Paras .pptxNCDC and NAFED presentation by Paras .pptx
NCDC and NAFED presentation by Paras .pptx
 
『澳洲文凭』买科廷大学毕业证书成绩单办理澳洲Curtin文凭学位证书
『澳洲文凭』买科廷大学毕业证书成绩单办理澳洲Curtin文凭学位证书『澳洲文凭』买科廷大学毕业证书成绩单办理澳洲Curtin文凭学位证书
『澳洲文凭』买科廷大学毕业证书成绩单办理澳洲Curtin文凭学位证书
 
《加拿大本地办假证-寻找办理Dalhousie毕业证和达尔豪斯大学毕业证书的中介代理》
《加拿大本地办假证-寻找办理Dalhousie毕业证和达尔豪斯大学毕业证书的中介代理》《加拿大本地办假证-寻找办理Dalhousie毕业证和达尔豪斯大学毕业证书的中介代理》
《加拿大本地办假证-寻找办理Dalhousie毕业证和达尔豪斯大学毕业证书的中介代理》
 
Market Morning Updates for 16th April 2024
Market Morning Updates for 16th April 2024Market Morning Updates for 16th April 2024
Market Morning Updates for 16th April 2024
 
Vp Girls near me Delhi Call Now or WhatsApp
Vp Girls near me Delhi Call Now or WhatsAppVp Girls near me Delhi Call Now or WhatsApp
Vp Girls near me Delhi Call Now or WhatsApp
 
Bladex 1Q24 Earning Results Presentation
Bladex 1Q24 Earning Results PresentationBladex 1Q24 Earning Results Presentation
Bladex 1Q24 Earning Results Presentation
 
PMFBY , Pradhan Mantri Fasal bima yojna
PMFBY , Pradhan Mantri  Fasal bima yojnaPMFBY , Pradhan Mantri  Fasal bima yojna
PMFBY , Pradhan Mantri Fasal bima yojna
 
The Triple Threat | Article on Global Resession | Harsh Kumar
The Triple Threat | Article on Global Resession | Harsh KumarThe Triple Threat | Article on Global Resession | Harsh Kumar
The Triple Threat | Article on Global Resession | Harsh Kumar
 
magnetic-pensions-a-new-blueprint-for-the-dc-landscape.pdf
magnetic-pensions-a-new-blueprint-for-the-dc-landscape.pdfmagnetic-pensions-a-new-blueprint-for-the-dc-landscape.pdf
magnetic-pensions-a-new-blueprint-for-the-dc-landscape.pdf
 
原版1:1复刻温哥华岛大学毕业证Vancouver毕业证留信学历认证
原版1:1复刻温哥华岛大学毕业证Vancouver毕业证留信学历认证原版1:1复刻温哥华岛大学毕业证Vancouver毕业证留信学历认证
原版1:1复刻温哥华岛大学毕业证Vancouver毕业证留信学历认证
 
NO1 Certified Amil Baba In Lahore Kala Jadu In Lahore Best Amil In Lahore Ami...
NO1 Certified Amil Baba In Lahore Kala Jadu In Lahore Best Amil In Lahore Ami...NO1 Certified Amil Baba In Lahore Kala Jadu In Lahore Best Amil In Lahore Ami...
NO1 Certified Amil Baba In Lahore Kala Jadu In Lahore Best Amil In Lahore Ami...
 
The Core Functions of the Bangko Sentral ng Pilipinas
The Core Functions of the Bangko Sentral ng PilipinasThe Core Functions of the Bangko Sentral ng Pilipinas
The Core Functions of the Bangko Sentral ng Pilipinas
 
government_intervention_in_business_ownership[1].pdf
government_intervention_in_business_ownership[1].pdfgovernment_intervention_in_business_ownership[1].pdf
government_intervention_in_business_ownership[1].pdf
 
Role of Information and technology in banking and finance .pptx
Role of Information and technology in banking and finance .pptxRole of Information and technology in banking and finance .pptx
Role of Information and technology in banking and finance .pptx
 

GEVA Case Study: Using Grammatical Evolution to Develop Automatic Trading Rules

  • 1. Case study: Using Grammatical Evolution to develop trading rules.
  • 2. buy buy buy sell sell sell sell An automatic trading system decides when to buy and sell based on a certain rule set If we base the rules on moving averages (colored lines) one possible rule would be: buy, if yellow crosses above purple
  • 3. The following BNF (Backus–Naur Form) grammar makes it easy to describe a whole universe of different rule sets. <S> ::= <tradingrule> <tradingrule> ::= sigdn = ifelse(<signal>,-1,0);sigup = ifelse(<signal>,1,0); <signal> ::= (<signal>) AND (<signal>)|(<signal>) OR (<signal>)|<var> <relop> <var> <relop> ::= <= | >= <var> ::= sma5|sma10|sma20|sma40|sma80|sma160
  • 4. Such automatically generated trading rules can be tested on historical data. If we define a criterion for the quality of a trading rule we can then create an algorithm that searches for the best possible set of trading rules. Grammatical Evolution
  • 5. GEVA 2.0 That is the setup used for the result on the following slides.
  • 6. BNF grammar The encoding and the grammar distinguishes Grammatical Evolution from Evolutionary Algorithms / Programming.
  • 7. The following settings were used to construct a simple trading system. BNF grammar Settings for the genetic search algorithm
  • 8. sigdn = ifelse( ( sma40 <= sma20 ) | ( sma160 >= sma80 ) ,-1,0); sigup = ifelse( sma5 <= sma10 ,1,0); The winning trading rules after 100 generations are: The following formula has been used to calculate the fitness of each rule set.
  • 9. The best trading rules applied to the S&P 500 from 2000-01-02 to 2008-12-05. This is not an realistic test for real world performance, please notice remarks on next slide.
  • 10.
  • 11. No commission was included, which might explain the many trades on the short side. But, It clearly shows that the algorithm was capable to find trading rules that make intuitively sense and are profitable under the circumstances we provided. Further experiments with complexer grammar with more realistic settings is needed to obtain further insides.
  • 12.
  • 13. R
  • 15.  
  • 16.  
  • 17. Further examples of BNF to construction of trading rules.
  • 18.  
  • 19.
  • 20.
  • 21. Edit run configuration for Main class “ Main.RunTradSys”
  • 22. Extensions of the GEVA 2.0 code and files needed to modify the rule generation. Setup GEVA and starts instance of R Here get the rule sets pushed into R and feedback captured R files to setup the data and evaluate the rule sets. BNF grammar Properties for genetic search.