32 lines
1.4 KiB
MQL5
32 lines
1.4 KiB
MQL5
//+------------------------------------------------------------------+
| |
//| AbstractStrategy.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/SignalEvent.mqh"
| |
//+------------------------------------------------------------------+
| |
//| |
| |
//+------------------------------------------------------------------+
| |
class AbstractStrategy : public IEventListener
| |
{
| |
protected:
| |
EventBus* m_bus;
| |
| |
void PublishSignal(const string symbol, int direction, double price = 0, double sl = 0, double tp = 0, datetime t = 0, ENUM_ORDER_TYPE orderType = ORDER_TYPE_BUY, ENUM_TIMEFRAMES tf = PERIOD_M15)
| |
{
| |
| |
SignalEvent* sig = new SignalEvent(symbol, direction, price, sl, tp, orderType, t == 0 ? TimeCurrent() : 0, tf);
| |
//Print("PublishSignal");
| |
m_bus.Push(sig);
| |
| |
}
| |
public:
| |
void SetEventBus(EventBus* bus) { m_bus = bus; }
| |
| |
};
| |
//+------------------------------------------------------------------+
|