58 lines
2.4 KiB
MQL5
58 lines
2.4 KiB
MQL5
//+------------------------------------------------------------------+
|
|
//| Reporter.mqh |
|
|
//| Copyright 2026, MasterOfPuppets |
|
|
//| https://forge.mql5.io/masterofpuppets/mql5 |
|
|
//+------------------------------------------------------------------+
|
|
#ifndef MASTER_OF_PUPPETS_LIB_REPORTER_MQH
|
|
#define MASTER_OF_PUPPETS_LIB_REPORTER_MQH
|
|
|
|
#include <Arrays\ArrayObj.mqh>
|
|
#include <Trade\DealInfo.mqh>
|
|
|
|
#property copyright "Copyright 2026, MasterOfPuppets"
|
|
#property link "https://forge.mql5.io/masterofpuppets/mql5"
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| Constants |
|
|
//+------------------------------------------------------------------+
|
|
const string MESSAGE_BUY = "BUY ";
|
|
const string MESSAGE_SELL = "SELL ";
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| Last profit class |
|
|
//+------------------------------------------------------------------+
|
|
class LastProfit : public CObject
|
|
{
|
|
public:
|
|
const string message;
|
|
const double profit;
|
|
const string suffix;
|
|
LastProfit(const string srcMessage, const double srcProfit, const string srcSuffix)
|
|
: message(srcMessage), profit(srcProfit), suffix(srcSuffix) {}
|
|
};
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| Reporter class |
|
|
//+------------------------------------------------------------------+
|
|
class Reporter
|
|
{
|
|
private:
|
|
CDealInfo *m_dealInfo;
|
|
int m_lastProfitsSize;
|
|
CArrayObj m_lastProfits;
|
|
double m_totalLastProfit;
|
|
void CalculateTotalLastProfit();
|
|
const string GetMessage(const ENUM_DEAL_TYPE enumDealType) const;
|
|
const string GetSuffix(const long dealReason) const;
|
|
public:
|
|
Reporter() : m_dealInfo(NULL), m_lastProfitsSize(0) {}
|
|
void Init(CDealInfo *srcDealInfo, const int srcLastProfitsSize);
|
|
void InitLastProfits();
|
|
const CArrayObj* GetLastProfits() const;
|
|
const double GetTotalLastProfit() const;
|
|
};
|
|
|
|
#include <MasterOfPuppetsLib\Reporter.mq5>
|
|
|
|
#endif
|
|
//+------------------------------------------------------------------+
|