77 lines
3.9 KiB
MQL5
77 lines
3.9 KiB
MQL5
//+------------------------------------------------------------------+
| |
//| 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"
| |
| |
| |
//+------------------------------------------------------------------+
| |
//| |
| |
//+------------------------------------------------------------------+
| |
#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) |
| |
//+------------------------------------------------------------------+
| |
enum StructEventType
| |
{
| |
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)
| |
};
| |
| |
//+------------------------------------------------------------------+
| |
//| |
| |
//+------------------------------------------------------------------+
| |
class CStructEvent : public IEvent
| |
{
| |
private:
| |
StructEventType m_type;
| |
double m_level;
| |
datetime m_time;
| |
datetime m_refTime;
| |
int m_tf;
| |
double m_strength;
| |
public:
| |
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;
| |
}
| |
| |
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; }
| |
| |
virtual EventType GetType() const override { return STRUCT_EVENTS; }
| |
StructEventType Type() { return m_type; }
| |
};
| |
//+------------------------------------------------------------------+
|