//+------------------------------------------------------------------+ //| 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 //+------------------------------------------------------------------+