Warrior_EA/Expert/Training/AIBaseTrainingData.mqh
AnimateDread 8f2164698b feat(target): delete the barrier/geometry stack - the label is the verdict
Step 3 of the swing-pivot plan, whole-hog. The swing label is now the ONE
target and the era verdict is precision + recall per class against the
label's own base rate - no win rate, no break-even, no expectancy, no
geometry anywhere in training.

DELETED
- Expert/Excursion/ (4), Expert/BarrierHorizon/ (4), GeometrySweep,
  FirstPassageLadder, Labeling/TripleBarrier.mqh (CLabelOverlap survives
  in Labeling/LabelOverlap.mqh), 3 test EAs.
- TripleBarrierLabel + walk, fractal label, geometry derivation/scan/
  adoption, exit-policy replay, excursion MI targets, the drift verdict
  (DIRECTION_INTELLIGENT), the recall floor, balanced-accuracy telemetry,
  the barrier defines, the .cfg geometry adopt (slots kept as zeros for
  the positional layout), the derived-geometry live-order override.
- TRAINING_TARGET input/enum: direction models are always swing; META2
  re-keys the meta head onto label agreement (descriptor loses its two
  geometry slots).

REWORKED
- Labels.mqh (1795 -> ~370 lines): AdvanceSwingLabelState with
  FINALITY-GATED CACHING - an unresolved bar (pivot pair uncommitted) is
  never cached, so it can never freeze as a false Neutral; training,
  calibration, OOS scoring and online learning all skip unresolved bars.
- SDeployVerdict: significance-only; SOosTally chance = larger
  directional class share; pooled gate poolability = timeframe (record v2).
- Purge/embargo/declustering gaps: the measured mean label resolution
  lag (LabelResolutionBars), not a barrier horizon.
- Pool purge key + backfill DB rows: marked at the bar the label
  resolved on (m_labelResolveAge), not a fabricated barrier touch.
- Online learning frontier: finality, not a horizon delay.
- m_bestBalancedOos -> m_bestSelectionScore, m_erasSinceBestBalanced ->
  m_erasSinceBest, ensemble vote outcome arrays -> label arrays.

STEP 4 folded in: Entry_Multiplier / SL_Mode / TP_Mode / tradingdirection
are inputs again - trade management is the tester GA's search space.

Fingerprints: every direction model re-keys (TGT:SWG1 now unconditional,
CUT token gone); META1 -> META2. Full retrain, as planned.

Compile-verified in _claude_stage: Warrior_EA + both surviving test EAs,
0 errors, 0 warnings each.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-24 20:42:31 -04:00

56 lines
3 KiB
MQL5

//+------------------------------------------------------------------+
//| Warrior_EA |
//| AnimateDread |
//| |
//| Adapter: CExpertSignalAIBase seen as a CTrainingDataView. |
//+------------------------------------------------------------------+
#ifndef WARRIOR_TRAINING_AIBASETRAININGDATA_MQH
#define WARRIOR_TRAINING_AIBASETRAININGDATA_MQH
#include "ITrainingData.mqh"
class CExpertSignalAIBase;
//+------------------------------------------------------------------+
//| THE ONE PLACE THAT KNOWS BOTH SIDES. |
//| |
//| MQL5 will not let CExpertSignalAIBase implement CTrainingDataView |
//| directly - it already inherits CExpertSignalCustom, and a class |
//| gets one base. So the signal OWNS one of these instead, and hands |
//| it to any collaborator that needs to read training data. |
//| |
//| Every method here is a forward. That is the entire point: this is |
//| the only file that has to change when the signal renames a cache, |
//| and no collaborator has to change at all. It holds a borrowed |
//| pointer and never frees it - the signal outlives its own adapter |
//| by construction. |
//+------------------------------------------------------------------+
class CAIBaseTrainingData : public CTrainingDataView
{
private:
CExpertSignalAIBase *m_owner; // BORROWED - the signal owns this object, not the reverse
public:
CAIBaseTrainingData(void) : m_owner(NULL) { }
~CAIBaseTrainingData(void) { m_owner = NULL; }
void Bind(CExpertSignalAIBase *owner) { m_owner = owner; }
virtual int HistoryBars(void) override;
virtual int FeaturesPerBar(void) override;
virtual int LabelResolutionBars(void) override;
virtual int PurgeBars(void) override;
virtual int CalibrationHiIndex(const int totalIter, const int oosCutoff) override;
virtual bool HasLabel(const int bar) override;
virtual bool IsBuyLabel(const int bar) override;
virtual bool IsSellLabel(const int bar) override;
virtual bool RowFeatures(const int bar, const int width, double &x[]) override;
virtual bool DirectionalCall(const int bar, bool &isBuy, double &magnitude) override;
virtual string Id(void) override;
virtual bool IsEnsembleMember(void) override;
virtual int EnsembleIndex(void) override;
virtual bool GateReference(double &precPct, int &calls, double &chancePct) override;
virtual double EffectiveSampleSize(const double rawN) override;
virtual bool Stopping(void) override;
};
#endif // WARRIOR_TRAINING_AIBASETRAININGDATA_MQH
//+------------------------------------------------------------------+