How can a file be created on back testing?
-
I need to collect some information about price results when back testing. However, the yellow block 'write to file' creates nothing on back testing. Is that a bug or am I missing something?
-
You can write in backtest, try this: https://fxdreema.com/shared/mSTWWc6Cb
file should be created here: <terminal_data_folder>/Tester/files/test_output.csv
-
Thank you for your help. However, no file was created. In effect I didn't find the 'files' folder either. Is that folder supposed to be created at the same time that the file?
-
The File folder often exists in data folder as \MQL4\Files, like indicator file in data folder as \MQL4\Indicators.
MT4/MT5 handle file read/write like a sandbox and only those folders/files in \MQL4\Files can be assessed.
-
I confirm I looked for the file on MQL5/Files folder and no file was created after the back test. I tried on different MT5 platforms and the result is always the same.
-
Just did some demo. File IO is strictly restricted in MT5. But Print() does work.
So tried Print() to export the data you want.
The result will be in the log file. Read the line in the Journal tab of the tester, that is like
2026.02.22 22:25:41.280 Core 01 log file "C:\Users\James\AppData\Roaming\MetaQuotes\Tester\D0E8209F77C8CF37AD8BF550E51FF075\Agent-127.0.0.1-3000\logs\20260222.log" written
Open the log file and see if you can get what you want. Noted it contains some extra data that you might not want.
-
@sktsec There is nothing like that in the tester's Journal tab. This is what I get:
CP 0 15:57:24.099 Tester "Advisors\Write.ex5" X64
RI 0 15:57:24.128 Tester EURUSD: history data begins from 2023.04.07 00:00
HN 0 15:57:24.141 Tester EURUSD: preliminary downloading of history ticks started, it may take quite a long time
CS 0 15:57:24.141 Tester EURUSD: preliminary downloading of history ticks completed
PK 0 15:57:24.141 Tester EURUSD: ticks data begins from 2026.01.26 00:00
PD 0 15:57:24.142 Tester EURUSD: history data begins from 2023.04.07 00:00
KR 0 15:57:24.142 Tester EURUSD: preliminary downloading of history ticks started, it may take quite a long time
HO 0 15:57:24.142 Tester EURUSD: preliminary downloading of history ticks completed
GG 0 15:57:24.142 Tester EURUSD: ticks data begins from 2026.01.26 00:00
PR 0 15:57:24.152 Core 01 agent process started on 127.0.0.1:3000
CE 0 15:57:24.152 Core 01 connecting to 127.0.0.1:3000
RL 0 15:57:24.661 Core 01 connected
FJ 0 15:57:24.666 Core 01 authorized (agent build 5640)
NK 0 15:57:24.676 Tester EURUSD,H1 (AdmiralsGroup-Demo): visual testing of Experts\Advisors\Write.ex5 from 2026.02.23 00:00 to 2026.02.24 00:00
FP 0 15:57:24.798 Core 01 common synchronization completed
LI 0 15:57:24.839 Core 01 EURUSD: history for 2026 year synchronized
FM 0 15:57:24.839 Core 01 EURUSD: history synchronization completed [93 Kb]
MH 0 15:57:24.839 Core 01 EURUSD: 93.63 Kb of history processed in 0:00:00.016
CR 0 15:57:24.847 Core 01 EURUSD: ticks synchronization completed [277 Kb]
QE 0 15:57:33.537 Core 01 connection closedThis is very weird. What am I missing?
-
@l-andorrà I was wrong. I finally found the file!! However, no valid information is stored there, apparently. This is what I get in the log file:
CS 0 15:57:24.555 Startup MetaTester 5 build 5640, 20 Feb 2026
CS 0 15:57:24.555 Startup Windows 11 build 26200, 12 x AMD Ryzen 5 5500, AVX2, 10 / 15 Gb memory, 252 / 393 Gb disk, UAC, GMT+1
CS 0 15:57:24.557 Server MetaTester 5 started on 127.0.0.1:3000
CS 0 15:57:24.560 Startup cloud network mode is off
CS 0 15:57:24.560 Startup initialization finished
CS 0 15:57:24.665 127.0.0.1 login (build 5640)
CS 0 15:57:24.778 Network 46844 bytes of account info loaded
CS 0 15:57:24.778 Network 1478 bytes of tester parameters loaded
CS 0 15:57:24.778 Network 708 bytes of input parameters loaded
CS 0 15:57:24.782 Network 13009 bytes of symbols list loaded (2517 symbols)
CS 0 15:57:24.782 Tester expert file added: Experts\Advisors\Write.ex5. 65078 bytes loaded
CS 0 15:57:24.797 Tester 10668 Mb available, 132 blocks set for ticks generating
CS 0 15:57:24.797 Tester initial deposit 100000.00 EUR, leverage 1:30
CS 0 15:57:24.798 Tester successfully initialized
CS 0 15:57:24.798 Network 79 Kb of total initialization data received
CS 0 15:57:24.798 Tester AMD Ryzen 5 5500, 16273 MB
CS 0 15:57:24.824 Symbols EURUSD: symbol to be synchronized
CS 0 15:57:24.824 Symbols EURUSD: symbol synchronized, 3720 bytes of symbol info received
CS 0 15:57:24.828 History EURUSD: history synchronization started
CS 0 15:57:24.846 History EURUSD: load 93 Kb of history data to synchronize in 0:00:00.014
CS 0 15:57:24.846 History EURUSD: history synchronized from 2024.01.02 to 2026.02.23
CS 0 15:57:24.846 Ticks EURUSD: ticks synchronization started
CS 0 15:57:24.850 Ticks EURUSD: load 277 Kb of tick data to synchronize in 0:00:00.000
CS 0 15:57:24.850 Ticks EURUSD: history ticks synchronized from 2026.01.26 to 2026.02.23
CS 0 15:57:24.873 History EURUSD,H1: history cache allocated for 7126 bars and contains 7074 bars from 2025.01.02 00:00 to 2026.02.20 23:00
CS 0 15:57:24.873 History EURUSD,H1: history begins from 2025.01.02 00:00
CS 0 15:57:24.877 Tester EURUSD,H1 (AdmiralsGroup-Demo): generating based on real ticks
CS 0 15:57:24.877 Tester testing with execution delay 50 milliseconds
CS 0 15:57:24.877 Tester EURUSD,H1: testing of Experts\Advisors\Write.ex5 from 2026.02.23 00:00 to 2026.02.24 00:00 started with inputs:
CS 0 15:57:24.877 Tester MagicStart=7324
CS 0 15:57:24.901 Ticks EURUSD : real ticks begin from 2026.01.26 00:00:00
CS 0 15:57:33.524 Tester final balance 100000.00 EUR
CS 0 15:57:33.524 Write (EURUSD,H1) 2026.02.23 23:58:58 Backtested in 8.63 seconds
CS 0 15:57:33.524 Write (EURUSD,H1) 2026.02.23 23:58:58 Average ticks per second: 7
CS 0 15:57:33.524 Write (EURUSD,H1) 2026.02.23 23:58:58 Expert Advisor self terminated
CS 0 15:57:33.529 Tester EURUSD,H1: 63834 ticks, 24 bars generated. Environment synchronized in 0:00:00.063. Test passed in 0:00:08.692 (including ticks preprocessing 0:00:00.015).
CS 0 15:57:33.529 Tester EURUSD,H1: total time from login to stop testing 0:00:08.755 (including 0:00:00.063 for history data synchronization)
CS 0 15:57:33.530 Tester 63 Mb memory used including 0.47 Mb of history data, 64 Mb of tick data
CS 0 15:57:33.530 Tester log file "C:\Users\Cleric\AppData\Roaming\MetaQuotes\Tester\24F345EB9F291441AFE537834F9D8A19\Agent-127.0.0.1-3000\logs\20260224.log" written
CS 0 15:57:33.530 Tester test Experts\Advisors\Write.ex5 on EURUSD,H1 thread finished
CS 0 15:57:33.537 127.0.0.1 prepare for shutdown
CS 0 15:57:33.537 127.0.0.1 shutdown finished
CS 3 15:57:36.561 Tester close visual tester window
CS 0 15:57:36.617 Server MetaTester 5 stopped -
Are you reading this file:
C:\Users\Cleric\AppData\Roaming\MetaQuotes\Tester\24F345EB9F291441AFE537834F9D8A19\Agent-127.0.0.1-3000\logs\20260224.logCopy following path in the File Manager to see if there is any log file in the directory
C:\Users\Cleric\AppData\Roaming\MetaQuotes\Tester\24F345EB9F291441AFE537834F9D8A19\Agent-127.0.0.1-3000\logs\ -
@sktsec said in How can a file be created on back testing?:
C:\Users\Cleric\AppData\Roaming\MetaQuotes\Tester\24F345EB9F291441AFE537834F9D8A19\Agent-127.0.0.1-3000\logs\
This is what I did:
- I deleted all files found on C:\Users\Cleric\AppData\Roaming\MetaQuotes\Tester\24F345EB9F291441AFE537834F9D8A19\Agent-127.0.0.1-3000\logs\
- I executed a new back test.
- I found one only file there called '20260225.log'. No other file was found there.
- The content of that file is this:
CS 0 13:18:57.268 Startup MetaTester 5 build 5640, 20 Feb 2026
CS 0 13:18:57.269 Startup Windows 11 build 26200, 12 x AMD Ryzen 5 5500, AVX2, 10 / 15 Gb memory, 258 / 393 Gb disk, UAC, GMT+1
CS 0 13:18:57.270 Server MetaTester 5 started on 127.0.0.1:3000
CS 0 13:18:57.270 Startup cloud network mode is off
CS 0 13:18:57.270 Startup initialization finished
CS 0 13:18:57.363 127.0.0.1 login (build 5640)
CS 0 13:18:57.378 Network 46844 bytes of account info loaded
CS 0 13:18:57.378 Network 1478 bytes of tester parameters loaded
CS 0 13:18:57.378 Network 708 bytes of input parameters loaded
CS 0 13:18:57.381 Network 13009 bytes of symbols list loaded (2517 symbols)
CS 0 13:18:57.381 Tester expert file added: Experts\Advisors\Write.ex5. 65078 bytes loaded
CS 0 13:18:57.385 Tester 10675 Mb available, 132 blocks set for ticks generating
CS 0 13:18:57.385 Tester initial deposit 100000.00 EUR, leverage 1:30
CS 0 13:18:57.385 Tester successfully initialized
CS 0 13:18:57.385 Network 79 Kb of total initialization data received
CS 0 13:18:57.385 Tester AMD Ryzen 5 5500, 16273 MB
CS 0 13:18:57.390 Symbols EURUSD: symbol to be synchronized
CS 0 13:18:57.390 Symbols EURUSD: symbol synchronized, 3720 bytes of symbol info received
CS 0 13:18:57.398 History EURUSD: load 27 bytes of history data to synchronize in 0:00:00.000
CS 0 13:18:57.398 History EURUSD: history synchronized from 2024.01.02 to 2026.02.23
CS 0 13:18:57.398 Ticks EURUSD: ticks synchronization started
CS 0 13:18:58.416 Ticks EURUSD: load 218 Kb of tick data to synchronize in 0:00:01.016
CS 0 13:18:58.416 Ticks EURUSD: history ticks synchronized from 2026.01.26 to 2026.02.23
CS 0 13:18:58.439 History EURUSD,H1: history cache allocated for 6995 bars and contains 6978 bars from 2025.01.02 00:00 to 2026.02.16 23:00
CS 0 13:18:58.439 History EURUSD,H1: history begins from 2025.01.02 00:00
CS 0 13:18:58.442 Tester EURUSD,H1 (AdmiralsGroup-Demo): generating based on real ticks
CS 0 13:18:58.442 Tester testing with execution delay 50 milliseconds
CS 0 13:18:58.442 Tester EURUSD,H1: testing of Experts\Advisors\Write.ex5 from 2026.02.17 00:00 to 2026.02.18 00:00 started with inputs:
CS 0 13:18:58.442 Tester MagicStart=7324
CS 0 13:18:58.453 Ticks EURUSD : real ticks begin from 2026.01.26 00:00:00
CS 0 13:18:58.472 Tester final balance 100000.00 EUR
CS 0 13:18:58.472 Write (EURUSD,H1) 2026.02.17 23:58:55 Backtested in 0.03 seconds
CS 0 13:18:58.472 Write (EURUSD,H1) 2026.02.17 23:58:55 Average ticks per second: 1579
CS 0 13:18:58.472 Write (EURUSD,H1) 2026.02.17 23:58:55 Expert Advisor self terminated
CS 0 13:18:58.476 Tester EURUSD,H1: 50532 ticks, 24 bars generated. Environment synchronized in 0:00:01.040. Test passed in 0:00:00.072 (including ticks preprocessing 0:00:00.016).
CS 0 13:18:58.476 Tester EURUSD,H1: total time from login to stop testing 0:00:01.112 (including 0:00:01.040 for history data synchronization)
CS 0 13:18:58.476 Tester 52 Mb memory used including 0.47 Mb of history data, 64 Mb of tick data
CS 0 13:18:58.476 Tester log file "C:\Users\Cleric\AppData\Roaming\MetaQuotes\Tester\24F345EB9F291441AFE537834F9D8A19\Agent-127.0.0.1-3000\logs\20260225.log" written
CS 0 13:18:58.476 Tester test Experts\Advisors\Write.ex5 on EURUSD,H1 thread finished
CS 0 13:18:58.481 127.0.0.1 prepare for shutdown
CS 0 13:18:58.481 127.0.0.1 shutdown finishedAm I missing something?
-
I tried on different MT5 platform with the same result. What am I missing?
-
I test with EA https://fxdreema.com/shared/i8TIJUagb
It prints out daily moving average of input period. The full log is as follows:
CS 0 00:21:48.028 Startup MetaTester 5 build 5640, 20 Feb 2026
CS 0 00:21:48.028 Startup Windows 11 build 26200, 20 x 13th Gen Intel Core i7-13700H, AVX2, 18 / 29 Gb memory, 83 / 475 Gb disk, RDP, UAC, GMT+8
CS 0 00:21:48.029 Server MetaTester 5 started on 127.0.0.1:3000
CS 0 00:21:48.032 Startup cloud network mode is off
CS 0 00:21:48.033 Startup initialization finished
CS 0 00:21:48.323 127.0.0.1 login (build 5640)
CS 0 00:21:48.350 Network 17744 bytes of account info loaded
CS 0 00:21:48.350 Network 1478 bytes of tester parameters loaded
CS 0 00:21:48.350 Network 1220 bytes of input parameters loaded
CS 0 00:21:48.350 Network 659 bytes of symbols list loaded (111 symbols)
CS 0 00:21:48.350 Tester expert file added: Experts\TestBacktestPrintout.ex5. 72996 bytes loaded
CS 0 00:21:48.352 Tester 18976 Mb available, 236 blocks set for ticks generating
CS 0 00:21:48.352 Tester calculate profit in pips, initial deposit 200000, leverage 1:100
CS 0 00:21:48.352 Tester successfully initialized
CS 0 00:21:48.352 Network 73 Kb of total initialization data received
CS 0 00:21:48.352 Tester 13th Gen Intel Core i7-13700H, 30345 MB
CS 0 00:21:48.356 Symbols EURUSD: symbol to be synchronized
CS 0 00:21:48.357 Symbols EURUSD: symbol synchronized, 3720 bytes of symbol info received
CS 0 00:21:48.358 History EURUSD: load 27 bytes of history data to synchronize in 0:00:00.000
CS 0 00:21:48.358 History EURUSD: history synchronized from 2024.01.02 to 2026.02.27
CS 0 00:21:48.375 History EURUSD,M15: history cache allocated for 28347 bars and contains 26358 bars from 2025.01.02 00:00 to 2026.01.30 23:45
CS 0 00:21:48.375 History EURUSD,M15: history begins from 2025.01.02 00:00
CS 0 00:21:48.375 Tester EURUSD,M15 (Afterprime-Ltd): OHLC bar states generating. OnTick executed on the bar begin only
CS 0 00:21:48.375 Tester execution delay discarded because of open prices testing mode
CS 0 00:21:48.375 Tester EURUSD,M15: testing of Experts\TestBacktestPrintout.ex5 from 2026.02.01 00:00 to 2026.03.01 00:00 started with inputs:
CS 0 00:21:48.375 Tester maPeriod=20
CS 0 00:21:48.375 Tester MagicStart=3742
CS 0 00:21:48.382 TestBacktestPrintout (EURUSD,M15) 2026.02.02 00:00:00 2026.02.02 00:00:00 1.1864325
CS 0 00:21:48.382 TestBacktestPrintout (EURUSD,M15) 2026.02.03 00:00:00 2026.02.03 00:00:00 1.1788945
CS 0 00:21:48.382 TestBacktestPrintout (EURUSD,M15) 2026.02.04 00:00:00 2026.02.04 00:00:00 1.1815805
CS 0 00:21:48.382 TestBacktestPrintout (EURUSD,M15) 2026.02.05 00:00:00 2026.02.05 00:00:00 1.180219
CS 0 00:21:48.382 TestBacktestPrintout (EURUSD,M15) 2026.02.06 00:00:00 2026.02.06 00:00:00 1.179056
CS 0 00:21:48.382 TestBacktestPrintout (EURUSD,M15) 2026.02.09 00:00:00 2026.02.09 00:00:00 1.1818279999999999
CS 0 00:21:48.382 TestBacktestPrintout (EURUSD,M15) 2026.02.10 00:00:00 2026.02.10 00:00:00 1.1913645
CS 0 00:21:48.382 TestBacktestPrintout (EURUSD,M15) 2026.02.11 00:00:00 2026.02.11 00:00:00 1.189603
CS 0 00:21:48.382 TestBacktestPrintout (EURUSD,M15) 2026.02.12 00:00:00 2026.02.12 00:00:00 1.187804
CS 0 00:21:48.382 TestBacktestPrintout (EURUSD,M15) 2026.02.13 00:00:00 2026.02.13 00:00:00 1.1865999999999999
CS 0 00:21:48.382 TestBacktestPrintout (EURUSD,M15) 2026.02.16 00:00:00 2026.02.16 00:00:00 1.187173
CS 0 00:21:48.382 TestBacktestPrintout (EURUSD,M15) 2026.02.17 00:00:00 2026.02.17 00:00:00 1.185116
CS 0 00:21:48.382 TestBacktestPrintout (EURUSD,M15) 2026.02.18 00:00:00 2026.02.18 00:00:00 1.1847115
CS 0 00:21:48.382 TestBacktestPrintout (EURUSD,M15) 2026.02.19 00:00:00 2026.02.19 00:00:00 1.1789855
CS 0 00:21:48.382 TestBacktestPrintout (EURUSD,M15) 2026.02.20 00:00:00 2026.02.20 00:00:00 1.176836
CS 0 00:21:48.382 TestBacktestPrintout (EURUSD,M15) 2026.02.23 00:00:00 2026.02.23 00:00:00 1.1783625
CS 0 00:21:48.382 TestBacktestPrintout (EURUSD,M15) 2026.02.24 00:00:00 2026.02.24 00:00:00 1.179229
CS 0 00:21:48.382 TestBacktestPrintout (EURUSD,M15) 2026.02.25 00:00:00 2026.02.25 00:00:00 1.177929
CS 0 00:21:48.382 TestBacktestPrintout (EURUSD,M15) 2026.02.26 00:00:00 2026.02.26 00:00:00 1.180666
CS 0 00:21:48.382 TestBacktestPrintout (EURUSD,M15) 2026.02.27 00:00:00 2026.02.27 00:00:00 1.179049
CS 0 00:21:48.382 Tester final balance 200000.00 pips
CS 0 00:21:48.382 TestBacktestPrintout (EURUSD,M15) 2026.02.27 23:59:59 Backtested in 0.00 seconds
CS 0 00:21:48.382 TestBacktestPrintout (EURUSD,M15) 2026.02.27 23:59:59 Expert Advisor self terminated
CS 0 00:21:48.385 Tester EURUSD,M15: 7534 ticks, 1920 bars generated. Environment synchronized in 0:00:00.030. Test passed in 0:00:00.031.
CS 0 00:21:48.385 Tester EURUSD,M15: total time from login to stop testing 0:00:00.061 (including 0:00:00.030 for history data synchronization)
CS 0 00:21:48.385 Tester 32 Mb memory used including 1.88 Mb of history data, 64 Mb of tick data
CS 0 00:21:48.385 Tester log file "C:\Users\James\AppData\Roaming\MetaQuotes\Tester\D0E8209F77C8CF37AD8BF550E51FF075\Agent-127.0.0.1-3000\logs\20260301.log" written
CS 0 00:21:48.385 Tester test Experts\TestBacktestPrintout.ex5 on EURUSD,M15 thread finished
CS 0 00:21:48.389 127.0.0.1 prepare for shutdown
CS 0 00:21:48.389 127.0.0.1 shutdown finished -
It works with Print() in MQL.
Each line I print out the time of calculation, and the moving average. Other information preceding that is added by the tester.
Maybe something complicated in your Print() ?
-
It worked!!! Apparently the problem was somewhere within jstap's code. I have no idea what exactly. This one works perfectly fine. Thank you very much, my friend!

-
Glad to know you solved the problem.