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?
2 Answers
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:
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().