How Does the MQL5 Distributed Cloud Network Work?

Introduction to the MQL5 Distributed Cloud Network

The landscape of algorithmic trading demands ever-increasing computational power, particularly for tasks like strategy optimization and complex backtesting across extensive historical data. While modern multi-core processors significantly accelerate local computations, certain tasks, especially exhaustive multi-parameter optimizations, can still take days or even weeks on a single machine. Recognizing this bottleneck, MetaQuotes Software Corp. introduced a groundbreaking solution integrated into the MetaTrader 5 platform: the MQL5 Distributed Cloud Network.

Overview of the MQL5 Cloud Network

The MQL5 Cloud Network is a global, decentralized computing platform that allows users to harness the collective power of thousands of computers worldwide for resource-intensive tasks, primarily strategy testing and optimization within MetaTrader 5. It operates on a peer-to-peer model where users volunteer their idle CPU resources to execute testing tasks submitted by other users.

This network is built directly into the MetaTrader 5 infrastructure, providing a seamless integration with the Strategy Tester. Unlike traditional cloud computing services, the MQL5 Cloud Network is specifically designed and optimized for the unique demands of algorithmic trading simulations, handling tick data, trading environment simulations, and complex MQL5 code execution efficiently.

Purpose and Benefits for MQL5 Developers and Traders

The primary purpose of the network is to drastically reduce the time required for strategy optimization and backtesting. For MQL5 developers, this means faster iteration cycles when refining algorithmic trading strategies. Instead of waiting days for an optimization pass, results can be obtained in minutes or hours, enabling more extensive parameter exploration and faster identification of robust trading rules.

Traders utilizing Expert Advisors gain the ability to thoroughly optimize their strategies without needing to invest in high-end server hardware. The cost of using the network is significantly lower than acquiring and maintaining dedicated computing resources proportional to the speed increase achieved. Furthermore, the network provides a mechanism for participants to earn money by renting out their idle CPU time.

Key Components: Agents, Testers, and the Network Core

The MQL5 Cloud Network is composed of three main entities:

  • Testing Agents: These are software components installed on users’ computers. They utilize the idle CPU cores of the host machine to execute computing tasks received from the network. Agents only run when the computer is idle or according to user-defined rules, minimizing interference with regular usage.
  • Strategy Testers (Client Side): This refers to the Strategy Tester interface within the MetaTrader 5 terminal used by a trader or developer. It is the client that defines the testing or optimization task, submits it to the network, and receives the results.
  • Network Core: This is the central server infrastructure maintained by MetaQuotes. It acts as the coordination layer, receiving tasks from Testers, distributing them among available Agents worldwide, monitoring execution, collecting results, managing the billing system, and ensuring data integrity and security.

How the MQL5 Cloud Network Operates

The operational flow of the MQL5 Cloud Network is designed for efficiency, security, and reliability, despite its decentralized nature.

The Process of Task Distribution and Execution

When a user initiates an optimization or testing task using the Strategy Tester in MetaTrader 5 and opts to use the Cloud Network, the terminal sends the task definition (including the Expert Advisor, symbols, timeframes, testing parameters, historical data requirements, and optimization criteria) to the Network Core. The Core breaks down the large task into many smaller, independent sub-tasks, each representing a specific set of input parameters for an optimization pass or a segment of a backtest.

The Core then distributes these sub-tasks to available Testing Agents registered on the network globally. An Agent receives a sub-task, downloads any necessary historical data or executable files (like the compiled EX5 of the EA), executes the simulation using its local CPU resources, and sends the results back to the Network Core. This parallel processing of numerous sub-tasks across many machines is what enables the significant speedup.

Agent Registration and Availability

Users who wish to contribute computing power install MQL5 Testing Agents on their computers. These agents are typically part of the MetaTrader 5 installation or can be downloaded separately. Upon installation, an Agent registers itself with the Network Core, indicating its availability and hardware specifications. Users can configure when agents should run (e.g., only when idle, always, during specific hours) and how many CPU cores to utilize.

The Network Core keeps track of the pool of available agents and their current workload. When a task is submitted, the Core intelligently selects suitable agents based on the task requirements (e.g., needed historical data availability, processing power) and the agents’ current load and configuration.

Quality Control and Result Verification

Ensuring the accuracy and reliability of results is paramount in a distributed system involving untrusted nodes. The MQL5 Cloud Network employs several mechanisms for quality control. The Network Core may send the same sub-task to multiple different agents (redundancy) and compare their results. Discrepancies trigger further verification or exclusion of agents providing inconsistent data.

Agents are also monitored for their performance and reliability. Agents that frequently return errors, take excessively long, or provide incorrect results may be penalized or temporarily suspended from receiving tasks. This continuous monitoring and verification process helps maintain the integrity of the computations performed across the network.

Participating in the MQL5 Cloud Network

Participation in the network is open to anyone and involves either utilizing its power for testing/optimization or contributing computing resources.

Becoming a Testing Agent: Requirements and Setup

To become a Testing Agent, a user needs a computer with a modern processor and a stable internet connection. The MQL5 Testing Agent software is downloaded and installed. During setup, the user logs in with their MQL5.community account. This account is used to track the work performed by the agent and manage earnings.

The setup allows configuring the agent’s behavior, such as specifying which CPU cores to use (it’s recommended to leave at least one core free for system tasks), setting when the agent should be active (e.g., only when the computer is unlocked, only when idle, always), and defining network bandwidth limits. Agents automatically update and require minimal ongoing maintenance.

Earning Money by Providing Computing Power

Agents are compensated for the computing time they contribute to the network. The payment is calculated based on the amount of CPU time consumed by executed tasks and the complexity/speed of the agent’s processor. The Network Core automatically tracks the work performed by each registered agent under the user’s MQL5.community account.

Earnings accumulate in the user’s MQL5.community internal account balance. The rates paid for computing time are dynamically adjusted based on supply and demand within the network, though MetaQuotes sets base rates.

Withdrawing Earnings from the MQL5 Cloud Network

Funds earned by running testing agents are credited to the MQL5.community account balance. Users can check their balance and view detailed work statistics directly on the MQL5.com website. Earnings accumulated this way can be used to purchase products or services on the MQL5.community market (like Expert Advisors, indicators, or access to VPS services) or can be withdrawn to external payment systems supported by MQL5.community. Withdrawal options typically include various e-wallets and bank transfers, subject to minimum withdrawal amounts and verification procedures.

Using the MQL5 Cloud Network for Optimization and Testing

The primary interface for leveraging the computational power of the Cloud Network is the built-in Strategy Tester within the MetaTrader 5 terminal.

Integrating the Network into the MetaTrader 5 Strategy Tester

To use the Cloud Network for a testing or optimization run, open the Strategy Tester in MetaTrader 5 (View -> Strategy Tester). Configure the testing parameters as usual: select the Expert Advisor, symbol, timeframe, date range, and testing mode (e.g., Every Tick).

In the ‘Agents’ tab of the Strategy Tester settings, instead of selecting ‘Local agents’ or ‘Remote agents’, choose ‘MQL5 Cloud Network’. The terminal will then connect to the network coordinator. When you start an optimization (e.g., ‘Genetic Optimization’ or ‘Complete Optimization’), the Strategy Tester will package the task and send it to the Cloud Network for distributed execution.

Optimizing Expert Advisors with Distributed Computing

Optimization is where the Cloud Network truly shines. An optimization process involves running the EA multiple times with different combinations of input parameters to find the set that yields the best results based on a chosen criterion (e.g., maximum profit, minimum drawdown). A ‘Complete Optimization’ can test thousands or millions of parameter combinations.

By distributing these individual test runs across potentially thousands of Cloud Network agents simultaneously, an optimization that would take days or weeks on a single machine can be completed in hours. The Genetic Optimization method, while also benefiting, breaks the task down differently; the Cloud Network accelerates the evaluation of each generation within the genetic algorithm.

Speeding up Testing with Multiple Agents

Even for single backtest runs, if the chosen testing mode is computationally intensive (like ‘Every Tick Based on Real Ticks’) and the history period is long, using multiple local or remote agents can speed it up by dividing the historical data into segments processed in parallel. The MQL5 Cloud Network extends this concept globally.

While a single backtest run itself cannot be infinitely parallelized (it’s a sequential simulation), the evaluation of many different parameter sets during optimization is perfectly suited for distributed computing. The network’s power is most evident when running ‘Complete Optimization’ across a wide range of input parameters.

Best Practices for Effective Cloud Network Utilization

  • Prepare Data: Ensure your MetaTrader 5 terminal has downloaded high-quality historical data for the symbols and timeframes you plan to test. While agents can download data, having it locally can sometimes speed up the initial task setup.
  • Define Clear Optimization Goals: Use the Strategy Tester’s optimization criteria effectively. Running an exhaustive optimization without clear goals can generate vast amounts of data that are difficult to analyze.
  • Start with Smaller Ranges: For complex EAs or many parameters, begin with smaller parameter ranges or a ‘Genetic Optimization’ before attempting a ‘Complete Optimization’ over vast ranges, which can be expensive and still take significant time even with the network.
  • Monitor Costs: Keep an eye on the estimated cost shown in the Strategy Tester for complex tasks and your current MQL5.community balance. The network charges per unit of computation.
  • Ensure EA Stability: Test your Expert Advisor locally first to ensure it doesn’t crash or produce errors, as this wastes time and money when run on the network.

Advanced Features and Considerations

Understanding the underlying aspects of the network is crucial for sophisticated users.

Security Aspects of the MQL5 Cloud Network

Security is a major concern in a distributed system. The MQL5 Cloud Network addresses this in several ways:

  • Code Security: Expert Advisor code (the EX5 file) is not directly sent to agents. Instead, the Network Core generates a unique encrypted task package for each agent, containing only the necessary data and instructions. Agents execute this package in an isolated environment.
  • Data Security: Historical data required for testing is also securely transferred. Agents cannot access personal files or sensitive information on the host computer.
  • Financial Security: Billing and payments are handled centrally and securely through the MQL5.community account.
  • Result Verification: As mentioned, redundant computations and monitoring prevent malicious or faulty agents from corrupting results.

While no system is entirely immune, MetaQuotes has implemented significant measures to protect users and participants.

Network Limitations and Troubleshooting

Despite its power, the network has limitations. Its primary use case is easily parallelizable tasks like parameter sweeps in optimization. It’s less beneficial for single, long, sequential backtests. Performance can sometimes be affected by network congestion, agent availability, or the complexity of the specific task.

Troubleshooting issues often involves checking the Strategy Tester logs for error messages related to task distribution or agent communication. Ensuring a stable internet connection for both the client terminal and any local agents is critical. Issues with specific agents might require contacting MQL5.community support or checking the agent’s local logs.

Future Developments and Potential Enhancements

The MQL5 Cloud Network is a continuously evolving platform. Potential future developments could include support for a wider range of computing tasks beyond strategy testing, perhaps involving machine learning model training or complex data analysis related to market data. Further optimization of the task distribution algorithm, enhanced security protocols, and potentially new ways for users to interact with the network (e.g., via APIs for more customized task submission) are also possibilities that would build upon its current success in revolutionizing MQL5 strategy optimization.


Leave a Reply