Abstract
Algorithmic trading, a widespread practice in the financial industry, is based on the automatic signal generation based on trading rules of one or more technical analysis indicators. Generally, the parameters for computing the indicators (such as the time windows), the trading rules (converting the indicator into a trading signal) and the weights for signal aggregation (for combining the signals from a plurality of indicators) are established by the trader based on her experience and are treated as fixed inputs of the trading algorithm. In recent literature, simple optimization systems are introduced by varying only one category of parameters at a time, that is only the indicators setting, only the trading rules definition, or only the signal aggregation while keeping the remaining parameters fixed. Our research goes further and proposes an automated trading system based on simultaneous optimization of the three categories of parameters. More precisely, we consider four technical indicators widely used in financial practice, the Exponential Moving Average, the Relative Strength Index, the Moving Average Convergence/Divergence, and the Bollinger Bands and we determine the optimal signal aggregation, trading rule definition and indicator setting using the Particle Swarm Optimization metaheuristic over a commonly used fitness function, that is the net capital at the end of the trading period. We apply our trading system to the Italian index FTSE MIB and to a set of financial stocks belonging to the FTSE MIB over a multi-year period for training and testing. We generally achieve superior performance both in sample and out of sample, using a standard technical analysis system as a benchmark. Furthermore, we successfully verify the ability of the optimized trading system to accurately classify the stock price trends.
Similar content being viewed by others
Data availability
The data that support the findings of this study are available from the corresponding author upon request.
Notes
For pity’s sake, we take \(r_f=0\%\) and we compute the standard deviation on yearly basis.
For a thorough discussion, see Fletcher (2000, Sections 12.3 and 14.3).
We have downloaded the closing prices free of charge from the financial provider “Yahoo Finance”, at the link https://finance.yahoo.com/.
As already reported, in running PSO we use \(\phi _1=\phi _2=1.49618\), \(w^0=0.7298\) and \(\epsilon =10^{-2}\), which are generally suggested in literature.
As mentioned in Sect. 3.2, the trading period spans from January 2, 2007, to May 31, 2022.
The only two not favorable average values are both associated with the stock Atlantia in experiments 1 and 2, for the evaluation indicator Precision. This outcome, jointly with the results presented in Sect. 3.4, show the effectiveness of the optimized trading system.
References
Allen F, Karjalainen R (1999) Using genetic algorithms to find technical trading rules. J Financ Econ 51(2):245–271
Bakhtiyari Asl CA, Davoodi SMR, Abdolbaghi Ataabadi A (2022) Designing and evaluating the profitability of linear trading system based on the technical analysis and correctional property. Adv Math Finance Appl 7(1):49–63
Brabazon A, O’Neill M (2004) Evolving technical trading rules for spot foreign-exchange markets using grammatical evolution. Comput Manag Sci 1(3):311–327
Briza AC, Naval PC Jr (2011) Stock trading system based on the multi-objective particle swarm optimization of technical indicators on end-of-day market data. Appl Soft Comput 11(1):1191–1201
Clerc M (1999) The swarm and the queen: towards a deterministic and adaptive particle swarm optimization. In: Proceedings of the 1999 congress on evolutionary computation. IEEE
Clerc M, Kennedy J (2002) The particle swarm-explosion, stability, and convergence in a multidimensional complex space. IEEE Trans Evol Comput 6(1):58–73
Corazza M, Fasano G, Gusso R (2012) Portfolio selection with an alternative measure of risk: Computational performances of particle swarm optimization and genetic algorithms. In: Perna C, Sibillo M (eds) Mathematical and Statistical methods for actuarial sciences and finance. Springer, Berlin, pp 123–130
Corazza M, Fasano G, Gusso R (2013) Particle swarm optimization with non-smooth penalty reformulation, for a complex portfolio selection problem. Appl Math Comput 224:611–624
Corazza M, Parpinel F, Pizzi C (2017) An evolutionary approach to improve a simple trading system. In: Corazza M, Legros F, Perna C, Sibillo M (eds) Mathematical and statistical methods for actuarial sciences and finance. Springer, Berlin, pp 83–95
Corazza M, Parpinel F, Pizzi C (2021) Trading system mixed-integer optimization by PSO. In: Corazza M, Gilli M, Perna C, Pizzi C, Sibillo M (eds) Mathematical and statistical methods for actuarial sciences and finance. Springer, Cham, pp 161–167
Dai M, Yang Z, Zhang Q, Zhu QJ (2016) Optimal trend following trading rules. Math Oper Res 41(2):626–642
dos Santos Coelho L (2009) An efficient particle swarm approach for mixed-integer programming in reliability-redundancy optimization applications. Reliab Eng Syst Saf 94(4):830–837
Dunis CL, Miao J (2004) Optimal trading frequency for active asset management: evidence from technical trading rules. J Asset Manag 5(5):305–326
Farias Nazário RT, Lima e Silva J, Sobreiro VA, Kimura H (2017) A literature review of technical analysis on stock markets. Q Rev Econ Finance 66:115–126
Fletcher R (2000) Practical methods of optimization. Wiley, Glichester
Gaing ZL (2005) Constrained optimal power flow by mixed-integer particle swarm optimization. In: IEEE power engineering society general meeting, June, pp 243–250
Gerritsen DF, Bouri E, Ramezanifar E, Roubaud D (2020) The profitability of technical trading rules in the Bitcoin market. Finance Res Lett 34:101263
Gold S (2015) The viability of six popular technical analysis trading rules in determining effective buy and sell signals: MACD, AROON, RSI, SO, OBV, and ADL. J Appl Financ Res 2:8–29
Hassan R, Cohanim B, De Weck O, Venter G (2005) A comparison of particle swarm optimization and the genetic algorithm. In: 46th AIAA/ASME/ASCE/AHS/ASC structures, structural dynamics and materials conference
Hudson R, Urquhart A (2021) Technical trading and cryptocurrencies. Ann Oper Res 297(1):191–220
Hussain K, Mohd Salleh MN, Cheng S, Shi Y (2019) Metaheuristic research: a comprehensive survey. Artif Intell Rev 52:2191–2233
Kennedy J, Eberhart R (1995) Particle swarm optimization. In: Proceedings of the 1995 IEEE international conference on neural networks. Australia, IEEE Service Center, Piscataway, NJ, IV: Perth
Lahmiri S (2018) A technical analysis information fusion approach for stock price analysis and modeling. Fluct Noise Lett 17(1):1850007
Laskari EC, Parsopoulos KE, Vrahatis MN (2002) Particle swarm optimization for integer programming. In: Proceedings of the 2002 congress on evolutionary computation, vol 2, pp 1582–1587
Lee CI, Mathur I (1996) Trading rule profits in European currency spot cross-rates. J Bank Finance 20(5):949–962
Lee CI, Gleason KC, Mathur I (2001) Trading rule profits in Latin American currency spot rates. Int Rev Financ Anal 10(2):135–156
Lorig M, Zhou Z, Zou B (2019) A mathematical analysis of technical analysis. Appl Math Finance 26(1):38–68
Macedo LL, Godinho P, Alves MJ (2020) A comparative study of technical trading strategies using a genetic algorithm. Comput Econ 55(1):349–381
Marshall BR, Nguyen NH, Visaltanachoti N (2017) Time series momentum and moving average trading rules. Quant Finance 17(3):405–421
Mousavi S, Esfahanipour A, Zarandi MHF (2014) A novel approach to dynamic portfolio trading system using multitree genetic programming. Knowl-Based Syst 66:68–81
Murphy JJ (1999) Technical analysis of financial markets. A comprehensive guide to trading methods and applications. New York Institute of Finance
Muruganandan S (2020) Testing the profitability of technical trading rules across market cycles: evidence from India. Colombo Bus J 11(1):24–46
Neely CJ (2003) Risk-adjusted, ex ante, optimal technical trading rules in equity markets. Int Rev Econ Finance 12(1):69–87
Nor SM, Wickremasinghe G (2014) The profitability of MACD and RSI trading rules in the Australian stock market. Investment Manag Financ Innov 11(4):194–199
Olorunda O, Engelbrecht AP (2008) Measuring exploration/exploitation in particle swarms using swarm diversity. In: 2008 IEEE congress on evolutionary computation (IEEE world congress on computational intelligence)
Osman IH, Laporte G (1996) Metaheuristics: a bibliography. Ann Oper Res 63(1):511–623
Ozturk M, Toroslu IH, Fidan G (2016) Heuristic based trading system on Forex data using technical indicator rules. Appl Soft Comput 43:170–186
Parsopoulos KE, Vrahatis MN (2002) Recent approaches to global optimization problems through particle swarm optimization. Nat Comput 1(2):235–306
Pizzi C, Bitto I, Corazza M (2021) Exploration and exploitation in optimizing a basic financial trading system: a comparison between FA and PSO algorithms. In: Esposito A, Faundez-Zanuy M, Morabito F, Pasero E (eds) Progresses in artificial intelligence and neural systems. smart innovation, systems and technologies, vol 184. Springer, Singapore, pp 293–303
Pring MJ (1991) Technical analysis explained, 3rd edn. McGraw-Hill, New York
Rodriguez-Gonzalez A, Garcia-Crespo A, Colomo-Palacios R, Iglesias FG, Gomez-Berbis JM (2011) CAST: using neural networks to improve trading systems based on technical analysis by means of the RSI financial indicator. Expert Syst Appl 38(9):11489–11500
Saber AY, Venayagamoorthy GK (2009) Optimization of vehicle-to-grid scheduling in constrained parking lots. In: IEEE power and energy society general meeting, July
Sharpe WF (1966) Mutual fund performance. J Bus 39(1):119–138
Thakkar A, Chaudhari K (2021) A comprehensive survey on portfolio optimization, stock price and trend prediction using particle swarm optimization. Arch Comput Methods Eng 28(4):2133–2164
Vezeris D, Kyrgos T, Schinas C (2018) Take profit and stop loss trading strategies comparison in combination with an MACD trading system. J Risk Financ Manag 11(3):56
Wakasa Y, Tanaka K, Nishimura Y (2010) Control-theoretic analysis of exploitation and exploration of the PSO algorithm. In: 2010 IEEE international symposium on computer-aided control system design
Wang F, Philip LH, Cheung DW (2014) Combining technical trading rules using particle swarm optimization. Expert Syst Appl 41(6):3016–3026
Wilder JW (1978) New concepts in technical trading systems. Trend Research, Greensboro
Worasucheep C, Nuannimnoi S, Khamvichit R, Attagonwantana P (2017) An automatic stock trading system using Particle Swarm Optimization. In: 14th international conference on electrical engineering/electronics, computer, telecommunications and information technology (ECTI-CON), pp 497–500
Wu WC, Tsai MS (2011) Application of enhanced integer coded particle swarm optimization for distribution system feeder reconfiguration. IEEE Trans Power Syst 26(3):1591–1599
Yan XX, Zhang YB, Lv XK, Li ZY (2017) Improvement and test of stock index futures trading model based on Bollinger Bands. Int J Econ Finance 9(1):78–87
Zakamulin V, Giner J (2020) Trend following with momentum versus moving averages: a tale of differences. Quant Finance 20(6):985–1007
Zakamulin V, Giner J (2022) Time series momentum in the US stock market: empirical evidence and theoretical analysis. Int Rev Financ Anal 82(1):102173
Zhang Z, Khushi M (2020) Ga-MSSR: genetic algorithm maximizing sharpe and sterling ratio method for robotrading. In: IEEE international joint conference on neural networks (IJCNN)
Funding
The study was partly supported by the Department of Economics, Ca' Foscari University of Venice, through the Research Grant titled "Combining optimization metaheuristics and artificial intelligence to design quasi-real-time trading strategies" (Decree of the Director of the Department of Economics, Ca' Foscari University of Venice, Rep. 850/2021, Prot. 101205 - VII/16, September 14, 2021).
Author information
Authors and Affiliations
Contributions
All the authors contributed to the study conception and design, material preparation, data collection and analysis. The final and the previous versions of the manuscript were written and approved by all the authors.
Corresponding author
Ethics declarations
Conflict of interest
The authors have no relevant financial or non-financial interests to disclose.
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.
About this article
Cite this article
Corazza, M., Pizzi, C. & Marchioni, A. A financial trading system with optimized indicator setting, trading rule definition, and signal aggregation through Particle Swarm Optimization. Comput Manag Sci 21, 26 (2024). https://doi.org/10.1007/s10287-024-00506-1
Received:
Accepted:
Published:
DOI: https://doi.org/10.1007/s10287-024-00506-1
Keywords
- Trading system
- Particle Swarm Optimization
- Signal aggregation
- Trading rule definition
- Indicator setting
- Italian stock market