Documented Restrictions on User Interaction
The MetaTrader 5 documentation explicitly states that during testing and optimization, graphical objects are not plotted. When an Expert Advisor attempts to access the properties of a created object during a test, it receives zero values. This limitation does not apply to testing in visual mode, where objects can be displayed on the chart. Consequently, any code relying on object property retrieval will fail to obtain meaningful data unless visual testing is enabled.
The testing environment also restricts direct user interaction. While the visual mode allows for manual control such as pausing, speeding up, or jumping to specific dates via hot keys, the underlying automated processes cannot rely on real-time user input. The tester operates on historical data sequences, and any functions designed to capture live user events or interface interactions are not supported outside of the visual simulation window.
Sources: MetaTrader 5 documentation: features MetaTrader 5 documentation: testing
External Communications and File System Limitations
According to the platform documentation, agents never record EX5 files received from the platform to a hard disk for security reasons. All file operations performed by an agent during testing are isolated within a specific folder structure, namely agent_name/MQL5/Files. This sandboxing prevents unauthorized access to the host system's file structure. Additionally, DLL calls are absolutely prohibited on remote agents, and on local agents, they are only permitted if the 'Allow import DLL' option is explicitly enabled.
The documentation further specifies that traffic between the platform and agents is encrypted, and ticks are not sent over the network but generated locally on the testing agents. This isolation ensures that external network communications are minimized. However, the use of shared folders between local agents and the trading platform is documented as a method for implementing interaction, though it remains within the confines of the specified sandbox directories.
Sources: MetaTrader 5 documentation: features MetaTrader 5 documentation: testing
Output Restrictions and Logging
The documentation outlines specific limitations regarding output during testing, particularly for remote agents. Results of the Print() function, as well as messages about position opening and closing, are not recorded in the remote agent logs. To prevent hard drives from being overwhelmed by messages from incorrectly operating Expert Advisors, a minimum amount of information is added to the log. This restriction means that developers cannot rely on remote agent logs for detailed debugging output.
In contrast, local agents do record these messages, and the testing progress is reflected in the Journal. In visual testing mode, the logs of testing agents are not sent to the Strategy Tester of the trading platform while the visualizer is open. However, they can be viewed via the trading platform using the 'Local Journals of local agents' command in the context menu, providing a pathway for developers to inspect detailed execution logs.
Sources: MetaTrader 5 documentation: features MetaTrader 5 documentation: testing
Data Access and Symbol Synchronization
During multi-currency testing, the tester automatically downloads the history of required symbols from the trading platform during the first call of the symbol data. Only the missing price history data are additionally downloaded from the trading server. The testing agent requests the history of a symbol to be tested from the trading platform right after the start of testing. If data of other instruments are used, the testing agent requests the required history from the trading platform during the first call of such data, ensuring that all necessary price information is available.
The documentation also highlights that in the 'Open prices only' and '1 minute OHLC' testing modes, pending orders, as well as SL and TP, are executed at the prices specified in the orders. This contrasts with accurate modes like 'Every tick' and 'Real ticks', where execution occurs at current market prices, which can result in slippage. The synchronization of bars across different symbols is required in 'Open prices only' mode, and the tester ensures that a new bar for each symbol is opened regardless of how the bar has opened on another symbol.
Sources: MetaTrader 5 documentation: features MetaTrader 5 documentation: testing
Contrast with Terminal Operation
The testing environment deliberately differs from live terminal operation in several key aspects. During testing, the local time is always equal to the server time, which corresponds to GMT, ensuring that testing results are consistent regardless of whether the server connection is established. In contrast, the live terminal may display local time based on the user's system settings, which can differ from server time. This deliberate synchronization in the tester eliminates variability in time-based logic.
Furthermore, global variables of the trading platform are emulated during testing but are not related to real global variables of the platform, which can be viewed by pressing F3. This means that all operations with global variables are performed outside the trading platform during testing, on the testing agent. In live operation, global variables are stored and managed within the platform's environment, allowing for persistent state across sessions, which is not the case in the isolated testing agent environment.
Sources: MetaTrader 5 documentation: features MetaTrader 5 documentation: testing
AI-assisted educational article. Automated checks reviewed source support and quality; they do not guarantee accuracy. This is not investment advice. Leveraged and automated trading involves substantial risk of loss.
Sources & further reading
MetaTrader 5 documentation: featuresMetaTrader 5 documentation: testingEducational content only. This article is not investment advice. Automated and leveraged trading involves substantial risk of loss.