Raise MIN_ACTIVATION_DERIVATIVE from 1e-4 to 1e-3 in both Network.cl and Network.mqh
to strengthen the escape signal through saturated hidden neurons. This provides a 10x
stronger safety net against fp32 OpenCL-specific saturation, complementing the earlier
output-layer fix (logit activation instead of sigmoid) that resolved the primary neutral
collapse bug.
Add MathSrand(GetTickCount()) before BuildFreshTopology() in ExpertSignalAIBase.mqh
to guarantee genuinely random weight initialization after genetic tuner evaluations,
matching the final-retrain path and Warrior_EA.mq5's OnInit. This prevents the previous
deterministic RNG state from dominating weight init.
Also remove UTF‑8 BOM from ExpertSignalAIBase.mqh and Network.mqh for cleaner encoding.
Restructured the German market description with clearer headings, an updated feature list (including structural stops and full journal), new sections for universal applicability and signals, and improved overall readability.
Add freeze-level checks, no-change modification skipping, entry price routing, and per-tick/memory budget monitoring. Override trade actions (Open, Close, Reverse, TrailingStop, TrailingOrder) to validate at the final gate before sending orders.
Introduce a custom OnTester() function to score backtest results
for genetic optimization, targeting smooth linear equity curves.
The score combines profit factor, recovery factor, Sharpe ratio,
and trade density, with a drawdown penalty.
Fixes a bug in the drawdown penalty where the percent value was
not converted to decimal before scaling, causing a near-zero
penalty. Also adjusts brace indentation for consistency.
- Append '(classic)' to RSI period 14, indicator period 14, risk-reward 1:2, and risk percent 1 preset comments
- Change Min_Vote_Close default from VOTE_CLOSE_80 to VOTE_CLOSE_DISABLED
Add MACD_FAST, MACD_SLOW, MACD_SIGNAL presets and Ichimoku Tenkan, Kijun, Senkou presets to InputEnums.mqh. All combinations are designed to satisfy the respective indicator's validation rules (fast < slow for MACD, Tenkan < Kijun < Senkou B for Ichimoku), eliminating init errors and allowing the auto-tuner to perturb settings independently.
Introduce VOTE_CLOSE_PRESETS enum with a Disabled option (value 101) that bypasses vote-driven position closing via arithmetic thresholding, removing the need for a separate boolean flag. This ensures positions exit only via stop-loss, take-profit, or trailing when disabled.
Removes standalone AI confidence parameters (MinAIConfidence, MinAIExitConfidence) and replaces them with unified Min_Vote_Open and Min_Vote_Close thresholds that apply to both AI and classic engines. Updates all code comments, report suggestions, and market descriptions accordingly, simplifying configuration and ensuring consistent vote requirements across entry and exit logic.
Add BeginVote/RevokeVote lifecycle hooks to ExpertSignalCustom and ExpertSignalAIBase.
Snapshot m_lastNonNeutralSignal before condition evaluation in Direction(), and restore
the snapshot if the vote is later discarded (e.g., Hybrid quorum shortfall).
Previously, a discarded vote still consumed the alternation gate, which could
permanently gate out valid signals until the opposite direction appeared.
:106 — window key changed from the 0-59 sec field to a full datetime. Fixing #1 alone would have replaced "always 0" with "cumulative average of every bar since startup", since the window still never rolled over.
:746 — restored result /= number. number was being counted and then never used, leaving a raw sum where the base class averages. MA's 60 + RSI's 100 = 160 tripped the ±100 range check and got zeroed — it discarded precisely the strongest agreed setups.
BlendWeightsFrom now uses CObject::Type() to correctly identify neuron classes, avoiding undefined behavior when neurons are from the plain-CPU hierarchy (CNeuron, CNeuronConv, CNeuronPool, CNeuronLSTM). Weight blending for those legacy classes is also implemented.
- Arrow deletion now scoped to rescan window (barsNow) instead of all arrows, preventing loss of multi-year arrow history on Show Signals click.
- Removed temporary throughput diagnostic counters and logging added to investigate performance regression; issue resolved.
The commit adds three counters (`m_rescanRawBuy`, `m_rescanRawSell`, `m_rescanRawNeutral`) that accumulate the raw argmax signal before the prior-correction step in `AdvanceChartSignalRescan`. This distinguishes a model that outputs mostly Neutral from one where adjusted signals suppress non-Neutral arrows. The rescan completion log now reports both the pre-decluttering tallies and the time. Additionally, `TRAIN_TIME_BUDGET_MS` is increased from 120 to 200 ms to improve throughput (as noted in the comment), balancing UI responsiveness and training speed.
The old RescanChartSignals ran the entire per-bar inference loop synchronously,
blocking the button-click handler for a potentially long duration on large lookbacks.
Replaced with StartChartSignalRescan (cheap setup) and AdvanceChartSignalRescan
(time-boxed slices) so the heavy work is drained from PollTraining's timer without
freezing the UI.
Introduce `RescanChartSignals()` method and `SIGNAL_RESCAN_LOOKBACK_BARS` define to allow operators to replace stale historical arrows (e.g., from years-old training runs) with fresh inferences from the currently deployed weights on recent bars. This prevents outdated signals from lingering on the chart and ensures the displayed set matches what a live re-render would produce.
PersistWeightsOnShutdown now returns early when m_inferenceOnly is true,
preventing the tester cache from being overwritten with untrained state.
InitNeuralNetwork compares modification timestamps of the production model
(FILE_COMMON) and the agent-local cache, re-seeding when the production
copy is newer. This ensures backtests always run the latest deployed
weights even when the cache file persists across runs. Also moved
LoadChartSignals() call to after the config fingerprint is appended,
so that persisted arrows are correctly keyed per configuration.
Add FILE_SHARE_READ and FILE_SHARE_WRITE to all FileOpen calls in CNet::Load,
CNet::LoadCheckpoint, and in ExpertSignalAIBase (LoadModelStats, LoadChartSignals)
so that reading model files does not fail with error 5004 when another process
(e.g., a live chart) holds the file. Replace FileCopy with the new CopySharedFile
function for sidecar files (.cfg, .stats, _shadow.nnw) to perform share-aware
copying, preventing the same failure during tester seeding. This ensures the EA
can read and copy model artifacts even while a deployed instance is running.
Replace fixed short-delay retries in CopyFileWithRetry and LoadNetWithRetry with exponential backoff (8 attempts, cap at 2s) to reliably handle transient file locks from AV/EDR or concurrent saves.
Change autosave trigger from a fixed 300-second wall-clock timer to firing on new bar close, reducing unnecessary overwrites and narrowing the collision window with backtest FileCopy operations.
Add retry logic (CopyFileWithRetry, LoadNetWithRetry) to the tester's seeding path in ExpertSignalAIBase.mqh, and print diagnostic error messages in CNet::Load (Network.mqh) when FileOpen fails. This addresses silent failures caused by transient Windows sharing violations that occur when a live chart's atomic Save() overlaps with a Strategy Tester agent's FileCopy or FileOpen on the same production file. The new helpers retry the operation a few times with a short pause instead of silently falling back to an untrained model.
The previous TP calculation used ATR from entry, decoupled from the swing-anchored SL distance. This caused the Min_Risk_Reward_Ratio rejection filter to always fail because reward < 2*risk with default settings, preventing any trades. Now TP is a multiple of the actual trade risk (entry-to-stop distance), restoring coupling and ensuring the default RR filter is satisfiable. Also enforce minimum SL distance before TP calculation to maintain correct risk-ratio.
The Market build has no DLL tier (WarriorCPU.dll is compiled out per MQL5 Market rules), so the TargetCPULoad input would have sat unused in the Inputs tab. Now it is conditionally compiled as a const when WARRIOR_MARKET_BUILD is defined, keeping the call site intact while avoiding a dead input.
The Market_Description.html was rewritten to better explain the EA's neural network, its self-training on unseen data, and the dual classic/AI signal paths, along with installation details and screenshots.
The queue duplicates minority bars up to repCount (~21x at 30.7:1 imbalance), causing IS accuracy to be scored over an ~58%-directional set while OOS counts the real ~6% distribution. This made the IS/OOS gap misleading (e.g. 77% vs 12%), appearing as catastrophic overfitting when OOS was actually stronger (1.97x vs 1.33x lift). By marking only the first occurrence per bar with `m_isTrainQueuePrimary` and using that flag in the counter, both metrics now measure the same natural class distribution, making the gap directly interpretable as generalization. Backprop and training remain unaffected—every occurrence still trains as before.
Extract shared persistence logic into PersistDeployedModel() to guarantee consistency across all deploy paths (ladder, era-cap, stop, and manual). Add DeployNow() to let the panel button finalize the current best checkpoint as the live model, and RetrainDeployed() to revert deployment and resume training from the deployed weights without starting from scratch. This enables operator-controlled deployment while preserving online continual learning.
Implement a plateau detection mechanism that escalates through warm restart, gamma annealing, and eventual deployment when balanced accuracy stagnates for `PLATEAU_PATIENCE_ERAS`. Also add a compatibility shim for the removed `MinWR` input to preserve model filenames and `.cfg` layout.
A single EA run instantiates several CNet objects (main net, EMA shadow, OOS clones, etc.). Each previously ran its own OpenCL/DirectML probe, printing redundant error banners (e.g., "OpenCL not found") and compute tier messages.
Added process-wide static flags `s_openclUnavailable` and `s_computeTierLogged` to skip subsequent probes and log once per process. This eliminates log clutter and avoids unnecessary probe overhead on hosts without OpenCL.
Rename the original `CreateElement` with a defaulted `weighScale` parameter to `CreateElementScaled` and provide a proper virtual override that matches the base `CArrayObj::CreateElement` signature exactly. This ensures `CArrayObj::Load()` dispatches correctly, fixing a bug where every saved model load failed at the first layer. Update all call sites in `CNeuronBase::Init` and `CNeuronPool::Init`. Additionally, enhance error diagnostics in `CNet::Load` to distinguish between file truncation and code faults (such as the signature mismatch).
The `Load` method now accepts an optional `quiet` flag that suppresses diagnostic
`Print` statements when set to `true`. This is used by callers that anticipate
a load failure and handle it gracefully — for example, the EMA shadow-net
bootstrap on a CPU-DLL box, which cannot hold a second full network. The main
model load keeps `quiet=false` so actual failures remain visible.
- In Network.mqh: Add upfront file size check to distinguish truncated files from backend allocation failures during model load, improving error diagnosis.
- In ExpertSignalAIBase.mqh: Remove redundant shadow net save on shutdown to avoid doubling shutdown cost and exceeding MT5's deinit budget, preventing abnormal termination and subsequent retrain.
- In Warrior_EA.mq5: Reduce training timer interval from 5s to 250ms to allow more frequent training cycles instead of sitting idle ~98% of the time.
The previous save directly wrote to the target file, which could leave a truncated/partial file if the process was force-killed (e.g., MT5 deinit timeout). Now the save writes to a temporary file (.savetmp) and only renames it over the real file after a successful write. This ensures that an interrupted save never corrupts the last good model. Additionally, improved diagnostics in CNet::Load to distinguish corrupt/incompatible files from compute errors.
Updated comments across ExpertSignalAIBase.mqh to explicitly state that the
compounded accuracy metric is a directional win-rate (Buy/Sell predictions only)
and that neutral/no-trade calls are excluded to avoid inflating the rate (since
neutral is the ~94% majority). The cumulative counters now only increment when
the prediction is directional, ensuring the panel reflects genuine trade quality
rather than overall label accuracy.
Replace the display-only MIN_FIRED_FOR_HITRATE with persistent cumulative accuracy counters (m_cumIsCorrect, m_cumIsTotal, m_cumOosCorrect, m_cumOosTotal) that survive era-to-era and restart via .stats. New ComputeCompoundedAccuracyLine() builds the panel line from these counts, providing a stable "accuracy over all validated signals so far" metric.
Split `PersistOnShutdown` into `PersistWeightsOnShutdown` (heavy weights save) and `ShutdownChartCleanup` (save arrows + purge chart). In `OnDeinit`, run panel destruction and per‑signal chart cleanup **before** the weight persistence, preventing leftover chart objects when the weight save stalls or faults past MT5's deinit budget.
Add MIN_FIRED_FOR_HITRATE constant (10) to the simple panel and training status hit-rate display. Update ScheduleTrainingIfNeeded and UpdateTrainingStatusLabel to only show a percentage when a side has at least MIN_FIRED_FOR_HITRATE live-fired calls; otherwise show "n/a" or "measuring". This prevents misleading early "0%" or "measuring" output from a single sample, while keeping full detail in logs and verbose panel.
- ResetWeights now passes `false` (not `m_isInitialized`) to SaveTopologyConfiguration so the config fingerprint matches the fresh-init write (always false). Prevents spurious "Configuration mismatch" that would discard the just-reset weights.
- UpdateTrainingStatusLabel: collapse hit-rate display to "measuring..." when neither side has fired yet; once at least one side fired, show both with "n/a" for missing side.
Add CaptureWeights and RestoreWeights methods that snapshot every neuron's weights into host arrays (CArrayDouble per neuron) and restore them in-place via setWeights. This replaces the file-based SaveCheckpoint/LoadCheckpoint for the mid-run best-era rollback, because the file path re-creates neurons (CLayer+Init) which fails on the multithreaded CPU-DLL backend (CDirectMLMy/WarriorCPU.dll) that cannot allocate a second full set of neuron tensors while the live set exists. In-memory weight copy uses only getWeights/setWeights, already proven by the per-era shadow blend. Snapshots weights only (not Adam moments); the regression handler decays eta on restore and clips per-step deltas to prevent stale-moment overshoot. Snapshot is valid only within a single Train() run. Also adds HaveWeightSnapshot() query and the m_weightSnapshot / m_haveWeightSnapshot member variables.
SaveCheckpoint and LoadCheckpoint in Network.mqh now accept a `bool common` flag. When true, the ephemeral checkpoint is stored in FILE_COMMON (co-located with the model's .nnw/.cfg/.stats/_shadow.nnw), preventing a parallel folder tree under the terminal-local Files directory. ExpertSignalAIBase.mqh is updated to pass the same flag to file existence checks and deletions, ensuring all sidecar files use the correct location.
Previously, LoadCheckpoint cleared the live layers before reading, so any read failure (truncated/corrupt file, OCL init hiccup) left the network with zero layers. This collapsed predictions to neutral, caused Save to refuse writing 0-layer stubs, and wiped chart arrows. Now the checkpoint is loaded into a temporary layer set that is swapped in only on full success; on failure the current weights are preserved and a diagnostic message is printed.
In CNet::Load and CNet::LoadCheckpoint, when a CLayer object is allocated but subsequent Load() or layers.Add() fails, the layer was not freed, causing a memory leak (reported as "1 object of class 'CLayer'" on MT5 unload). Added a check for invalid pointer and explicit deletion of the layer before breaking from the loop, ensuring proper cleanup.
A failed load of a corrupt/empty network could leave trainingComplete=true, causing the freshly built topology to be treated as already converged. This forced the model to never train, run inference on random weights, and delete all chart arrows. The fix ensures the state is reset to a genuine fresh start so BuildFreshTopology() actually gets trained.
- Guard CNet::Save to refuse writing a 0-layer network (prevents overwriting ~18MB model with empty stub)
- In CNet::Load and LoadCheckpoint, treat 0-layer files as load failure (older stubs still on disk)
- Introduce LOGIT_PRIOR_STRENGTH_PRESETS enum (0–100%) to control logit adjustment tau
- Prepare member variables and AdjustedSignalFromSoftmax for prior-corrected posterior at inference
- Ensure raw argmax scoring for recall/convergence remains unchanged; correction only affects live signal