Skip to main content

Advertisement

Log in

A Forex trading system based on a genetic algorithm

  • Published:
Journal of Heuristics Aims and scope Submit manuscript

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.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9
Fig. 10
Fig. 11
Fig. 12
Fig. 13

Similar content being viewed by others

Notes

  1. 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).

  2. 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.

  3. There are some slightly different definitions for the Stirling ratio. In this paper, we use the same definition as Hryshko and Downs.

  4. 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.

  5. 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)

    Article  Google Scholar 

  • 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)

    Article  MATH  Google Scholar 

  • Davis, L.: Handbook of Genetic Algorithms. Van Nostrand-Reinhold, New York (1991)

    Google Scholar 

  • Dempster, M.A.H., Jones, C.M.: A real-time adaptive trading system using genetic programming. Quant. Finance 1(4), 397–413 (2001)

    Article  Google Scholar 

  • Dunis, C., Harris, A., et al.: Optimising intraday trading models with genetic algorithms. Neural Netw. World 9(3), 193–223 (1999)

    Google Scholar 

  • Eling, M., Schuhmacher, F.: Does the choice of performance measure influence the evaluation of hedge funds? J. Bank. Finance 31(9), 2632–2647 (2007)

    Article  Google Scholar 

  • Fama, E.F.: Efficient capital markets: a review of theory and empirical work. J. Finance 25(2), 383–417 (1970)

    Article  Google Scholar 

  • Goldberg, D.: Genetic Algorithms in Search, Optimization and Machine Learning. Addison-Wesley, Reading (1989)

    MATH  Google Scholar 

  • Grefenstette, J.J.: Genetic algorithms for changing environments. In: Parallel Problem Solving from Nature 2, Brussels (1992)

    Google Scholar 

  • 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 

  • 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 

  • Hryshko, A., Downs, T.: System for foreign exchange trading using genetic algorithms and reinforcement learning. Int. J. Syst. Sci. 35(13), 763–774 (2004)

    Article  MATH  Google Scholar 

  • Kaboudan, M.A.: Genetic programming prediction of stock prices. Comput. Econ. 16(3), 207–236 (2000)

    Article  MATH  Google Scholar 

  • LeBaron, B.: Technical trading rule profitability and foreign exchange intervention. J. Int. Econ. 49(1), 125–143 (1999)

    Article  Google Scholar 

  • 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)

    Article  Google Scholar 

  • Lo, A.W.: The adaptive markets hypothesis. J. Portf. Manag. 30(5), 15–29 (2004)

    Article  Google Scholar 

  • Menkhoff, L., Taylor, M.P.: The obstinate passion of foreign exchange professionals: technical analysis. J. Econ. Lit. 45(4), 936–972 (2007)

    Article  Google Scholar 

  • Meyers, T.A.: The Technical Analysis Course. McGraw-Hill, New York (1989)

    Google Scholar 

  • Mitchell, M.: An Introduction to Genetic Algorithms. MIT Press, Cambridge (1996)

    Google Scholar 

  • Neely, C., Weller, P.: Intraday technical trading in the foreign exchange market. J. Int. Money Financ. 22(2), 223–237 (2003)

    Article  Google Scholar 

  • 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)

    Article  Google Scholar 

  • 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)

    Article  Google Scholar 

  • Olson, D.: Have trading rule profits in the currency markets declined over time? J. Bank. Finance 28(1), 85–105 (2004)

    Article  Google Scholar 

  • Osman, I.H., Kelly, J.P.: Meta-Heuristics: Theory & Applications. Kluwer Academic, Dordrecht (1996)

    MATH  Google Scholar 

  • Park, C.-H., Irwin, S.H.: What do we know about the profitability of technical analysis? J. Econ. Surv. 21(4), 786–826 (2007)

    Article  Google Scholar 

  • 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 

  • 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 

  • 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)

    Article  Google Scholar 

  • Sweeney, R.J.: Beating the foreign exchange market. J. Finance 41(1), 163–182 (1986)

    Google Scholar 

  • 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 

Download references

Acknowledgements

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

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Joana Dias.

Rights and permissions

Reprints 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

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s10732-012-9201-y

Keywords

Navigation