Skip to content
All library documents

Using Simulated Annealing to Optimize Trading Strategy Parameters

Article MQL5 articles

Summary

This article describes simulated annealing as a stochastic method for searching trading strategy parameters. Starting from a candidate parameter set, it generates new candidates and evaluates them with a chosen objective function. Better candidates become the current best, while some worse candidates may be accepted according to a temperature-dependent probability. Cooling reduces that probability over time, helping the search explore broadly at first and focus later. The article outlines Boltzmann, Cauchy, and ultrafast variants, which differ in how they generate candidates and lower temperature.

The method is integrated into a MetaTrader 5 Expert Advisor through classes and tester callbacks, then illustrated with a Moving Average EA and compared with the platform’s genetic optimizer. The article reports that ultrafast annealing performed best among the tested variants, but the provided excerpt gives no detailed quantitative comparison to assess generality. Results depend on the objective, parameter ranges, cooling settings, and iteration limits. The approach also requires EA integration and parameter tuning, and the article notes that it cannot run in cloud testing.

Key ideas

  • Simulated annealing searches parameter space by proposing and evaluating successive candidates.
  • A temperature-based probability lets the search accept some worse candidates and escape local optima.
  • Candidate generation and cooling schedules distinguish the Boltzmann, Cauchy, and ultrafast variants.
  • The article integrates the optimizer into a MetaTrader 5 Expert Advisor and compares it with genetic optimization.
  • Performance depends on configuration, and the described implementation has integration and cloud-testing limitations.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.