Skip to content
All library documents

Integrating a New Strategy into a Multi-Currency Optimization Framework

Article MQL5 articles

Summary

This article describes changes needed to add a SimpleCandles strategy to a modular, multi-currency Expert Advisor project and its automated optimization workflow. It emphasizes keeping reusable library code independent from project-specific logic, then traces the adjustments needed to create optimization tasks and pass strategy parameters through the first-stage EA. One example adds a maximum-spread input that blocks entries when current spread exceeds the configured limit.

The article also addresses occasional failures when concurrent test agents write results to an optimization database. It proposes retrying locked or busy database operations after a short randomized pause, with a bounded number of attempts, and applies the same idea to individual queries. It revises array-loop macros to make debugging easier and adds a macro for iterating while assigning array values. These are implementation lessons for the described MQL5 pipeline; the excerpt does not report comparative trading performance or establish that the retry settings suit every database workload.

Key ideas

  • A new strategy must be integrated while preserving separation between reusable libraries and project code.
  • Strategy inputs need to be passed through the EA’s initialization and optimization configuration.
  • Database lock and busy errors can be handled with bounded retries and short randomized delays.
  • Reworking loop macros can improve stepwise debugging and simplify array iteration.
  • The article focuses on software architecture and optimization workflow rather than strategy performance.

Tags

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