TradeSurvival - generated data folder
=====================================

This folder is a placeholder in the source archive. At runtime the
generated artifacts are written to the terminal's COMMON files folder:

    <Terminal>\Common\Files\TradeSurvival\survival_dataset_<SYMBOL>_<PERIOD>.csv
    <Terminal>\Common\Files\TradeSurvival\survival_model_<SYMBOL>_<PERIOD>.mft

Artifacts are keyed by symbol and timeframe. This matters as soon as you
test more than one instrument: with a single fixed filename, training the
second symbol silently overwrites the first, and every later backtest runs
on the wrong coefficients without a warning.

The COMMON folder is used deliberately. Each Strategy Tester agent runs in
its own sandbox with its own MQL5\Files directory, so a manifest written by
a script into the local folder is invisible to the tester.

Create the folder once before the first run:

    <Terminal>\Common\Files\TradeSurvival\

Order of operations, PER INSTRUMENT
-----------------------------------
On a chart of the symbol and timeframe you intend to test:

1. SurvivalDatasetBuilder.mq5  -> survival_dataset_<SYMBOL>_<PERIOD>.csv
2. SurvivalModelTrainer.mq5    -> survival_model_<SYMBOL>_<PERIOD>.mft
   Set InpTrainShare explicitly - the script's own default (0.80) is not
   what this series' article reports; every run behind the published
   figures used InpTrainShare = 0.60.
3. TradeSurvivalExitEA.mq5     -> reads the manifest for its own symbol

Repeat 1 and 2 for every instrument. Then backtest the EA twice per symbol,
once with InpExitMode = EXIT_FIXED and once with EXIT_SURVIVAL, leaving
every other input untouched.

Cross-instrument comparisons
----------------------------
Leave InpUseRiskPercent = true. Volume is derived from OrderCalcProfit at
the current price, not from the symbol's raw SYMBOL_TRADE_TICK_VALUE - the
latter proved unreliable on at least one broker for a JPY-quoted pair,
silently rounding position size down to the broker's minimum lot and
under-risking every trade by roughly 40x. If a backtest's average win/loss
in money looks tiny relative to the stated risk percent, that symbol's
sizing is broken; check Journal output for the WARNING line this build
prints whenever the minimum lot size forces risk far above what was asked
for.

survival_model_*.mft format
---------------------------
Plain ANSI text, one KEY=VALUE per line. MEAN, SD, BETA1 and BETA2 are
comma-separated lists. The EA validates NUM_FEATURES, DESIGN_DIM and the
actual coefficient block lengths against its own compiled constants before
it will trade.

Known-good reference run
-------------------------
This pipeline was run end-to-end on EURUSD, GBPUSD, USDJPY and XAUUSD, all
M30, InpFrom=2023.01.01, InpTo=2025.06.30, InpTrainShare=0.60, Strategy
Tester range 2024.07.01-2025.06.30 on 1 Minute OHLC modelling. Holdout
log-loss improvement over the time-only baseline landed in a tight 20-22%
band on all four instruments, confirming the fit is not a single-symbol
fluke. See the published article for the full reproduction parameters and
results table.
