Files
mql-trading-bots/scripts/sync-ea-inputs.sh
T
garfield 6d0c0716fa Add sync-ea-inputs: durable fix for the chart-cache persistence bug
Root cause: MT5 actually reads live EA inputs from
MQL5/Profiles/Charts/Default/chartNN.chr at boot, not from the .set
presets -- and it never rewrites that file on container shutdown
(files were found frozen at their Aug 6 mtimes through every restart
since, including graceful ones with stop_grace_period). This is why
the XAUUSD spread-filter fix (Jul 30) and the Monday A/B reversion
(Aug 10) both kept reverting after restarts.

sync-ea-inputs.sh (+ .py) runs on every container boot via
custom-cont-init.d, before MT5 launches, and writes each chart's
matching bo-*.set values directly into its .chr cache -- bypassing
MT5's broken save-on-exit path entirely. Validated with a real
corrupt-then-restart-then-verify cycle (see vault note).

Deployed copy lives at ~/mt5-docker/custom-cont-init.d/ (mt5-docker
is not a git repo); this is the tracked source, kept in sync with the
deployed version by hand like the other scripts here (e.g.
export-history.sh).
2026-08-11 01:09:34 -04:00

10 lines
559 B
Bash
Executable File

#!/bin/bash
# Thin wrapper: the linuxserver.io custom-cont-init.d runner invokes every
# executable file directly in this directory via `sh`, ignoring shebangs,
# so a plain .py file placed here fails outright when picked up on its
# own. The real logic lives in lib/ (a subdirectory, which the runner
# does not recurse into) and is invoked explicitly via python3 here.
# Runs on every container start (before MT5 itself, per the s6 cont-init
# ordering) -- see lib/sync-ea-inputs.py for what it does and why.
python3 "$(dirname "$0")/lib/sync-ea-inputs.py"