Evaluation of the Performance of a Dynamic Trading Strategy by Combining the Flag Pattern Detection Technique and an Exponential Moving Average with Cumulative Particle Motion Optimization
Subject Areas : Financial Mathematicssayyed mohammad reza davoodi 1 , Sayyede Elnaz Afzaliyan Boroujeni 2
1 - Assistant Professor. Department of Management ,Dehaghan Branch, Islamic Azad University, Dehaghan, Iran.
2 - Department of Management, Najafabad Branch, Islamic Azad University, Najafabad, Iran.
Keywords: ChartFlag Pattern Detection, Japanese Candlestick, Optimization, moving average, Particle Cumulative Algorithm,
Abstract :
Designing trading systems with good returns is critical for capital market investors. Trading systems are often based on a combination of several tools to use their combined information. For the first time in Iran, the present study aimed to propose a pattern detection algorithm for a flag pattern based on Japanese candlestick charts and their arrangement. By recognizing the pattern and if the 4- and 10-day moving average is confirmed, a shopping position is developed, and the selling time is determined based on an optimized and dynamic process commensurate with price changes and the data scale. Our objective was to address the question of whether the returns resulting from this strategy have a more significant positive return compared to the purchase and maintenance strategy. The research sample included the daily information of 16 active companies of basic metals in Tehran Stock Exchange during 2007-2019, extracted from the database of Novin Rahavard software. Data analysis was performed in MATLAB software, and the obtained experimental evidence was described using t-test. According to the results, the research strategy had a higher performance in terms of returns and risks compared to the market.
[1] Abdolbaghi Ataabadi, A., Davoodi, S. M. R., and Salimi Bani, M., The Effectiveness of the Automatic System of Fuzzy Logic-Based Technical Patterns Recognition: Evidence from Tehran Stock Exchange, Advances in mathematical finance & applications, 2019, 4(3), P.107-125. Doi: 10.22034/amfa.2019.585179.1185.
[2] Arevalo, R., Garcia, J., Guijarro, F., and Peris, A., A dynamic trading rule based on filtered flag pattern detection for stock market price forecasting, Journal of Expert system with Applications, 2017, 81, P.177-192, Doi:10.1016/j.eswa.2017.03.028.
[3] Barak, S., Dahooie, J. H., and Tichý, T., Wrapper ANFIS-ICA method to do stock market timing and feature selection on the basis of Japanese Candlestick, Expert Systems with Applications, 2015, 42(23), P.9221–9235, Doi: 10.1016/j.eswa.2015.08.010.
[4] Boobalan, C., Technical analysis in select stocks of India companies, International Journal of Business and Administration Research Review, 2014, 2(4), P.26-36.
[5] Cervello-Roya, R., Guijarro, F., and Michniuk, K., Stock market trading rule based on pattern detection and technical analysis: Forecasting the DJIA index with intraday data, Expert System with Applications, 2015, 42, P.5963-5975, Doi: 10.1016/j.eswa.2015.03.017.
[6] Chang, T., Yang, S., and Chang, K., Portfolio optimization problems in different risk measures using genetic algorithm, Expert System with Applications, 2009, 36(7), P.10529-10537, Doi: 10.1016/j.eswa.2009.02.062.
[7] Damoori, D., Farid, D., and Ashhar, M., Forecasting Stock Exchange Index Using Particle Swarm Optimization Comparing To Traditional Models, Journal Of Accounting Knowledge, 2011, 2(5), P.7-30. (In Persian)
[8] Davoodi Kasbi, A., Dadashi, I., and Azinfar, K., Stock Price Analysis Using Machine Learning Method (Non-Sensory-Parametric Backup Regression Algorithm in Linear and Nonlinear Mode), Advances in Mathematical Finance and Applications, 2021, 6(2), P.285-301, Doi: 10.22034/amfa.2019.1869838.1232.
[9] Davoodi Kasbi, A., Dadashi, I., and Azinfar, K., Stock Price Prediction Using the Chaid Rule-Based Algorithm and Particle Swarm Optimization (PSO), Advances in Mathematical Finance and Applications, 2020, 5(2), P.197-213, Doi: 10.22034/amfa.2019.585043.1184.
[10] Deng, G.F., Lin, W.T., and Lo, C.C., Markowitz-Based Portfolio Selection with Cardinality Constraints Using Improved Particle Swarm Optimization, Expert Systems with Applications, 2012, 39(4), P.4558-4566.
[11] Dongdong, Lv., Shuhan, Yuan., Meizi, Li., and Yang, Xiang., An Empirical Study of Machine Learning Algorithms for Stock Daily Trading Strategy, Mathematical Problems in Engineering, 2019.Doi: 10.1155/2019/7816154.
[12] Fu, T., Chung, F., Luk, R., and Ng, C., Stock time series pattern matching: Tem- plate-based vs rule-based approaches, Engineering Applications of Artificial Intel- ligence, 2007, 20(3), P.347–364. Doi: 10.1016/j.engappai.2006.07.003.
[13] Golmakani, H.R., and Fazel, M., Constrained portfolio selection using particle swarm optimization, Expert Systems with Applications, 2011, 38(7), P.8327-8335. Doi:10.1016/j.eswa.2011.01.020.
[14] Gorgulho, A., Neves, R., and Horta, N., Applying a GA kernel on optimizing technical analysis rules for stock pricing and portfolio composition, Expert Systems with Applications, 2011, 33(11), P.14072-14085.
[15] Hiransha, M., Gopalakrishnan, E.A., Vijay Krishna, M., and Soman, K.p., NSE stock market prediction using deep-learning models, Procedia Computer Science, 2018, 132, P.1351-1362. Doi:10.1016/j.procs.2018.05.050.
[16] Hsu, L.Y., Horng, S.J., He, M., Fan, P., Kao, T.W., Khan, M.K., Run, R.S., Lai, J.L., and Chen, R.J., Mutual Funds Trading Strategy Based on Particle Swarm Optimization, Expert Systems with Applications, 2011, 38(6), P.7582-7602. Doi:10.1016/j.eswa.2010.12.105.
[17] Kenndy, J., and Eberhart, R.C., Particle Swarm Optimization, In Proceedings of the IEEE International Conference on Neural Networks IV, 1995. Doi: 10.1109/ICNN.1995.488968.
[18] Leigh, W., Modani, N., Purvis, R., and Roberts, T., Stock market trading rule discovery using technical charting heuristics, Expert Systems with Applications, 2002, 23, P.155-159. Doi:10.1016/S0957-4174(02)00034-9.
[19] Leigh, W., Paz, N., and Purvis, R., Market timing: A test of a charting heuristic. Economics Letters, 2002, 77, P.55–63.
[20] Leigh, W., Purvis, R., and Ragusa, J., Forecasting the NYSE composite index with technical analysis, pattern recognizer, neural network, and genetic algorithm: A case study in romantic decision support, Decision Support Systems, 2002, 32(4), P.361–377. Doi:10.1016/S0167-9236(01)00121-X.
[21] Leitão, J., Neves, R., and Horta, N., Combining rules between PIPs and SAX to identify patterns in financial markets, Expert Systems with Applications, 2016, 65, P.242–254. Doi:10.1016/j.eswa.2016.08.032.
[22] Li, D., Sun, X., and Wang, J., Optimal lot solution to cardinality constrained mean–variance formulation for portfolio selection, Mathematical Finance, 2006, 16(1), P.83-101. Doi:10.1111/j.1467-9965.2006.00262.x.
[23] Martins, T.M., and Neves, R.F., Applying genetic algorithms with speciation for optimization of grid template pattern detection in financial markets, Expert Systems with Applications, 2020, 147.Doi: 10.1016/j.eswa.2020.113191.
[24] Moradi, M., Portfolio Optimization in Tehran Stock Exchange by Water Cycle Algorithm, Financial Management Perspective, 2018, 7(20), P.9-32. (In Persian)
[25] Murphy, J.J., Technical Analysis of the Futures Markets: A Comprehensive Guide to Trad-ing Methods and Applications, New York Institute of Finance: Prentice-Hall, 1990, ISBN-10: 0735200661.
[26] Nabavi Chashami, S.A., and H assanzadeh, A., Study Of Moving Averages Indicators Efficiency In Technical Analysis For Forecasting Stock Price In Selected Top Companies Tehran Stock Exchange, Financial Knowledge Of Security Analysis (Financial Studies), 2011, 4(10), P.83-106. (In Persian)
[27] Nison, S., Candlestick trading principles. Technical analysis of stocks and commodities, New York: McGrow-Hill, 1991.
[28] Nison, S., The Candlestick Course. New Jersey: John Wiley & Sons, 2004, ISBN: 978-0-471-46488-4.
[29] Pakbaz, M., Davari, M., and Balgoriyan, M., Investigating the prediction power of the information content of the earnings announcement by technical analysis, Financial Management Perspective, 2018, 7(20), P.115-131. (In Persian)
[30] Peymany Foroushany, M., Erzae, A.H., Salehi, M., and Salehi, A., Trades Return Based on Candlestick Charts in Tehran Stock Exchange, Financial Research Journal, 2020, 22(1), P.69-89. Doi: 10.22059/frj.2019.287302.1006912. (In Persian)
[31] Poli, R., Kennedy, J., and Blackwell, T., Particle Swarm Optimization: an overview, Swarm Intell, 2007, 1(1), P.33-57. Doi:10.1007/s11721-007-0002-0.
[32] Saati, E.A., Shakarian, H., and Nazirparvar, M., Identify and develop principles - returns in macroeconomic variables using the fundamental analysis method, Journal of Human Sciences Research, 2020, 59, P.139-160. (In Persian)
[33] Nasrollahi, Kh., Saghafi Kelvanag, R., Samadi, S., and Vaez Barzani, M., An Appraisal of the Merit of Candlestick Technical Trading Strategies in Tehran Stock Exchange, Journal Of Financial Accounting Research, 2013, 5(3), P.59-72. (In Persian)
[34] Sang Hyuk, Kim., Hee Soo, Lee., Han Jun, Ko., Seung Hwan, Jeong., Hyun Woo, Byun., and Kyong Joo, Oh., Pattern Matching Trading System Based on the Dynamic Time Warping Algorithm, Sustainability, 2018, 10(12), 4641. Doi:10.3390/su10124641.
[35] Silva, A., Neves, R., and Horta, N., A hybrid approach to portfolio composition based on fundamental and technical indicators, Expert System with Applications, 2015, P.2036-2048. Doi: 10.1016/j.eswa.2014.09.050
[36] Tsinaslanidis, P E., and Guijarro, F., What makes trading strategies based on chart pattern detection profitable? Expert Systems, 2020, e12596. Doi: 10.1111/exsy.12596.
[37] Turchin, P., Grinin, L., Victor, C., Munck, de., and Korotayev, A.,
History & Mathematics: Historical Dynamics and Development of Complex Societies, KomKniga, 2006, ISSN: 978-5-484-01002-0.
[38] vakili, S.H., Emadi, S.M., and Ebrahimi, S.B., Automatic Portfolio Rebalancing System Design Using Volatility Prediction Models and Technical Analysis Combination, Journal Of Financial Management Strategy, 2019, 7(1), P.145-164. Doi: 10.22051/jfm.2018.14479.1314 (In Persian).
[39] Velay, Marc., and Fabrice, Daniel., Stock Chart Pattern detection with Deep Learning, Computer Science, Mathematics, 2018.
[40] Wang, L., An, H., Liu, X., and Huang, X., Selecting dynamic moving average trading rules in the crude oil futures market using a genetic approach, Applied energy, 2016, 162, P.1608-1618.
[41] Zamani, Sh., and Faghani Kondori, P., Measuring Tehran Stock Exchange Liquidity and Investigating the Determinants Which have Effect on it, Financial Management Perspective, 2016, 6(15), P.61-80. (In Persian)
[42] Zhou, X. S., and Dong, M., Can fuzzy logic make technical analysis 20.20, Financial analyst journal, 2004, 60(4), P.54-75. Doi:10.2469/faj.v60.n4.2637.