fix: batch backtest ini generation and report collection

- Replace Inputs= with [TesterInputs] section in ini files so MT5
  cannot override set file parameters with cached/default values
- Fix build_ini to use caller-supplied report_name instead of
  recomputing a generic name, ensuring each run gets a unique ini
- Replace shutil.copy2 + delete loop with shutil.move for htm reports
- Add companion PNG move (name, -holding, -mfemae, -hst) to reports folder
- Fix Streamlit folder warning appearing in wrong conditional branch

Applies to both mt5_batch_backtest.py and view_batch_backtest.py
This commit is contained in:
unknown
2026-04-15 21:35:19 +10:00
parent 2044d181f3
commit a4a75eaaeb
3 changed files with 283 additions and 98 deletions
+9 -1
View File
@@ -41,6 +41,7 @@ def _parse_file(file_obj):
def _normalise(df: pd.DataFrame, label: str) -> pd.DataFrame:
df = df.copy() # ensure we never mutate the original
col_map = {}
def _f(targets, dest):
for c in targets:
@@ -516,11 +517,18 @@ def render():
if stem not in st.session_state.pm_files:
df = _parse_file(f)
if df is not None:
df = _normalise(df, stem)
df = _normalise(df.copy(), stem)
st.session_state.pm_files[stem] = df
st.success(f"✅ **{stem}** — {len(df):,} trades")
if st.session_state.pm_files:
# Clear all button
if st.button("🗑 Clear All Files", key="pm_clear_all"):
st.session_state.pm_files = {}
st.session_state.pm_custom_names = {}
st.session_state.pm_results = []
st.rerun()
to_remove = []
for label in list(st.session_state.pm_files):
c1, c2 = st.columns([6,1])