Time Simulation and Alignment in the Tester
During testing, the local time is always equal to the server time. The server time always corresponds to the GMT time. The GMT, local, and server time are equal in the Strategy Tester deliberately in case there is no connection to the server. Testing results should always be the same, regardless of whether the server connection is established or not. Information about the server time is not stored locally, and is taken from the server.
The tester starts and ends at 00 hours, 00 minutes, and 00 seconds of the specified dates. Thus the start date of testing or optimization is included in the testing period, while the end date is not included. Testing ends on the last tick of the previous date. Also, you cannot specify the end date, which is greater than the current one. In such case, the testing anyway will be performed to the current date, not including it.
Sources: MetaTrader 5 documentation: testing MetaTrader 5 documentation: features
Unified Time Reference for Time-Dependent Logic
Because the three time references are synchronized, any logic that depends on the current time will operate under a single unified reference during a test run. This design means that time-dependent Expert Advisors behave consistently across different testing environments, eliminating discrepancies caused by local clock differences.
When running on historical data, the tester does not simulate variations between local and server time. As a result, EAs that use time-based conditions will operate under the assumption that all three time references are synchronized. This behavior is intentional and supports reproducibility.
Sources: MetaTrader 5 documentation: features
Reproducibility and Server Connectivity
The tester is designed to produce identical results regardless of whether the platform is connected to the trade server. Since server time information is not stored locally, every test run retrieves time data from the server if available. If the connection is lost, the tester continues using the synchronized time model, ensuring that historical simulations remain consistent.
Reproducibility is further supported by the fact that the tester does not rely on local system clocks for any critical operations. All time-sensitive calculations are based on the unified time reference established at the start of testing. This means that rerunning the same test under identical conditions will yield the same outcomes, provided the historical data and parameters remain unchanged.
Sources: MetaTrader 5 documentation: features
Multi-Currency Testing and Data Synchronization
During multi-currency testing, an individual tick sequence is generated for each symbol according to the selected tick generation mode. In modes such as 'Open prices only', synchronization between symbols becomes critical because the EA is only called on ticks corresponding to bar open times. If a new bar has opened on one symbol but not another, the tester may not trigger an event for the lagging symbol until its next bar begins.
To handle this, the tester ensures that all required symbols have their history downloaded and synchronized before testing begins. For the timeframes D1 and below, the minimum volume of the downloaded history is one year. For the one-week timeframe, the agent requests a history of 100 bars, which is about two years. For testing on a monthly timeframe, the agent requests the history for 8 years. If the required bars are not available for whatever reason, the starting date of testing is automatically shifted from the past to the present to provide the necessary amount of bars.
Sources: MetaTrader 5 documentation: features
Testing Boundaries and Forward Testing
The tester enforces strict boundaries on the testing period, starting exactly at midnight server time on the start date and ending on the last tick of the previous date. This inclusive start and exclusive end convention ensures that each bar is processed exactly once. When forward testing is enabled, the specified period is divided into backtesting and forward testing segments, with the forward portion always being the later part of the total interval.
Forward testing helps avoid overfitting by reserving a portion of the data for out-of-sample validation. The available split options include half, one-third, or one-fourth of the total period, or a custom start date. Results from the forward period are displayed on the separate tab 'Forward'. The start date of the forward period is marked by a vertical line on the chart, providing a clear visual reference for the transition between adaptation and validation phases.
Sources: MetaTrader 5 documentation: testing
History Download and Agent Operations
The platform synchronizes and downloads the history of a symbol to be tested from the trade server before starting the testing process. During the first time, the platform downloads all available history data of a symbol and does not request it later. Further only new data are downloaded. A testing agent receives 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 during testing, the testing agent requests the required history from the trading platform during the first call of such data.
The testing agents receive the history data from the platform in a compressed form. During a re-testing, the tester does not download data from the platform, because it has data from the previous tester run. The platform downloads history data from the trading server only once, when the agent accesses the platform for the first time to download the history of the tested symbol. The history is downloaded in a packed form to reduce the traffic. Ticks are not sent over the network, they are generated on testing agents.
Sources: MetaTrader 5 documentation: features
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: testingMetaTrader 5 documentation: featuresEducational content only. This article is not investment advice. Automated and leveraged trading involves substantial risk of loss.