Warrior_EA/Variables/Variables.mqh
AnimateDread 444909d0a3 feat: S2 meta-labeling head - binary trade-quality model over the classic-candidate corpus
The NN now has a target that is not per-bar direction (closed, best-of-999
p=1.0000): P(win | this journaled candidate, at the EA's own SL/TP, net of
cost). One net for all 52 pattern-sides, AIType=AI_META.

- NetForward.mqh: the host-side softmax+CE gradient generalized total==3 ->
  2||3 on both backprop paths; a 2-class softmax IS a logistic head, and no
  compute backend changes.
- SignalMETA.mqh (new): corpus loaded read-only from the LARGEST signal DB on
  disk (decoupled from the config fingerprint that burned four S1 runs); the
  GMT->server offset is measured PER ROW against entryPrice vs bar open
  (DST-immune, histogram logged); a window-span regime filter drops the
  pre-2017 daily-backfill rows; 31-feature setup descriptor appended at the
  input (26 one-hot + side + tanh netVote + SL/TP ATR + spread/ATR).
- Training.mqh: candidate-queued pass 1, binary-target pass 2, per-candidate
  calibration (2.5) and OOS (3) walks. Counter mapping win->Buy / loss->Sell
  lets checkpoint selection, the edge floor, the plateau ladder and the
  family-wise deploy gate run UNCHANGED: precision reads as win rate among
  traded candidates, chance as the base win rate, recalls as sensitivity/
  specificity. Era-end META line: coverage x (p - break-even) vs the null.
- Labels are the side-conditional triple-barrier win caches - never the DB's
  stop-and-reverse outcome. Logit adjustment deliberately skipped (~40% base
  rate). Live inference + online learning guarded off until S3.
- Fingerprint: conditional |TGT:META1; State\META\ folder + 2-output filename
  slot keep meta models fully separate from direction models.

Compiles clean (0 errors, 0 warnings). S2 run = attach a chart with
AIType=AI_META; S3 wires the votes via the per-side hooks.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 06:52:31 -04:00

35 lines
2.8 KiB
MQL5

//+------------------------------------------------------------------+
//| Warrior_EA |
//| AnimateDread |
//| |
//+------------------------------------------------------------------+
string eaName = "Warrior_EA";
//--- Version of the pattern-journaling SEMANTICS: what a row in a <Filter>_Pattern_N_<Buy|Sell> table
//--- means, which bars produce one, and what the columns are. Folded (unconditionally) into the DB
//--- filename fingerprint (ComputeDbConfigFingerprint, Warrior_EA.mq5), so bumping it re-keys every
//--- database and stale rows can never feed UpdateSignalsWeights() again. BUMP THIS whenever a signal
//--- class's pattern definitions change meaning (Signals\Signal*.mqh - e.g. b2069bc's Ichimoku models,
//--- 8710240's Sanyaku state->event), or the journaling contract in CExpertSignalCustom::Direction()
//--- changes. The config fingerprint alone cannot see code changes - it hashes inputs, and 7 months of
//--- rows recorded under three different Pattern_N meanings shared one table because nothing re-keyed.
//--- v3: per-side journaling (each side's own ladder match writes its own row; net vote is a data
//--- column, not a drop filter) + the netVote schema column.
//--- v4: a reversing signal registers its own trade after closing the opposite one (true
//--- stop-and-reverse); v3 absorbed it as an exit, which one-sided the ledger for every pure event
//--- pattern (strict alternators like MACD model 3 put all rows on whichever side fired first).
//--- v5: the OpenLongParams/OpenShortParams gate is gone from the logger - order-placement failures
//--- (stops-level, ATR warm-up, entry-mode rejection) cluster in volatility/spread conditions and
//--- were non-randomly censoring those bars out of the log. The DB logs every matched ladder,
//--- unconditionally on the decision layer.
#define SIGNAL_DB_SEMANTICS_VERSION 5
string tableschema = "year INTEGER, month INTEGER, day INTEGER, dayOfWeek INTEGER, hour INTEGER, minutes INTEGER, pattern STRING, direction STRING, entryPrice DOUBLE, exitPrice DOUBLE, result STRING, netVote DOUBLE";
bool IsBacktesting = false;
//--- EnableSessionFilter/EnableNewsFilter/EnableRiskGuard are real inputs (Variables\Inputs.mqh),
//--- consistent with every other filter's on/off toggle. EnableITF and EnableMarketDepth are gone -
//--- both modules were removed 2026-08-01, see the removal notes in that file.
bool EnablePAI = (AIType == AI_MLP);
bool EnableCONV = (AIType == AI_CONV);
bool EnableLSTM = (AIType == AI_LSTM);
bool EnableHYBRID = (AIType == AI_HYBRID);
bool EnableMETA = (AIType == AI_META);
//+------------------------------------------------------------------+