Testing MetaTrader 4 Programs When Forex Markets Are Closed
Summary
The document explains how to test MetaTrader 4 expert advisors and indicators when the live forex market is offline. Its main recommendation is the platform’s Strategy Tester, which can run historical backtests independently of live market hours. For indicator checks, visual mode is described as the available testing option.
The answers distinguish simulated trading tests from initialization checks. For more detailed historical simulation, the tester’s every-tick model can generate ticks from bar data, though this can take longer and is less accurate than testing with actual tick data. The text mentions an external suite for incorporating tick data and fake tick senders for triggering initialization or calculations that depend on incoming ticks.
The guidance is platform-specific and does not provide code or a complete testing procedure. Simulated ticks derived from OHLC bars are an approximation, while indicator backtesting is described as limited to visual mode; results therefore depend on data quality and the chosen modeling approach.
Key ideas
- MetaTrader 4’s Strategy Tester allows programs to be tested outside live market hours.
- Indicator testing is described as limited to visual mode in the tester.
- The every-tick model derives simulated ticks from historical bar data and may run slowly.
- Actual tick data can improve historical test detail, while fake tick senders can help check initialization and tick-dependent calculations.
Tags
Full text
# Test .mql4 (meta trader 4 editor) when the fx market offline # Test .mql4 (meta trader 4 editor) when the fx market offline I am coding some simple .mql4 program, you know, the fx market is offline on weekend, and the market will be not shown in Meta trader 4 platform. I wanna test my program in meta trader 4 on weekend. If you know how to test it when the market offline, please let me how to do this? ## Answer by revivalfx (score 1) https://quant.stackexchange.com/a/18009 You need to use the strategy tester. It is a built in feature of mt4 and well known and documented. For more information you can google "mt4 strategy tester" or just check mql4.com (or mql5.com.... they are starting to merge pages from mql4 to mql5). You can start here: http://www.investopedia.com/university/forex-software-metatrader-4-advanced-guide/strategy-testing-and-optimization.asp ## Answer by Jon Grah (score 1) https://quant.stackexchange.com/a/32979 If you want to test actually trading functions (simulate indicator's visual calculations) in a simulated market environment, then you need to use the built-in 'Tester' function to backtest your strategy or indicator (indicator backtesting is limited to `visual mode` only). edit: to maximize the accuracy of the test, consider running the test using the `every tick` Model. Now mt4 will generate its own simulated ticks based on the OHLC of the bars of the data range. This could take a while. Much more accurate to use actual ticks. Mt4 does not support direct import of sub-minute/tick data, but this can be "injected" using Birt's Tick Data Suite. v2 has pretty much automated the tick collection, and integration into mt4 tester process. Before, you had to manually create the fxt files by hand, copy them to the terminal(s) you wanted to test on. And you had to recreate the fxt files anytime you want to run on more recent data than the existing fxt had.. That could be every day. If you want to make sure EA can initialize properly, you can use a fake tick sender program like Ticker or MT4Bar. It simulates ticks being sent to mt4 client so the EA can initialize properly and run certain calculations that require onTick().
Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.