Design Algorithmic Trading Strategies with Expert Advisor Using Linear Weighted Moving Average (LWMA) and Stochastic Oscillator Technical Indicators - Zulkifli, Zarith Sofia; Nurnadiah Zamri; Hairuddin Mohammad; Rashidi Arash Abdul Rashid Al-Saadi (PT. Delitekno Media Madiri, 2024)
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.