91 lines
3.5 KiB
MQL5
91 lines
3.5 KiB
MQL5
|
//+------------------------------------------------------------------+
|
||
|
//| TradingManager.mqh |
|
||
|
//| Thorsten Fischer Copyright 2020 |
|
||
|
//| https://mql5.tfsystem.de |
|
||
|
//+------------------------------------------------------------------+
|
||
|
#property copyright "Thorsten Fischer Copyright 2020"
|
||
|
#property link "https://mql5.tfsystem.de"
|
||
|
#property version "1.00"
|
||
|
#property strict
|
||
|
//---
|
||
|
#include "..\..\TF-Dateien\TF-Class\TFTrade.mqh"
|
||
|
#include "..\..\TF-Dateien\TF-Class\TFObject.mqh"
|
||
|
#include "TFGUI.mqh"
|
||
|
|
||
|
//+------------------------------------------------------------------+
|
||
|
//| |
|
||
|
//+------------------------------------------------------------------+
|
||
|
class CTradingManager : public CTFObject
|
||
|
{
|
||
|
private:
|
||
|
CTFGUI m_tfgui;
|
||
|
|
||
|
public:
|
||
|
CTradingManager();
|
||
|
~CTradingManager();
|
||
|
//---
|
||
|
virtual bool OnInitEvent(void);
|
||
|
virtual void OnDeInitEvent(const int aReason=0);
|
||
|
virtual void ChartEvent(const int id, const long &lparam, const double &dparam, const string &sparam);
|
||
|
virtual void OnTickEvent(void);
|
||
|
};
|
||
|
//+------------------------------------------------------------------+
|
||
|
//| |
|
||
|
//+------------------------------------------------------------------+
|
||
|
CTradingManager::CTradingManager()
|
||
|
{
|
||
|
}
|
||
|
//+------------------------------------------------------------------+
|
||
|
//| |
|
||
|
//+------------------------------------------------------------------+
|
||
|
CTradingManager::~CTradingManager()
|
||
|
{
|
||
|
}
|
||
|
//+------------------------------------------------------------------+
|
||
|
//| |
|
||
|
//+------------------------------------------------------------------+
|
||
|
bool CTradingManager::OnInitEvent(void)
|
||
|
{
|
||
|
//---
|
||
|
if(!g_tftrade.OnInitEvent())
|
||
|
return(false);
|
||
|
g_tftrade.LogLevel(LOG_LEVEL_ALL);
|
||
|
g_tftrade.SetExpertMagicNumber(01010101001001100100);
|
||
|
g_tftrade.SetTypeFilling(ORDER_FILLING_RETURN);
|
||
|
//---
|
||
|
if(!m_tfgui.OnInitEvent())
|
||
|
return(false);
|
||
|
//---
|
||
|
return(true);
|
||
|
}
|
||
|
//+------------------------------------------------------------------+
|
||
|
//| |
|
||
|
//+------------------------------------------------------------------+
|
||
|
void CTradingManager::OnDeInitEvent(const int aReason=0)
|
||
|
{
|
||
|
//---
|
||
|
m_tfgui.OnDeInitEvent(aReason);
|
||
|
//---
|
||
|
g_tftrade.OnDeInitEvent(aReason);
|
||
|
//---
|
||
|
CTFObject::OnDeInitEvent(aReason);
|
||
|
}
|
||
|
//+------------------------------------------------------------------+
|
||
|
//| |
|
||
|
//+------------------------------------------------------------------+
|
||
|
void CTradingManager::ChartEvent(const int id, const long &lparam, const double &dparam, const string &sparam)
|
||
|
{
|
||
|
//---
|
||
|
m_tfgui.ChartEvent(id, lparam, dparam, sparam);
|
||
|
}
|
||
|
//+------------------------------------------------------------------+
|
||
|
//| |
|
||
|
//+------------------------------------------------------------------+
|
||
|
void CTradingManager::OnTickEvent(void)
|
||
|
{
|
||
|
//---
|
||
|
g_tftrade.OnTickEvent();
|
||
|
}
|
||
|
|
||
|
//+------------------------------------------------------------------+
|