//+------------------------------------------------------------------+ //| IAnalyser.mqh | //| Copyright 2025, MetaQuotes Ltd. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2025, MetaQuotes Ltd." #property link "https://www.mql5.com" #property version "1.00" #include "../Events/EventBus/EventBus.mqh" #include "../Events/Events/AnalysisEvents.mqh" #include "../Configs/TfBarSeries.mqh" #include //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ class IAnalyser { protected: EventBus* eventBus; virtual bool SaveState(string symbol, ENUM_TIMEFRAMES tf, JSON::Object* obj) { return false; } virtual bool LoadState(string symbol, ENUM_TIMEFRAMES tf, const JSON::Object* obj) { return false; } virtual bool CanSkipHistory(string symbol, ENUM_TIMEFRAMES tf) { return false; } bool IsValidValue(double value) { return value != 0.0 && value != EMPTY_VALUE;} bool IsSwingHigh(int index, IndicatorSeries* series) { return IsValidValue(series.Value(0, index)); } bool IsSwingLow(int index, IndicatorSeries* series) { return IsValidValue(series.Value(1, index)); } public: virtual ~IAnalyser() { } void Init(EventBus* bus) {eventBus = bus; } IAnalyser() : eventBus(NULL) {} virtual void ProcessBar(TfBarSeries &series, int barIndex) = 0; virtual void Reset(string symbol, ENUM_TIMEFRAMES tf) { Print("Reset ", EnumToString(tf));} virtual string GetAnalyserName() = 0; }; //+------------------------------------------------------------------+