45 lines
1.5 KiB
Python
45 lines
1.5 KiB
Python
"""Dry-run: generate .set + .ini with frozen baseline, verify format."""
|
|
import sys
|
|
from pathlib import Path
|
|
PROJECT = Path(__file__).resolve().parent
|
|
sys.path.insert(0, str(PROJECT))
|
|
|
|
from shared.config import get_secret, load_env
|
|
from shared.mt5_pipeline.ini_gen import TesterConfig, write_tester_ini, MODEL_OHLC
|
|
from shared.mt5_pipeline.set_gen import write_set_file
|
|
from strategies.gold_scalper_pro.search_space import FROZEN_BASELINE
|
|
from strategies.gold_scalper_pro.set_mappings import GOLD_SCALPER_MAPPINGS
|
|
|
|
load_env(PROJECT)
|
|
mt5_data = Path(get_secret("MT5_DATA_PATH"))
|
|
profiles = mt5_data / "MQL5" / "Profiles" / "Tester"
|
|
profiles.mkdir(parents=True, exist_ok=True)
|
|
|
|
set_path = profiles / "GoldScalperPro_dryrun.set"
|
|
write_set_file(FROZEN_BASELINE, GOLD_SCALPER_MAPPINGS, set_path)
|
|
print(f"set written: {set_path}")
|
|
print(f" size: {set_path.stat().st_size} bytes")
|
|
print(f" first bytes: {set_path.read_bytes()[:40]}")
|
|
|
|
ini_path = profiles / "GoldScalperPro_dryrun.ini"
|
|
tcfg = TesterConfig(
|
|
expert=r"Experts\GoldScalperPro.ex5",
|
|
symbol="XAUUSD",
|
|
period="M5",
|
|
model=MODEL_OHLC,
|
|
from_date="2024.06.26",
|
|
to_date="2026.06.26",
|
|
deposit=10000.0,
|
|
leverage=100,
|
|
report="report_dryrun",
|
|
shutdown_terminal=True,
|
|
set_file=str(set_path),
|
|
login=int(get_secret("MT5_DEMO_LOGIN")),
|
|
password=get_secret("MT5_DEMO_PASSWORD"),
|
|
server=get_secret("MT5_DEMO_SERVER"),
|
|
)
|
|
write_tester_ini(tcfg, ini_path)
|
|
print(f"\nini written: {ini_path}")
|
|
print(f"--- contents ---")
|
|
print(ini_path.read_text(encoding="utf-8"))
|