Design Algorithmic Trading Strategies with Expert Advisor Using Linear Weighted Moving Average (LWMA) and Stochastic Oscillator Technical Indicators
DOI:
https://doi.org/10.56427/jcbd.v3i2.404
Keywords:
Expert Advisor, Algorithmic Trading, Linear Weight Moving Average, Stochastic, Gold TradingAbstract
Earlier this decade, the financial sector saw a paradigm change, with automated trading (AT) systems gaining popularity as essential tools for traders and investors. This research explores deeply the design and implementation of Expert Advisors (EAs) for automated financial built using a combination of the Linear Weighted Moving Average (LWMA) and Stochastic oscillator technical indicators. The EAs are built using the programming language MetaQuotes Language 4 (MLQ4) at Metatrader 4 (MT4) platform, enabling automated trade execution. It implements a machine learning genetic algorithm, trained on historical data to optimize the parameters of the LWMA and Stochastic trading rules. The core strategy relies on the LWMA to identify the overall market trend direction while the Stochastic oscillator provides additional signals for timing entry and exit points based on momentum. The EAs were coded to generate automated buy and sell signals for algorithmic trading (AT) based on a set of defined rules using thresholds for each indicators. Extensive historical backtesting using Gold (XAU/USD) currency pair across multiple timeframes from 5-minute (M5) up to 4-hour (H4) charts was conducted using 5 years of price data from 2019 to 2023 for evaluation. The goal of this study is to assess if the EAs could potentially produce consistent profits over time while minimizing drawdowns in different market conditions. The results demonstrate that the system was able to generate annual returns ranging from 3.04% up to 232.19% depending on the aggression of the timeframe settings. Meanwhile, maximum drawdowns were controlled to reasonable levels between 0.5% to 8.27% which is below 10% of potential loss throughout the backtests. An hourly timeframe configuration provided a balanced blend between strong profitability and drawdown control based on the backtest analysis. All the timeframes used for the test show positive results and the M5 timeframe is the best chosen timeframe to trade using this EAs implementation.
Downloads
References
R. Kissell, Algorithmic Trading. Elsevier Inc., 2013.
R. Vedapradha, R. Hariharan, D. D. Winster Praveenraj, E. Sudha, M. Pandey, and S. Ambrose, “Algorithm trading and its application in stock broking services,” E3S Web Conf., vol. 376, 2023, doi: 10.1051/e3sconf/202337605002.
D. Lv, S. Yuan, M. Li, and Y. Xiang, “An Empirical Study of Machine Learning Algorithms for Stock Daily Trading Strategy,” Math. Probl. Eng., vol. 2019, no. 2, 2019, doi: 10.1155/2019/7816154.
N. Burgess, “Machine Learning – Algorithmic Trading Strategies for Superior Growth, Outperformance and Competitive Advantage,” Int. J. Artif. Intell. Mach. Learn., vol. 2, no. 1, p. 38, 2022, doi: 10.51483/ijaiml.2.1.2022.38-60.
V. Todorović, A. Pešterac, and N. Tomić, “the Impact of Automated Trading Systems on Financial Market Stability,” Facta Univ. Ser. Econ. Organ., vol. 16, p. 255, 2019, doi: 10.22190/fueo1903255t.
S. Yan et al., “Algorithmic Trading and Challenges on Retail Investors in Emerging Markets,” J. Econ. Financ. Account. Stud., vol. 4, no. 3, pp. 36–41, 2022, doi: 10.32996/jefas.2022.4.3.4.
J. Y. Huang, A. Gupta, and M. Youn, “Survey of EU ethical guidelines for commercial AI: case studies in financial services,” AI Ethics, vol. 1, no. 4, pp. 569–577, 2021, doi: 10.1007/s43681-021-00048-1.
B. H. Min and C. Borch, “Systemic failures and organizational risk management in algorithmic trading: Normal accidents and high reliability in financial markets,” Soc. Stud. Sci., vol. 52, no. 2, pp. 277–302, 2022, doi: 10.1177/03063127211048515.
D. Abdrakhmanova, E. Karasik, L. Safiullin, and A. Scharonova, “Problems of regulating financial markets as part of the green economy,” E3S Web Conf., vol. 110, 2019, doi: 10.1051/e3sconf/201911002035.
V. Kukreti, H. K. Pharasi, P. Gupta, and S. Kumar, “A Perspective on Correlation-Based Financial Networks and Entropy Measures,” Front. Phys., vol. 8, no. August, pp. 1–7, 2020, doi: 10.3389/fphy.2020.00323.
M. Lekhal and A. El Oubani, “Does the Adaptive Market Hypothesis explain the evolution of emerging markets efficiency? Evidence from the Moroccan financial market,” Heliyon, vol. 6, no. 7, p. e04429, 2020, doi: 10.1016/j.heliyon.2020.e04429.
R. A. A. Rashid, “Foreign Exchange Forecasting & Modeling – A Review of,” vol. 030030, 2023.
S. A. Zahera and R. Bansal, “Do investors exhibit behavioral biases in investment decision making? A systematic review,” Qual. Res. Financ. Mark., vol. 10, no. 2, pp. 210–251, 2018, doi: 10.1108/QRFM-04-2017-0028.
“Historical Data Feed :: Dukascopy Bank SA.” https://www.dukascopy.com/swiss/english/marketwatch/historical/ (accessed Dec. 08, 2023).
Z. S. Zulkifli, H. Mohammad, M. Surip, M. Mamat, and S. A. Sulaiman, “Assessing the Level of Competence in Automated Trading Among Malaysian Traders,” vol. 2, pp. 23–34, 2023.
Downloads
Published
How to Cite
Issue
Section
License
Copyright (c) 2024 Zarith Sofia Zulkifli, Nurnadiah Zamri, Hairuddin Mohammad, Rashidi Arash Abdul Rashid Al-Saadi

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.