2026-08-06 00:19:26 +02:00 | | | //+------------------------------------------------------------------+
|
| | | //| 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"
|
2026-08-14 16:18:08 +02:00 | | | #include "../Events/Events/AnalysisEvents.mqh"
|
| | | #include "../Configs/TfBarSeries.mqh"
|
| | | #include <JSON.mqh>
|
2026-08-06 00:19:26 +02:00 | | | //+------------------------------------------------------------------+
|
| | | //| |
|
| | | //+------------------------------------------------------------------+
|
| | | class IAnalyser
|
| | | {
|
| | | protected:
|
2026-08-10 20:23:58 +02:00 | | | EventBus* eventBus;
|
2026-08-06 00:19:26 +02:00 | | |
|
2026-08-14 16:18:08 +02:00 | | | 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));
|
| | | }
|
2026-08-09 07:14:59 +02:00 | | |
|
2026-08-14 16:18:08 +02:00 | | | bool IsSwingLow(int index, IndicatorSeries* series)
|
2026-08-09 07:14:59 +02:00 | | | {
|
2026-08-14 16:18:08 +02:00 | | | return IsValidValue(series.Value(1, index));
|
2026-08-09 07:14:59 +02:00 | | | }
|
2026-08-14 16:18:08 +02:00 | | |
|
| | | 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;
|
2026-08-06 00:19:26 +02:00 | | | };
|
| | | //+------------------------------------------------------------------+
|