Warrior_EA/mql5/make_inis.py
AnimateDread f54c8a1fd6 fix(tools): make_inis points Warrior runs at the deployed Experts\Warrior build
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-23 21:15:00 -04:00

62 lines
3.1 KiB
Python

"""Write tester .ini files into the fleet terminal's data dir, every input pinned.
python mql5/make_inis.py warrior <tag> SYM [SYM ...] [key=value ...]
python mql5/make_inis.py dipz <tag> SYM [SYM ...] [key=value ...]
The tester INHERITS any input an .ini leaves out from the last run, so both
templates list every input the EA declares; key=value overrides one of them
(or a [Tester] key such as FromDate / Model).
"""
from __future__ import annotations
import sys
DATA = r"C:\Users\admin\AppData\Roaming\MetaQuotes\Terminal\10CE948A1DFC9A8C27E56E827008EBD4"
TESTER = dict(Period="H4", Model="1", FromDate="2022.01.01", ToDate="2026.09.01",
ForwardMode="0", ForwardDate="2026.09.01", Deposit="100000", Currency="USD",
Leverage="1:100", Optimization="0", Visual="0", ReplaceReport="1")
WARRIOR = dict(
Magic="20260911", EveryTick="false", ThresholdOpen="15", ThresholdClose="50", Direction="1",
FadeCrowd="0", MoneyMode="0", Risk="25", FixedLots="0.01", StopMode="3", TargetMode="0",
TrailMode="0", BreakevenAt="0", ManagementCut="0", MaxOpenRiskPct="0.75", KillSwitchDD="4.5",
FridayFlatMin="170", TradeLog="true",
**{w: "100" for w in ["W_MA", "W_RSI", "W_MACD", "W_CCI", "W_Stoch", "W_WPR", "W_RVI", "W_SAR",
"W_AO", "W_AC", "W_Ichimoku", "W_WyckoffEv", "W_WyckoffSt", "W_Neural",
"W_Regime", "W_DipBuy"]},
UseClassics="false", UseWyckoff="false", UseRegime="false", UseDipBuy="true", DipEntry="1",
DipZ="1.5", DipExitMA="20", DipTrendMA="0", DipMaxBars="10", DipVolGate="true",
DipVolPct="0.5", DipMetaCut="50", DipMetaRefit="500", UseNeural="false", NeuralCut="50",
UseDatabase="false", DB_RankingFeedsWeights="false", AtrPeriod="14")
DIPZ = dict(InpTF="16388", InpZPeriod="20", InpZEntry="-1.5", InpMaxBars="10", InpStopATR="3.0",
InpATRPeriod="14", InpRiskPct="0.25", InpVolGate="true", InpVolPct="0.5",
InpVolWindow="30", InpVolWarm="250", InpMaxOpenRiskPct="0.75", InpMaxDDPct="4.5",
InpFridayFlatMin="170", InpMagic="20260922", InpJournal="true", InpEquityLog="false")
EXPERT = {"warrior": r"Warrior\Warrior_EA", "dipz": r"Warrior\WarriorDipZ"}
if __name__ == "__main__":
kind, tag, rest = sys.argv[1], sys.argv[2], sys.argv[3:]
syms = [a for a in rest if "=" not in a]
over = dict(a.split("=", 1) for a in rest if "=" in a)
inputs = dict(WARRIOR if kind == "warrior" else DIPZ)
tester = dict(TESTER)
for k, v in over.items():
if k in tester:
tester[k] = v
elif k in inputs:
inputs[k] = v
else:
if k != "Expert":
sys.exit(f"unknown key {k}")
expert = over.pop("Expert", EXPERT[kind])
for sym in syms:
name = f"claude_{tag}_{sym}"
lines = ["[Tester]", f"Expert={expert}", f"Symbol={sym}"]
lines += [f"{k}={v}" for k, v in tester.items()]
lines += [f"Report={name}", "", "[TesterInputs]"]
lines += [f"{k}={v}" for k, v in inputs.items()]
with open(rf"{DATA}\{name}.ini", "w", encoding="ascii", newline="\n") as f:
f.write("\n".join(lines) + "\n")
print(name)