Preview
In this post, we present an Expert Advisor (EA) designed for automated trading on the Gold vs. US Dollar (XAU/USD) instrument, utilizing daily candlestick data on the MT4 platform. The EA exclusively leverages key OHLC (Open, High, Low, Close) levels without the use of indicators. It operates without any performance optimization, allowing users to evaluate its raw capabilities without bias. By relying on default parameters, traders can gain an unfiltered view of its effectiveness, fostering confidence in its application across various market conditions.
This post provides a detailed breakdown of the EA’s features and extensive performance statistics, collected through rigorous testing. These insights offer a comprehensive understanding of the algorithm’s behavior across diverse scenarios, enabling traders to make informed decisions about incorporating the EA into their strategies. Additionally, quarterly subscribers can download the EA’s executable file for free, ready for seamless integration into the MT4 platform. This gives users the opportunity to experience the EA’s capabilities firsthand and leverage its strategic advantages in their trading activities. Finally, to determine whether the system remains effective, simply refer to the “status” section at the end of the post.
Development and Logic Description
To validate the EA’s performance, Out-of-Sample (OOS) testing was conducted—a crucial step in assessing trading strategies. OOS testing involves analyzing the EA using data that was not part of its development phase, ensuring the results are not overfitted to specific market conditions. This enhances the likelihood of consistent performance in real-world trading. The EA underwent rigorous testing over a 7-year period using data from two different brokers, each with its own spread. This approach was implemented to verify the EA’s reliability and consistency across diverse market scenarios.
The strategy exclusively opens long positions with 0.01 lots, a deliberate choice given Gold’s status as a store of value, which theoretically favors long trades over short ones. This measured approach avoids parabolic equity curves, which often signal excessive data manipulation or over-optimization. Importantly, the EA does not utilize hedging strategies—where positions offset potential losses—or martingale systems, which increase position sizes to recover losses.
The EA’s logic is straightforward: it capitalizes on retracements by opening trades only when Gold’s price drops by at least 742 points from the previous day’s close. It is essential to note that no short positions will be opened, even if the price exceeds 742 points above the prior day’s close.
The specific criteria by which EA operates are summarized below:
- a new long position is opened if the price falls at least 742 points from the previous close;
- no short trades will be opened.
Each trade is managed with specific exit criteria:
- Stop loss: 423 points
- Take profit: 16367 points
- Trailing Stop: at each new bar the trailing stop, when possible, reduces the maximum loss.
From the image above, you can observe the operational behavior of this Expert Advisor in action.
Trading System Statistics
The backtest was performed on two distinct datasets to account for potential discrepancies in pricing that can arise between different forex brokers trading the same financial instrument. To further validate the results, an additional test was conducted using a second MT4 terminal. The quality of the backtest was excellent; however, discrepancies between the two brokers were observed. Interestingly, and contrary to typical expectations, the performance on the second dataset exceeded that of the first. This outcome underscores the EA’s robustness and consistency, even when faced with variations in price feeds.
The most significant statistics of the EA can be summarized as follows:
- Sharpe Ratio: 0,06
- Profit Factor: 1,23
- Maximum Drawdown: 11,51%
- Maximum Stagnation Period: 743 days
- Average Profit: 31,38 €
- Average Loss: -4,44 €
- Win/Loss Ratio: 0.15
Testing expert advisors firsthand is not only essential to verify their stability and functionality but also serves as a valuable exercise in understanding the disciplined approach and thorough methodology required to become a successful systematic trader.
The expert advisor can be downloaded directly from here: XAUUSD26122024.ex4
Status: Active
Best regards,
Tradingquant