| """Developer: load the Market build in the Strategy Tester (what the Market validator does) and print its journal lines.
|
|
|
| usage: tf_guard_check.py SYMBOL PERIOD FROM TO e.g. EURUSD.pro H1 2026.10.01 2026.10.10
|
| Expect the one line 'does nothing in the Strategy Tester' and no error/failed lines. Testing install only.
|
| """
|
| import os, subprocess, sys, time, glob
|
| from pathlib import Path
|
|
|
| D = Path(os.environ.get("TF_DATA", r"C:\Users\gebruiker\AppData\Roaming\MetaQuotes\Terminal\D0E8209F77C8CF37AD8BF550E51FF075"))
|
| EXE = os.environ.get("TF_EXE", r"C:\Program Files\MetaTrader 5\terminal64.exe")
|
| sym, per, fr, to = sys.argv[1:5]
|
| ini = Path(os.environ["TEMP"]) / "tf_guard.ini"
|
| ini.write_bytes(b"\xff\xfe" + (
|
| "[Tester]\nExpert=Tick_Forge_Market\\Tick_Forge\nSymbol=%s\nPeriod=%s\nModel=1\nFromDate=%s\nToDate=%s\nForwardMode=0\n"
|
| "Deposit=10000\nCurrency=USD\nLeverage=100\nOptimization=0\nVisual=0\nReport=tf_guard_report\nReplaceReport=1\nShutdownTerminal=1\n"
|
| % (sym, per, fr, to)).replace("\n", "\r\n").encode("utf-16-le"))
|
| t0 = time.time()
|
| subprocess.run([EXE, "/config:%s" % ini], timeout=600)
|
| logs = sorted(glob.glob(str(D / "Tester" / "logs" / "*.log")), key=os.path.getmtime)
|
| if not logs:
|
| sys.exit("no tester log")
|
| for l in Path(logs[-1]).read_bytes().decode("utf-16", "ignore").splitlines():
|
| if "Tick Forge" in l or "rror" in l or "failed" in l:
|
| print(l.encode("ascii", "ignore").decode()[:220])
|