-`NoConstraintsMode` — disable all gating and caps for maximum data collection (bypasses trading hours, selector gating, insights gating, exploration caps, and open-position limit). Default: `true`.
-`UsePolicyGating` — enable/disable ML policy gating
-`DefaultPolicyFallback` — allow neutral trading when slice/policy missing
-`FallbackDemoOnly` — restrict fallback to demo only (default true)
-`FallbackWhenNoPolicy` — allow fallback when no policy file is loaded (default true)
-`ExploreMaxPerSlice` — weekly cap (default 3; `0` = unlimited)
-`ExploreMaxPerSlicePerDay` — daily cap (default 2; `0` = unlimited)
-`MaxOpenPositions` — global open-position limit (default `0`; `0` = unlimited)
- The EA checks this in both `OnTimer()` and `OnTick()` (`CheckPolicyReload()`); when present, it reloads `policy.json`, logs `Policy reload signal detected: reloaded|failed`, and on success logs `Policy gating: min_conf=..., slices=N`.
- Loaded state: "loaded" iff one or more slices exist (slices > 0)
2026-02-05 01:22:42 -05:00
- Tracked via `ArraySize(g_pol_strat) > 0` in `PaperEA/PaperEA_v2.mq5`
- Run `ML/run_train_and_export.bat` (writes `policy.json`, touches `policy.reload`)
## Safety Notes
- Fallback trades are neutral and do not consume exploration quotas
- File I/O uses `FILE_COMMON`; ensure your MT5 has write permissions to the Common Files directory
- Some readers use `FILE_ANSI` and plain text parsing — avoid altering CSV delimiters/headers
2025-09-10 13:27:03 -04:00
## Artifact Rotation & Compression
- All major artifacts (features.csv, insights.json, scaler.pkl, tf_model.keras, features.json) are automatically rotated if they exceed operational size limits.
- **features.csv** (MQL5): If file exceeds 100MB, it is renamed with a timestamped `.bak` suffix before new data is written. No compression (MQL5 limitation).
- **ML artifacts** (Python):
-`tf_model.keras`: Rotated if above 100MB (no compression).
-`scaler.pkl`, `features.json`: Rotated and compressed with gzip if above 20MB.
- Old files are preserved with a timestamped `.bak` (and `.gz` for compressed).
- Rotation occurs before each new write session.
## Trade Execution Retry Policy
- All trade executions (market, stop, limit) are guarded with a retry loop for transient broker errors (requote, busy, timeout, etc.).
- Up to 3 attempts are made, with a short sleep between retries.
- Each failure and retry is logged with error code, attempt number, and time.
- Non-retryable errors abort further attempts immediately.
## Insights Rebuild Timeout
- The InsightsRebuild script now accepts a `TimeoutMs` input (default: 60,000 ms).
- The feature scan is chunked and logs progress every 1000 rows, with a brief sleep to avoid watchdog timeouts.
- If the timeout is exceeded, the rebuild aborts and logs the row/time boundary.