Stock Trading Algorithm with Technical Indicators Using Python for Indian Stocks
Keywords:
Stock, NSE,, BSE, Moving Average, MACD, EMA, CSV, Market CapitalizationAbstract
In the financial markets, algorithmic trading has become a potent instrument that enables traders to automate their tactics and profit from market inefficiencies. In this paper, we describe a Python-based algorithmic trading model that makes use of technical indicators and evaluate its performance in comparison to the well-known buy-and-hold approach. By analysing historical price data, these indicators provide insights into the market trends and potential entry or exit points for trading positions. To evaluate the effectiveness of our algorithmic trading model, we perform a comprehensive comparative analysis against the buy-and-hold strategy. Furthermore, we introduce a GUI that integrates seamlessly with our algorithmic trading model, offering an intuitive and interactive trading environment by allowing the users to easily configure the parameters. By offering empirical support for the benefits of using technical indicators and highlighting the usefulness of interactive interfaces for effective trading execution and decision-making, this study makes a contribution to the expanding field of algorithmic trading.
References
Business News Today: Read Latest Business news, India Business News Live, Share Market & Economy News | The Economic Times. (n.d.). The Economic Times. Available: https://economictimes.indiatimes.com/?back=1
Brock W, Lakonishok J, Lebaron B. Simple Technical Trading Rules and the Stochastic Properties of Stock Returns. J Financ. 1992, December; 47(5): 1731–1764. Available: https://doi.org/10.1111/j.1540-6261.1992.tb04681.x
Singhal U. (2021, August 23). Generating Buy and Sell Signals for SMA, MACD, and Bollinger-Bands with Python. Trade With Python. Available: https://tradewithpython.com/generating-buy-sell-signals-using-python
Ram K. (2022, January 25). Algorithmic Trading - BUY LOW SELL HIGH strategy back-testing in python. Medium. Available: https://blog.devgenius.io/algorithmic-trading-backtesting-a-simple-buy-low-sell-high-strategy-in-python-cb1f9692984e
West Z. (2023, April 10). Calculating the MACD in Python for Algorithmic Trading. Αlphαrithms. Available: https://www.alpharithms.com/calculate-macd-python-272222/
Official Documentation and Tutorial | CustomTkinter. (n.d.). Available: https://customtkinter.tomschimansky.com
Python Programming Tutorials. (n.d.). Available: https://pythonprogramming.net/customizing-tkinter-matplotlib-graph/
Bodas-Sagi DJ, Fernández P, Hidalgo JI, Soltero FJ, RiscoMartín JL. Multiobjective optimization of technical market indicators. In Proceedings of the 11th Annual Conference Companion on Genetic and Evolutionary Computation Conference: Late Breaking Papers. GECCO '09. ACM, New York, pp. 1994–2004.
Tanaka-Yamawaki M, Tokuoka S, Awaji K. Short-Term Price Prediction and the Selection of Indicators. Prog Theor Phys. Japan, 2009, 17–25.
Edwards RD, Magee J, Bassetti WHC. Technical Analysis of Stock Trends, 9th Edition (Hardcover). American Management Association, 2007.
KIM K. Electronic and Algorithmic Trading Technology. Burlington, MA. Elsevier, 2007.
Chaboud A, Chiquoine B, Hjalmarsson E, Vega C. Rise of the Machines: Algorithmic Trading in the Foreign Exchange Market. Federal Reserve Board - International Finance Discussion Papers. 2009–980.
Subramanian H, Ramamoorthy S, Stone P, Kuipers B. Designing Safe, Profitable Automated Stock Trading Agents Using Evolutionary Algorithms. In Proceedings of the Genetic and Evolutionary Computation Conference, July 2006.
Praekhaow P, Determination of Trading Points using the Moving Average Methods, in International Conference for a Sustainable Greater Mekong Subregion, August 2010.
Manoharan M, Mamilla R. Candlestick Technical Analysis on Select Indian Stocks: Pattern detection and Efficiency Statistics, International Journal of Innovative Technology and Exploring Engineering (IJITEE), December 2019; 9: 3140–3143.
Ming-Ming L, Siok-Hwa L. The profitability of the simple moving averages and trading range breakout in the Asian stock markets. J Asian Econ. 2006; 17(1): 144–170.
Gunasekarage A, Power DM. The profitability of moving average trading rules in South Asian stock markets. Emerg Markets Rev. 2001; 2(1): 17–33.
Nazário, Rodolfo Toríbio Farias, Jéssica Lima e Silva, Vinicius Amorim Sobreiro, Herbert Kimura. A literature review of technical analysis on stock markets. Quart Rev Econ Financ. 2017; 66:
–126.
Nagpal Abhinav, Goldie Gabrani. Python for data analytics, scientific and technical applications. In 2019 Amity International Conference on Artificial Intelligence (AICAI), pp. 140–145. IEEE, 2019.
Russell, Yoon V. Heterogeneous Agent Development: A Multi-Agent System for Testing Stock Trading Algorithms. AMCIS 2005 Proceedings, 2005
Himanshu Patel, Hardik Modi. The Elliott Wave Principle and its Applications in Security Analysis. Research & Reviews: J Stats. 2018; 7(3): 1–6p
Kuo Ren Jie, Chen CH, Hwang YC. An intelligent stock trading decision support system through integration of genetic algorithm based fuzzy neural network and artificial neural network. Fuzzy Sets Syst. 2001; 118(1): 21–45.
Aycel Üzeyir, Yunus Santur. A new moving average approach to predict the direction of stock movements in algorithmic trading. J New Results Sci. 2022; 11(1): 13–25.
Aguirre Alberto Antonio Agudelo, Ricardo Alfredo Rojas Medina, Néstor Darío Duque Méndez. Machine learning applied in the stock market through the Moving Average Convergence Divergence (MACD) indicator. Invest Manag Financ Innov. 2020; 17(4): 44.
Sarma Seethiraju LVVD, Dorai Venkata Sekhar, Gudipatu Murali. Stock market analysis with the usage of machine learning and deep learning algorithms. Bull Electr Eng Inform. 2023; 12(1):
–560.
Htun Htet Htet, Michael Biehl, Nicolai Petkov. Survey of feature selection and extraction techniques for stock market prediction. Financ Innov. 2023; 9(1): 26.
Mukherjee Somenath, Bikash Sadhukhan, Nairita Sarkar, Debajyoti Roy, Soumil De. Stock market prediction using deep learning algorithms. CAAI Trans Intell Technol. 2023; 8(1): 82–94.
Blackmun Piers, Sahar Al-Sudani, Dhiya Al-Jumeily. Design and Implementation of Algorithmic Stock Trading. In 2023 15th International Conference on Developments in eSystems Engineering (DeSE), pp. 149–153. IEEE, 2023.
YILDIRIM Simge, Yunus SANTUR. A Study on Backtest Metrics for Financial Analysis. Int J Adv Nat Sci Eng Res. 2023; 7(2): 25–29.