Abstract
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.
Similar content being viewed by others
Notes
We speak of abnormal returns, or excess returns, when the returns of the investment strategy exceed those of a benchmark with a similar level of risk. The appropriate benchmarks depend on the type of investment considered. Given the type of investment we consider in this paper, we define the benchmark as the zero profit (no profit/no loss) case (as explained in Sect. 2.4).
In a currency pair, the first currency is the base currency and the second is the quote currency. This paper uses the currency codes defined by ISO 4217. USD is the United States dollar, GBP is the pound sterling, EUR is the euro, DEM is the German mark and JPY is the Japanese yen.
There are some slightly different definitions for the Stirling ratio. In this paper, we use the same definition as Hryshko and Downs.
A pip (percentage in point) is the smallest price change that a given exchange rate can take. For instance, the EUR/USD pair is priced to four decimal places, so a pip will be a unit change in the fourth decimal place. If the exchange rate increases from 1.4500 to 1.4505, it is said to have increased by 5 pips.
Data available at ratedata.gaincapital.com.
References
Alvarez-Diaz, M., Alvarez, A.: Forecasting exchange rates using genetic algorithms. Appl. Econ. Lett. 10(6), 319–322 (2003)
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)
Davis, L.: Handbook of Genetic Algorithms. Van Nostrand-Reinhold, New York (1991)
Dempster, M.A.H., Jones, C.M.: A real-time adaptive trading system using genetic programming. Quant. Finance 1(4), 397–413 (2001)
Dunis, C., Harris, A., et al.: Optimising intraday trading models with genetic algorithms. Neural Netw. World 9(3), 193–223 (1999)
Eling, M., Schuhmacher, F.: Does the choice of performance measure influence the evaluation of hedge funds? J. Bank. Finance 31(9), 2632–2647 (2007)
Fama, E.F.: Efficient capital markets: a review of theory and empirical work. J. Finance 25(2), 383–417 (1970)
Goldberg, D.: Genetic Algorithms in Search, Optimization and Machine Learning. Addison-Wesley, Reading (1989)
Grefenstette, J.J.: Genetic algorithms for changing environments. In: Parallel Problem Solving from Nature 2, Brussels (1992)
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)
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)
Hryshko, A., Downs, T.: System for foreign exchange trading using genetic algorithms and reinforcement learning. Int. J. Syst. Sci. 35(13), 763–774 (2004)
Kaboudan, M.A.: Genetic programming prediction of stock prices. Comput. Econ. 16(3), 207–236 (2000)
LeBaron, B.: Technical trading rule profitability and foreign exchange intervention. J. Int. Econ. 49(1), 125–143 (1999)
LeBaron, B.: Technical trading profitability in foreign exchange markets in the 1990s (2002)
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)
Lo, A.W.: The adaptive markets hypothesis. J. Portf. Manag. 30(5), 15–29 (2004)
Menkhoff, L., Taylor, M.P.: The obstinate passion of foreign exchange professionals: technical analysis. J. Econ. Lit. 45(4), 936–972 (2007)
Meyers, T.A.: The Technical Analysis Course. McGraw-Hill, New York (1989)
Mitchell, M.: An Introduction to Genetic Algorithms. MIT Press, Cambridge (1996)
Neely, C., Weller, P.: Intraday technical trading in the foreign exchange market. J. Int. Money Financ. 22(2), 223–237 (2003)
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)
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)
Olson, D.: Have trading rule profits in the currency markets declined over time? J. Bank. Finance 28(1), 85–105 (2004)
Osman, I.H., Kelly, J.P.: Meta-Heuristics: Theory & Applications. Kluwer Academic, Dordrecht (1996)
Park, C.-H., Irwin, S.H.: What do we know about the profitability of technical analysis? J. Econ. Surv. 21(4), 786–826 (2007)
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)
Reeves, C.R.: Using genetic algorithms with small populations. In: Proceedings of the Fifth International Conference on Genetic Algorithms. Morgan Kaufmann, San Mateo (1993)
Rothlauf, F., Goldberg, D.: Redundant representations in evolutionary computation. Illinois Genetic Algorithms Laboratory (IlliGAL) Report (2002)
Schulmeister, S.: Components of the profitability of technical currency trading. Appl. Financ. Econ. 18(11), 917–930 (2008)
Sweeney, R.J.: Beating the foreign exchange market. J. Finance 41(1), 163–182 (1986)
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)
Acknowledgements
We would like to thank the anonymous referees, whose comments helped us improve this paper.
Author information
Authors and Affiliations
Corresponding author
Rights and permissions
About this article
Cite this article
Mendes, L., Godinho, P. & Dias, J. A Forex trading system based on a genetic algorithm. J Heuristics 18, 627–656 (2012). https://doi.org/10.1007/s10732-012-9201-y
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s10732-012-9201-y