Warrior_EA/Expert/Persistence/AIBasePersistenceView.mqh
AnimateDread d9092a2408 fix(vote): persist the member's skill verdict - a converged model was ruled no-skill on every restart
SP500 resumed converged at era 136 with its tier ladder correctly restored and still
swept 4999 bars reporting "0 had a snapshot, drew 0 arrow(s)" while the other five
charts drew 221-312.

HasDemonstratedEdge() - added with the no-skill exclusion - compares m_eraStatPrecPct
against m_eraStatChancePct. Both are written once per era by EnsembleStashEraStats. A
converged model runs no eras, so after a restart both sat at their -1 ctor defaults,
every member was ruled no-skill, ReconstructionWeight() returned 0 for all four, and
the overlay divisor was zero on every bar. Exactly the failure the WST7 ladder
persistence fixed one level down: the ladder says how much a member votes, this says
whether it may.

RankTiersFromOos already computes the pair (pooled holdout precision and the
zero-skill reference rate) and now records it as the CERTIFIED edge. That path is
reached by the era end AND by the deployed replay, which is the only measurement a
converged model will ever make. Persisted as WST8; HasDemonstratedEdge() prefers the
era pair and falls back to it.

The census line also had to be fixed: it reported "NOT ONE of those bars had a single
member snapshot ... no enrolled member has published m_overlaySigSnap" for a condition
that was purely a skill verdict. The snapshots were there. It now counts the two causes
separately and names the one that fired.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-26 16:53:16 -04:00

94 lines
5 KiB
MQL5

//+------------------------------------------------------------------+
//| Warrior_EA |
//| AnimateDread |
//| |
//| CAIBasePersistenceView - declarations only, bodies in |
//| AIBasePersistenceViewImpl.mqh (needs the full signal declared). |
//| Same shape as Chart\AIBaseChartView.mqh. |
//+------------------------------------------------------------------+
#ifndef WARRIOR_PERSISTENCE_AIBASEPERSISTENCEVIEW_MQH
#define WARRIOR_PERSISTENCE_AIBASEPERSISTENCEVIEW_MQH
#include "IPersistenceView.mqh"
class CExpertSignalAIBase;
class CAIBasePersistenceView : public CPersistenceView
{
private:
CExpertSignalAIBase *m_owner;
public:
CAIBasePersistenceView(void) : m_owner(NULL) { }
void Bind(CExpertSignalAIBase *owner) { m_owner = owner; }
virtual string Id(void) override;
virtual string FileName(void) override;
virtual int NeuronsCount(void) override;
virtual long CumIsCorrect(void) override;
virtual long CumIsTotal(void) override;
virtual long CumOosCorrect(void) override;
virtual long CumOosTotal(void) override;
virtual bool NetLoaded(void) override;
virtual bool UsesConvStage(void) override;
virtual uint NetFirstConvWindow(void) override;
virtual int ConvReceptiveFieldBars(void) override;
virtual ENUM_ACTIVATION OutputLayerActivation(void) override;
virtual bool NetEnforceOutputActivation(const ENUM_ACTIVATION intended, ENUM_ACTIVATION &stale) override;
virtual void SetTopologySuperseded(const bool v) override;
virtual double PriorBuy(void) override;
virtual void SetPriorBuy(const double v) override;
virtual double PriorSell(void) override;
virtual void SetPriorSell(const double v) override;
virtual double PriorNeutral(void) override;
virtual void SetPriorNeutral(const double v) override;
virtual double ConfidenceCalScale(void) override;
virtual void SetConfidenceCalScale(const double v) override;
virtual bool MqlInferenceValidated(void) override;
virtual void SetMqlInferenceValidated(const bool v) override;
virtual datetime OnlineLearnedUpToTime(void) override;
virtual void SetOnlineLearnedUpToTime(const datetime v) override;
virtual double OnlineRollingAcc(void) override;
virtual void SetOnlineRollingAcc(const double v) override;
virtual long OnlineSamples(void) override;
virtual void SetOnlineSamples(const long v) override;
virtual int LastBuyFiredPrecPct(void) override;
virtual void SetLastBuyFiredPrecPct(const int v) override;
virtual int LastSellFiredPrecPct(void) override;
virtual void SetLastSellFiredPrecPct(const int v) override;
virtual int LastBuyRecallPct(void) override;
virtual void SetLastBuyRecallPct(const int v) override;
virtual int LastSellRecallPct(void) override;
virtual void SetLastSellRecallPct(const int v) override;
virtual int LastBuyFired(void) override;
virtual void SetLastBuyFired(const int v) override;
virtual int LastSellFired(void) override;
virtual void SetLastSellFired(const int v) override;
virtual void SetCumIsCorrect(const long v) override;
virtual void SetCumIsTotal(const long v) override;
virtual void SetCumOosCorrect(const long v) override;
virtual void SetCumOosTotal(const long v) override;
virtual int TierWeight(const int tier) override;
virtual void SetTierWeight(const int tier, const int v) override;
virtual double ModuleTrustWeight(void) override;
virtual void SetModuleTrustWeight(const double v) override;
virtual bool TiersSelfRanked(void) override;
virtual void SetTiersSelfRanked(const bool v) override;
virtual double CertifiedPrecPct(void) override;
virtual double CertifiedChancePct(void) override;
virtual void SetCertifiedEdge(const double precPct, const double chancePct) override;
virtual bool RunCpuInferenceSelfCheck(double &maxDiff) override;
virtual void SetDirConfThreshold(const double v) override;
virtual double BestDirConfThreshold(void) override;
virtual void SetBestDirConfThreshold(const double v) override;
virtual string CrossAssetPairsPinned(void) override;
virtual void SetCrossAssetPairsPinned(const string v) override;
virtual void SetCrossAssetCfgSaved(const bool v) override;
virtual string AltDataNamesPinned(void) override;
virtual void SetAltDataNamesPinned(const string v) override;
virtual void ApplyAltDataPinnedNames(const string v) override;
virtual bool LoadNetOnce(double &indicatorParams[]) override;
};
#endif // WARRIOR_PERSISTENCE_AIBASEPERSISTENCEVIEW_MQH
//+------------------------------------------------------------------+