Best practices for parameter optimization of gold trading EAs

 

Hello everyone,

I wanted to share some lessons learned about parameter optimization, hoping to get your feedback and maybe some ideas to improve.

1. Walk-forward optimization beats simple single-period optimization. A strategy that looks great on one year of history often breaks on the next six months.

2. Use a realistic spread model and slippage. Backtesting gold with a 20-cent spread is very different from the real 35-50 cents you see during London/NY sessions.

3. Avoid overfitting by limiting the number of free parameters. I try to keep each EA to no more than 5-6 meaningful inputs, and I check that the equity curve stays smooth across different starting points of the test period.

4. Out-of-sample validation is essential. I reserve the last 20% of history and never look at it during optimization.

5. Be careful with tick data gaps around rollovers and low-liquidity weekends on XAUUSD.

What do you use in your own workflow? Do you prefer genetic optimization or full grid search? Any tips on avoiding curve-fitting when working with gold specifically?

Best regards

 
Phan Van Khoa:


Thanks for reading. One more thing I should mention: I always validate with different broker settings (spread, commission, and swap) because the same EA can behave completely differently across brokers. It would be great to hear how others handle broker-dependent parameters in their gold EAs.

 
One practical check is to validate each parameter set under different broker settings, especially spread, commission, and swap. For XAUUSD I also find it useful to limit the number of free inputs, keep an out-of-sample segment untouched, and compare walk-forward results against a simple baseline. If performance changes a lot when spread or session filters move, the strategy is probably overfit.