forked from MrBaro75/Warrior_EA
The declustering the charts needed already existed - NmsLiveAccept, per-direction run-collapse plus cross-direction resolution plus strict alternation - and it was already set to 10 bars. It could not be TUNED: SignalClusterWindow was a compile- time const, so finding the right value needed a rebuild. That is the actual gap. Now three inputs, as enum dropdowns: Signal_CooldownScope per-direction, or a hard any-direction gate on top Signal_CooldownBars SCB_OFF..SCB_50, default 10 Signal_CooldownMinutes SCM_OFF..SCM_1440, overrides bars when set Minutes resolve against the CHART period and round UP, so a cooldown asked for in wall-clock is never silently shorter than requested and survives a timeframe change. SCB_/SCM_ prefixes are deliberately unique. M15/M30/M60 are ALREADY members of NF_LOOKBACK_PRESETS, and MQL5 binds a duplicated enum member to the first-declared enum silently - the obvious names would have compiled straight into the news filter's values. THE ANY-DIRECTION GATE IS ADDITIVE, NOT A REPLACEMENT, and the first cut of this had it backwards. Measured on the live log: the current rules draw 222 arrows over 4999 bars, while a BARE 10-bar cooldown permits up to 454 - because ALTERNATION is what declutters today, not the window. Swapping the rules out would have roughly doubled the clutter it was asked to remove. Layered, it can only ever suppress more. Suppressed bars still advance the per-direction last-SEEN cursors, so a run straddling the boundary does not restart as if it were fresh. Applied at all THREE sites that must agree - live inference, OOS pass-3 scoring and the chart renderer. Their own comments say why: an arrow set that does not obey the same rule as the traded set shows calls the EA would never take. Also corrects a stale comment that called this window "display only". It is not: when it suppresses, the live path zeroes the signal outright - no arrow, no vote, no position. Training never sees it, so these cost no retrain and are correctly absent from the fingerprint. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
84 lines
4.6 KiB
MQL5
84 lines
4.6 KiB
MQL5
//+------------------------------------------------------------------+
|
|
//| Warrior_EA |
|
|
//| AnimateDread |
|
|
//| |
|
|
//| Adapter: CExpertSignalAIBase seen as a CChartView. |
|
|
//+------------------------------------------------------------------+
|
|
#ifndef WARRIOR_CHART_AIBASECHARTVIEW_MQH
|
|
#define WARRIOR_CHART_AIBASECHARTVIEW_MQH
|
|
#include "IChartView.mqh"
|
|
class CExpertSignalAIBase;
|
|
//+------------------------------------------------------------------+
|
|
//| THE ONE PLACE THAT KNOWS BOTH SIDES - see Training\AIBaseTrainingData.mqh for the full rationale |
|
|
//| (MQL5 gives a class exactly one base, so the signal cannot implement CChartView directly and owns |
|
|
//| one of these instead). Every method is a forward; it holds a borrowed pointer and never frees it. |
|
|
//+------------------------------------------------------------------+
|
|
class CAIBaseChartView : public CChartView
|
|
{
|
|
private:
|
|
CExpertSignalAIBase *m_owner; // BORROWED - the signal owns this object, not the reverse
|
|
|
|
public:
|
|
CAIBaseChartView(void) : m_owner(NULL) { }
|
|
~CAIBaseChartView(void) { m_owner = NULL; }
|
|
void Bind(CExpertSignalAIBase *owner) { m_owner = owner; }
|
|
|
|
virtual string Id(void) override;
|
|
virtual string FileName(void) override;
|
|
virtual string ArrowPrefix(void) override;
|
|
virtual ENUM_TIMEFRAMES Period(void) override;
|
|
virtual int Digits(void) override;
|
|
virtual string DisplayNameForChart(void) override;
|
|
virtual bool ModelLoadedFromDisk(void) override;
|
|
virtual bool TrainingComplete(void) override;
|
|
virtual bool BothDirectionsTradeable(void) override;
|
|
virtual int SignalClusterWindow(void) override;
|
|
virtual SIGNAL_COOLDOWN_SCOPE SignalCooldownScope(void) override;
|
|
virtual bool Stopping(void) override;
|
|
|
|
virtual datetime BarTime(const int idx) override;
|
|
virtual double BarClose(const int idx) override;
|
|
virtual int HistoryBars(void) override;
|
|
virtual int OutputNeuronsCount(void) override;
|
|
virtual bool NetReady(void) override;
|
|
virtual int AvailableBars(void) override;
|
|
virtual bool ResizeBuffers(const int barIndex) override;
|
|
virtual bool RefreshData(void) override;
|
|
virtual int ServableBars(const int want, const string context) override;
|
|
virtual void EnsureShadowNet(void) override;
|
|
virtual bool ScoreBarForRescan(const int idx, double &rawSignal, double &adjustedSignal) override;
|
|
virtual ENUM_SIGNAL ToSignal(const double value) override;
|
|
|
|
virtual int PredictionCacheSize(void) override;
|
|
virtual double PredictionAt(const int idx) override;
|
|
virtual void SetPredictionAt(const int idx, const double value) override;
|
|
virtual void ResizePredictionCache(const int size, const double fillValue) override;
|
|
virtual void PublishOverlaySnapshot(void) override;
|
|
|
|
virtual long EraCount(void) override;
|
|
virtual long CumIsTotal(void) override;
|
|
virtual long CumIsCorrect(void) override;
|
|
virtual long CumOosTotal(void) override;
|
|
virtual long CumOosCorrect(void) override;
|
|
virtual void OosTally(int &buyPredicted, int &sellPredicted, int &buyPredictedHits, int &sellPredictedHits) override;
|
|
virtual string PassLabel(void) override;
|
|
virtual int PassProgressPct(void) override;
|
|
virtual int OosSplitPct(void) override;
|
|
virtual int OosSamples(void) override;
|
|
virtual void ClassCounts(int &predBuy, int &predSell, int &predNeutral,
|
|
int &trueBuy, int &trueSell, int &trueNeutral) override;
|
|
virtual void OosRecallPct(int &buyRecallPct, int &sellRecallPct) override;
|
|
virtual void OosLivePrecision(int &buyPrecPct, int &buyFired, int &sellPrecPct, int &sellFired) override;
|
|
virtual double Forecast(void) override;
|
|
virtual double ErrorPct(void) override;
|
|
virtual double OosForecast(void) override;
|
|
virtual double OosErrorPct(void) override;
|
|
virtual double NetRecentAverageError(void) override;
|
|
virtual bool DisplayInference(void) override;
|
|
virtual double LiveVoteContribution(const double signal) override;
|
|
virtual double VoteCapableWeight(void) override;
|
|
|
|
virtual void PublishStatus(const string text, const bool force) override;
|
|
};
|
|
#endif // WARRIOR_CHART_AIBASECHARTVIEW_MQH
|
|
//+------------------------------------------------------------------+
|