mql5/Experts/Motivated/Interfaces/Events/IStructEvent.mqh

77 lines
3.9 KiB
MQL5

2026-06-09 05:44:15 +02:00
//+------------------------------------------------------------------+
//| IStructEvents.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 "IEvent.mqh"
2026-06-23 21:44:37 +02:00
2026-06-09 05:44:15 +02:00
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
2026-06-23 21:44:37 +02:00
#define STRUCT_LEVEL_BULL 1001
#define STRUCT_LEVEL_BEAR 1002
//+------------------------------------------------------------------+
//| Expanded events for market structure detection |
//| (used for RL AI model training and real-time analysis) |
//+------------------------------------------------------------------+
2026-06-09 05:44:15 +02:00
enum StructEventType
2026-06-10 18:31:08 +02:00
{
2026-06-23 21:44:37 +02:00
STRUCT_NONE = 0, // No event
STRUCT_DETECT_SWING_HIGH = 1, // New swing high detected (local maximum)
STRUCT_DETECT_SWING_LOW = 2, // New swing low detected (local minimum)
STRUCT_DETECT_PROTECTED_HIGH = 3, // New protected high set (for bearish trend)
STRUCT_DETECT_PROTECTED_LOW, // New protected low set (for bullish trend)
STRUCT_DETECT_CONFIRMED_HIGH, // Swing high confirmed by BOS (market structure break)
STRUCT_DETECT_CONFIRMED_LOW, // Swing low confirmed by BOS
STRUCT_DETECT_BOS_BULL, // Bullish Break of Structure (price > previous swing high)
STRUCT_DETECT_BOS_BEAR, // Bearish Break of Structure (price < previous swing low)
STRUCT_DETECT_CHOCH_BULL, // Bullish Change of Character (first sign of trend reversal to up)
STRUCT_DETECT_CHOCH_BEAR, // Bearish Change of Character (first sign of trend reversal to down)
STRUCT_DETECT_TREND_CHANGE_BULL, // Full trend change to bullish (protected high broken)
STRUCT_DETECT_TREND_CHANGE_BEAR, // Full trend change to bearish (protected low broken)
STRUCT_DETECT_COMPLEX_PULLBACK_START, // Complex pullback phase begins (price retraces multiple swings)
STRUCT_DETECT_COMPLEX_PULLBACK_END, // Complex pullback ends, original trend resumes
STRUCT_DETECT_INTERNAL_SWING_HIGH, // Internal structure swing high (lower timeframe fractal)
STRUCT_DETECT_INTERNAL_SWING_LOW, // Internal structure swing low
STRUCT_UPDATE_TRACKER // Internal state update (not for AI consumption)
2026-06-10 18:31:08 +02:00
};
2026-06-23 21:44:37 +02:00
2026-06-09 05:44:15 +02:00
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
2026-06-10 23:03:10 +02:00
class CStructEvent : public IEvent
2026-06-10 18:31:08 +02:00
{
2026-06-09 05:44:15 +02:00
private:
2026-06-10 18:31:08 +02:00
StructEventType m_type;
double m_level;
datetime m_time;
datetime m_refTime;
int m_tf;
double m_strength;
2026-06-09 05:44:15 +02:00
public:
2026-06-10 18:31:08 +02:00
CStructEvent(StructEventType t, double l, datetime tm, datetime rtm, int tf, double str = 1.0)
{
m_type = t;
m_level = l;
m_time = tm;
m_refTime = rtm;
m_tf = tf;
m_strength = str;
}
2026-06-09 05:44:15 +02:00
2026-06-10 18:31:08 +02:00
StructEventType getType() { return m_type; }
double getLevel() { return m_level; }
datetime getTime() { return m_time; }
datetime getRefTime() { return m_refTime; }
int getTimeframeMinutes() { return m_tf; }
double getStrength() { return m_strength; }
2026-06-23 21:44:37 +02:00
2026-06-10 23:03:10 +02:00
virtual EventType GetType() const override { return STRUCT_EVENTS; }
2026-06-23 21:44:37 +02:00
StructEventType Type() { return m_type; }
2026-06-10 18:31:08 +02:00
};
//+------------------------------------------------------------------+