Commit graph Warrior_EA/System
Author SHA1 Message Date
AnimateDread
41d6a63d92 fix: make sidecar writes atomic; extract shared AtomicFile helper
FileOpen(FILE_WRITE) truncates its target on open. CNet::Save already staged
the .nnw through a temp file + rename for that reason, but the three sidecars
written beside it did not:

  .stats  ExpertSignalAIBase.mqh:5918
  .arrows ExpertSignalAIBase.mqh:6224
  .cfg    ExpertSignalAIBase.mqh:7329

Two defects followed.

1. An interrupted write published a truncated sidecar. For .cfg that is the
   worst case: LoadAndCompareTopologyConfiguration() reads a short file as a
   mismatch, which discards the trained model and restarts from era 0.

2. Windows file sharing is a mutual contract - a writer opened with no
   FILE_SHARE_* blocks every concurrent open regardless of the reader's flags.
   All three read paths carry FILE_SHARE_READ|FILE_SHARE_WRITE specifically so
   a tester agent can read them while a live chart runs; an exclusive writer on
   the same path defeated that.

Extracted CNet::Save's proven pattern into System\AtomicFile.mqh
(AtomicWriteBegin/AtomicWriteEnd) and routed all four writers through it. This
also encodes the FileMove gotcha once instead of per call site: the destination
location comes from FILE_COMMON inside the 4th arg, NOT inherited from the
source, and getting it wrong moves the file to the wrong sandbox silently.

Also fixed while in these functions:

- SaveTopologyConfiguration had 13 copy-pasted 6-line error blocks that each
  returned WITHOUT FileClose(handle), leaking the handle on every write
  failure. Collapsed to one ok-chain that closes exactly once. The on-disk
  field order and types are unchanged (asserted during the rewrite) so existing
  .cfg files still load.

- SaveChartSignals documented that pruning runs only after a successful write
  ("a failed write above leaves both the file AND the chart untouched") but
  never checked any write result, so a partial write still deleted the chart
  objects. Results are checked now, making the existing comment true.

Compiles 0 errors, 0 warnings.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-29 00:31:29 -04:00
AnimateDread
3a37b9115e fix: correct inference-only new-bar detection and add stop validation
In inference-only backtests, dtStudied could be ahead of the test range, causing new-bar detection to freeze. Replaced with m_lastBarTime to keep detection aligned with runtime history. Added diagnostic logging when a non-neutral softmax output is neutralized by prior correction. Also added validation for order_price, sl, and tp in stop-checking functions to catch non-finite or negative values.
2026-07-27 11:51:45 -04:00
a228d1bde7 feat(trade): implement trade safety checks per Article 2555 and resource limits
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.
2026-07-26 23:08:32 -04:00
AnimateDread
5247c34fe9 fix: add error logging for buffer failures and reject trades on invalid stop loss 2026-07-26 12:12:14 -04:00
AnimateDread
d0e89a6fc7 fix(SignalNewsFilter): scope calendar veto to the traded symbol's own currencies
CalendarValueHistory() was called with no country filter at all, so
ANY country's economic calendar event vetoed a trade regardless of
relevance - a JPY release blocked a EURUSD trade just as readily as a
USD one, making NF_MinImpact's fine-tuning far noisier than intended.

Adds System/NewsRelevance.mqh (GetRelevantCountryCodes/
ImpactWeightedProximity), a shared utility that cross-references
CalendarCountries() against the symbol's base/quote currency to get
the actually-relevant ISO country codes, then uses
CalendarValueHistory()'s country_code-filtering overload. Shared so
the upcoming NN news-input feature reuses the same relevance logic
rather than duplicating it.

Compiled clean (MetaEditor, 0 errors/0 warnings).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-18 17:22:33 -04:00
AnimateDread
ef95e19d1d fix: correct metric label in training output and improve status panel comments 2026-07-17 21:53:09 -04:00
AnimateDread
fe4c93cf71 refactor: simplify on-chart status text and remove verbose metrics
The training status panel was too tall and wordy, displaying detailed recall, precision, and continual-learning OOS simulation metrics that are not needed for at-a-glance monitoring. These metrics are still tracked internally for convergence gating, but removed from the on-chart display to keep the panel compact. Also shortened label names (e.g., "[IS] Accuracy" -> "IS Acc") to save space without reducing clarity.
2026-07-17 21:49:30 -04:00
AnimateDread
6f3daf23a3 fix(System/StatusLabel): correct type mismatches in TextGetSize usage
TextGetSize returns uint values, so dummyW, dummyH, textW, and textH
changed to uint. Added explicit casts to int where used in comparisons
or arithmetic to prevent signed/unsigned mismatch warnings.
2026-07-17 21:37:52 -04:00
AnimateDread
a2ed4e3682 fix: word-wrap status labels via TextGetSize() to fix clipping and background overflow
Replace the static per-character width approximation with dynamic word-wrapping using
`TextGetSize()` to measure actual rendered pixel widths. This prevents status label text
from being clipped at the chart edge while its oversized background rectangle extended
beyond. Each line is now greedily wrapped to fit within the chart pane minus margins,
ensuring the measured string matches what is drawn. Also extracts font constant and adds
`WrapLineInto()` helper for reuse.
2026-07-17 21:36:44 -04:00
AnimateDread
bb9edfc119 fix(status-label): handle multi-line status text with per-line labels
OBJ_LABEL does not render embedded '\n' as line breaks, causing multi-line status text to appear as one truncated line. This commit splits the input text by newlines, creates a separate OBJ_LABEL and tightly-fit OBJ_RECTANGLE_LABEL background for each line, ensuring every line remains legible regardless of chart background.
2026-07-17 21:32:55 -04:00
AnimateDread
2c0cdf5e2b refactor(ai): replace Comment() with StatusLabel for training status display
Migrate all per-era classification counts, OOS confusion metrics, and training progress output from the legacy Comment() function to a dedicated StatusLabel object. This provides cleaner UI integration and avoids blocking the chart's normal info line during prolonged training cycles. A new include for StatusLabel.mqh has been added, and all related documentation comments updated accordingly.
2026-07-17 21:28:59 -04:00
AnimateDread
8157c42314 feat: Enhance README and documentation for Warrior_EA project
- Updated README.md with project overview, key features, directory structure, getting started guide, and modernization roadmap.
- Added AI_NETWORK.md detailing the neural network and AI/ML infrastructure, including architecture, components, usage patterns, and next steps.
- Introduced DATABASE.md for the Database module, outlining key components, design highlights, usage patterns, and future enhancements.
- Created README.md files for Enumerations, Expert, Money, Signals, Structures, System, Trailing, Variables directories, detailing their purpose, key components, and integration notes.
- Documented the Signals subsystem, emphasizing modularity, extensibility, and AI/ML readiness.
- Added comprehensive descriptions for individual signal modules in Signals/ directory.
- Established clear integration notes and recommendations for future improvements across all modules.
2026-04-20 19:28:34 -04:00
super.admin
0a527b0cf9 convert 2025-05-30 16:35:54 +02:00