Files

35 lines
1.3 KiB
Python
Raw Permalink Normal View History

"""Check what input parameters MT5 actually used in the report."""
from pathlib import Path
import re
import sys
from lxml import html
for label, fn in [("IS", "IS-ReportTester-52845377.html"), ("OOS", "OOS-ReportTester-52845377.html")]:
p = Path("reports") / fn
raw = p.read_bytes()
text = raw.decode("utf-16") if raw[:2] in (b"\xff\xfe", b"\xfe\xff") else raw.decode("utf-8", errors="replace")
tree = html.fromstring(text)
print(f"=== {label} report: Inputs section ===")
full_text = tree.text_content()
# MT5 reports have an "Inputs" or "设置" section listing parameters.
for marker in ("Inputs", "设置", "参数", "Input parameters"):
idx = full_text.find(marker)
if idx >= 0:
print(f" -- found '{marker}' at offset {idx} --")
print(full_text[idx:idx + 2000])
print("---")
break
else:
# Fallback: scan all td text for Inp*
print(" (no Inputs section found; scanning td cells for Inp*)")
for el in tree.iter("td"):
txt = (el.text_content() or "").strip()
if txt.startswith("Inp"):
# Get next sibling td
nxt = el.getnext()
if nxt is not None:
print(f" {txt} = {nxt.text_content().strip()}")
print()