Journal of Heuristics

, Volume 18, Issue 4, pp 627–656 | Cite as

A Forex trading system based on a genetic algorithm

  • Luís Mendes
  • Pedro Godinho
  • Joana Dias


In this paper, a genetic algorithm will be described that aims at optimizing a set of rules that constitute a trading system for the Forex market. Each individual in the population represents a set of ten technical trading rules (five to enter a position and five others to exit). These rules have 31 parameters in total, which correspond to the individuals’ genes. The population will evolve in a given environment, defined by a time series of a specific currency pair. The fitness of a given individual represents how well it has been able to adapt to the environment, and it is calculated by applying the corresponding rules to the time series, and then calculating the ratio between the profit and the maximum drawdown (the Stirling ratio). Two currency pairs have been used: EUR/USD and GBP/USD. Different data was used for the evolution of the population and for testing the best individuals. The results achieved by the system are discussed. The best individuals are able to achieve very good results in the training series. In the test series, the developed strategies show some difficulty in achieving positive results, if you take transaction costs into account. If you ignore transaction costs, the results are mostly positive, showing that the best individuals have some forecasting ability.


Genetic algorithms Finance Technical trading rules Foreign exchange rates 



We would like to thank the anonymous referees, whose comments helped us improve this paper.


  1. Alvarez-Diaz, M., Alvarez, A.: Forecasting exchange rates using genetic algorithms. Appl. Econ. Lett. 10(6), 319–322 (2003) CrossRefGoogle Scholar
  2. Brabazon, A., O’Neill, M.: Evolving technical trading rules for spot foreign-exchange markets using grammatical evolution. Comput. Manag. Sci. 1(3), 311–327 (2004) zbMATHCrossRefGoogle Scholar
  3. Davis, L.: Handbook of Genetic Algorithms. Van Nostrand-Reinhold, New York (1991) Google Scholar
  4. Dempster, M.A.H., Jones, C.M.: A real-time adaptive trading system using genetic programming. Quant. Finance 1(4), 397–413 (2001) CrossRefGoogle Scholar
  5. Dunis, C., Harris, A., et al.: Optimising intraday trading models with genetic algorithms. Neural Netw. World 9(3), 193–223 (1999) Google Scholar
  6. Eling, M., Schuhmacher, F.: Does the choice of performance measure influence the evaluation of hedge funds? J. Bank. Finance 31(9), 2632–2647 (2007) CrossRefGoogle Scholar
  7. Fama, E.F.: Efficient capital markets: a review of theory and empirical work. J. Finance 25(2), 383–417 (1970) CrossRefGoogle Scholar
  8. Goldberg, D.: Genetic Algorithms in Search, Optimization and Machine Learning. Addison-Wesley, Reading (1989) zbMATHGoogle Scholar
  9. Grefenstette, J.J.: Genetic algorithms for changing environments. In: Parallel Problem Solving from Nature 2, Brussels (1992) Google Scholar
  10. Harding, D., Nakou, G., et al.: The pros and cons of “drawdown” as a statistical measure of risk for investments. AIMA Journal, April 16–17 (2003) Google Scholar
  11. Hirabayashi, A., Aranha, C., et al.: Optimization of the trading rule in foreign exchange using genetic algorithm. In: Proceedings of the 11th Annual Conference on Genetic and Evolutionary Computation GECCO’09 (2009) Google Scholar
  12. Hryshko, A., Downs, T.: System for foreign exchange trading using genetic algorithms and reinforcement learning. Int. J. Syst. Sci. 35(13), 763–774 (2004) zbMATHCrossRefGoogle Scholar
  13. Kaboudan, M.A.: Genetic programming prediction of stock prices. Comput. Econ. 16(3), 207–236 (2000) zbMATHCrossRefGoogle Scholar
  14. LeBaron, B.: Technical trading rule profitability and foreign exchange intervention. J. Int. Econ. 49(1), 125–143 (1999) CrossRefGoogle Scholar
  15. LeBaron, B.: Technical trading profitability in foreign exchange markets in the 1990s (2002) Google Scholar
  16. Levich, R.M., Thomas, L.R.: The significance of technical trading-rule profits in the foreign exchange market: a bootstrap approach. J. Int. Money Financ. 12(5), 451–474 (1993) CrossRefGoogle Scholar
  17. Lo, A.W.: The adaptive markets hypothesis. J. Portf. Manag. 30(5), 15–29 (2004) CrossRefGoogle Scholar
  18. Menkhoff, L., Taylor, M.P.: The obstinate passion of foreign exchange professionals: technical analysis. J. Econ. Lit. 45(4), 936–972 (2007) CrossRefGoogle Scholar
  19. Meyers, T.A.: The Technical Analysis Course. McGraw-Hill, New York (1989) Google Scholar
  20. Mitchell, M.: An Introduction to Genetic Algorithms. MIT Press, Cambridge (1996) Google Scholar
  21. Neely, C., Weller, P.: Intraday technical trading in the foreign exchange market. J. Int. Money Financ. 22(2), 223–237 (2003) CrossRefGoogle Scholar
  22. Neely, C., Weller, P., et al.: Is technical analysis in the foreign exchange market profitable? A genetic programming approach. J. Financ. Quant. Anal. 32(4), 405–426 (1997) CrossRefGoogle Scholar
  23. Neely, C.J., Weller, P.A., et al.: The adaptive markets hypothesis: evidence from the foreign exchange market. J. Financ. Quant. Anal. 44(02), 467–488 (2009) CrossRefGoogle Scholar
  24. Olson, D.: Have trading rule profits in the currency markets declined over time? J. Bank. Finance 28(1), 85–105 (2004) CrossRefGoogle Scholar
  25. Osman, I.H., Kelly, J.P.: Meta-Heuristics: Theory & Applications. Kluwer Academic, Dordrecht (1996) zbMATHGoogle Scholar
  26. Park, C.-H., Irwin, S.H.: What do we know about the profitability of technical analysis? J. Econ. Surv. 21(4), 786–826 (2007) CrossRefGoogle Scholar
  27. Pictet, O.V., Dacorogna, M.M., et al.: Using genetic algorithms for robust optimization in financial applications. Neural Netw. World 5(4), 573–587 (1995) Google Scholar
  28. Reeves, C.R.: Using genetic algorithms with small populations. In: Proceedings of the Fifth International Conference on Genetic Algorithms. Morgan Kaufmann, San Mateo (1993) Google Scholar
  29. Rothlauf, F., Goldberg, D.: Redundant representations in evolutionary computation. Illinois Genetic Algorithms Laboratory (IlliGAL) Report (2002) Google Scholar
  30. Schulmeister, S.: Components of the profitability of technical currency trading. Appl. Financ. Econ. 18(11), 917–930 (2008) CrossRefGoogle Scholar
  31. Sweeney, R.J.: Beating the foreign exchange market. J. Finance 41(1), 163–182 (1986) Google Scholar
  32. Wilson, G., Banzhaf, W.: Interday foreign exchange trading using linear genetic programming. In: Proceedings of the 12th Annual Conference on Genetic and Evolutionary Computation GECCO’10 (2010) Google Scholar

Copyright information

© Springer Science+Business Media, LLC 2012

Authors and Affiliations

  1. 1.Faculdade de EconomiaUniversidade de CoimbraCoimbraPortugal
  2. 2.Faculdade de Economia and GEMFUniversidade de CoimbraCoimbraPortugal
  3. 3.Faculdade de Economia and Inesc-CoimbraUniversidade de CoimbraCoimbraPortugal

Personalised recommendations