Gold AI Robot EA
Optimization Guide
Optimization Guide
Gold AI Robot is an advanced expert advisor (EA) designed to identify precise price opportunities based on significant retracements in the gold marktet.
Provided with an AI filter and a key retracement price detection, this EA analyzes price movements to detect significant pullbacks and open scaled positions, simultaneously applying global risk managment to optimize each trade.
The goal of the following step-by-step optimization guide is to give the traders the tools to find a set file that suits their own unique profit objectives and risk management specifications, ensuring the best results when using the Gold AI Robot EA.
Initial Lot Size: Defines the lot size for opening the first position at the initial level. If set to 0, the minimum lot size will be used.
Auto Lot Scaling?: Whether to apply automatic lot scaling with AutoLot.
Global Take Profit (Percentage): Defines the global Take Profit applied to all positions, calculating the target gain based on the account balance. This means that if the total profit exceeds the set percentage, all trades are closed.
Global Stop Loss (Percentage): Defines the general Stop Loss to control accumulated losses. This works similarly to the previous parameter, meaning that if the total loss exceeds the set percentage, all trades are closed to limit total losses based on available balance. This parameter is intended to be set by the user according to their own risk specifications.
AI Filter Sensitivity: Defines how easily the EA detects a significant retracement within the current price context.
Fine-tunes how easily trades are triggered: Defines how often the EA will trigger the next open positions, scaling them up to subsequent levels when new signals are confirmed.
Introduction to Fast Genetic Based Optimization Algorithm
Optimization is an essential process for improving the performance of any Expert Advisor (EA). The Fast Genetic Based Algorithm is an advanced technique that utilizes principles of genetics and evolution to search for the best parameter combinations. This algorithm significantly speeds up the optimization process, allowing for the efficient and effective exploration of a wide range of configurations.
This method mimics natural selection, combining and mutating input parameters to find optimal settings that maximize the EA's performance.
Modeling Selection
It is recommended to use "1 minute OHLC" for a faster optimization process.
Optimization Period
For obtaining a set file for a week, optimize with data from the last 10 weeks.
For a monthly setfile, optimize with data from the last 10 months.
For an annual setfile, optimize with data from the last 5 years.
Optimization: Criteria Selection
Funded Accounts or Prop Firms
For users operating with funded accounts or prop firms, it's crucial to maintain strict control over risk and drawdown. Therefore, it is recommended to select one of the following optimization criteria:
Drawdown min: Minimizes drawdown to maintain account stability.
Complex Criterion max: Balances profit-seeking with drawdown control.
Regular Accounts
For users with regular accounts who want to maximize profits, even if it means taking on higher risk, they may consider the following optimization criteria:
Balance Max: This criterion maximizes the account balance, seeking high returns in a short period, with associated risks.
Profit Factor Max: This criterion maximizes the profit factor, which is the ratio between gross profit and gross loss. A high profit factor indicates a more profitable and stable strategy over time.
The Inputs tab in MetaTrader 5's Strategy Tester allows you to configure and optimize the parameters of the Expert Advisor (EA).
In this example, only the parameters within the yellow boxes should be selected and optimized. Below is a description of each of these parameters, showing the range of values used for optimization.
The user also has the option of setting the Global Stop Loss parameter to a specific value according to their risk management strategy, or allowing the parameter to vary between configurable start and stop values with a specific step value. To do this, simply select the Global Stop Loss check box in the table below and set the parameter values.
Input Parameters
Initial Lot Size
Current Value: 0.01
Optimization Range: Start: 0.01
Step: 0.01
Stop: 0.1
Auto Lot Scaling?
Current Value: true
Optimization Range: Options: true, false.
Global Take Profit (Percentage)
Current Value: 1.6
Optimization Range: Start: 0.1
Step: 0.1
Stop: 3.0
Input Parameters
Global Stop Loss (Percentage)
Current Value: 100
Optimization Range: Start: 1.0
Step: 1.0
Stop: 100.0
AI Filter Sensitivity
Current Value: 1.8
Optimization Range: Start: 0.1
Step: 0.1
Stop: 4.0
Fine-tunes how easily trades are triggered
Current Value: 0.5
Optimization Range: Start: 0.1
Step: 0.1
Stop: 2.0
Initial Setup:
Select the Expert Advisor (Gold AI Robot\Gold AI Robot.ex5) and the symbol (XAUUSD).
Configure the timeframe (H1) and the date range (Custom period, 2020.01.01 - 2025.07.30), for example.
Select the modeling type ("1 minute OHLC") for a faster optimization.
Set the initial deposit (1000 USD) and leverage (1:100). You can select any initial deposit and higher leverage values.
Optimization Algorithm Setup:
Choose the optimization algorithm ("Fast genetic based algorithm").
Select the appropriate optimization criteria:
For funded accounts: It is not recommended to select Balance Max. Use criteria like Drawdown min or Complex Criterion max.
For regular accounts: Any optimization criterion can be selected, but Complex Criterion max is recommended.
Input Parameters Setup:
Adjust the input parameters using the start, step, and stop values indicated above.
Start the Optimization:
 Click the "Start" button to begin the optimization.
At the end of the optimization process, you will see a results window similar to the one shown below. Understanding this output is crucial for selecting the best set file for your trading strategy.Â
Key Metrics
Pass: The number of optimization iterations completed. Each pass represents a unique combination of input parameters tested during the optimization process.
Result: The overall performance score for each pass. This is often based on the selected optimization criteria, such as balance or drawdown.
Profit: The total profit generated by the EA during the optimization period.
Total trades: The total number of trades executed by the EA in each pass.
Expected payoff: The average profit per trade, calculated as total profit divided by the number of trades.
Drawdown %: The maximum drawdown percentage experienced during the optimization period. This indicates the largest peak-to-trough decline in the account balance.
takeProfitGlobalPct: The global Take Profit used in the pass.
AI_Filter_Sensitivity: The sensitivity of the AI filter used in the pass.
SignalScaler: The scaling setting to trigger the next open positions in the pass.
To select the best set file, follow these steps:
Evaluate the Criteria: Focus on passes with the best balance between high profit and low drawdown. The selected criteria (e.g., balance, drawdown) should guide this evaluation.
Check Stability: Ensure the selected pass shows consistent performance across different metrics. High profit with extremely high drawdown may not be desirable.
Review Trade Frequency: Ensure the total number of trades is reasonable. Too few trades might indicate insufficient data, while too many trades could mean signal over-optimization.
Analyze Expected Payoff: Higher expected payoff indicates more efficient trading. Select passes with a good balance between expected payoff and drawdown.
Consistency of Parameters: Ensure the selected set file has consistent and logical parameter values. Extreme values may suggest overfitting.
Plot the Balance/Equity Curves: In the Settings tab, select "Every tick" as the modelin type for a more realistic analysis, and disable the optimization algorithm by selecting "Disabled". Now, doble-click the desired pass from the Optimization Results tab to plot the Balance/Equity curves. See the results in the Graph tab.
Analyze the Metrics: To observe metrics such the Equity Drawdown Relative Percentage, click on the Backtest tab for a good risk selection criteria.
Export the Setfile: Once you identify the best pass, export the set file for use in live trading or further testing. In MetaTrader 5, click on the Inputs tab and right-click on the inputs of the desired pass, then select "Save" to save it as a set file.
Example
In the provided image, the forth pass, labeled as "0,98", has a profit of 230,346.50 and a drawdown of 24.55%. Despite the moderate profit, the drawdown is quite low, which probably suggests a conservative risk strategy. Compare it with other passes to find a balance that fits your risk tolerance.
By plotting the balance/equity curves, you can get a good overview of the pass's behavior throughout the optimization period, as can be seen in the image below:
Finally, the equity drawdown relative percentage for this pass is 73.76%, which suggests a moderate-high risk strategy. Althought, due to the 5-year optimization period, it actually represents a good value for this pass.
By carefully analyzing the optimization results, the plot of the balance/equity curves, and the backtest results, you can identify the most robust and profitable set files for your Gold AI Robot EA. This process helps ensure your trading strategy is both effective and sustainable.
Understanding and analyzing the optimization results is crucial for maximizing the performance of your Gold AI Robot EA. By following this guide and selecting the best set file, you can enhance your trading strategy and achieve more consistent results. Remember, the key is to balance profitability and risk management.