mql5/Include/MasterOfPuppetsLib/Reporter.mqh

58 lines
2.4 KiB
MQL5
Raw Permalink Normal View History

2026-03-06 11:42:57 +03:00
//+------------------------------------------------------------------+
2026-03-06 10:04:52 +03:00
//| 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
2026-03-06 11:42:57 +03:00
#include <Arrays\ArrayObj.mqh>
2026-03-06 10:04:52 +03:00
#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 ";
//+------------------------------------------------------------------+
2026-03-06 11:42:57 +03:00
//| Last profit class |
2026-03-06 10:04:52 +03:00
//+------------------------------------------------------------------+
2026-03-06 11:42:57 +03:00
class LastProfit : public CObject
2026-03-06 10:04:52 +03:00
{
2026-03-06 11:42:57 +03:00
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) {}
2026-03-06 10:04:52 +03:00
};
//+------------------------------------------------------------------+
//| Reporter class |
//+------------------------------------------------------------------+
class Reporter
{
private:
CDealInfo *m_dealInfo;
int m_lastProfitsSize;
2026-03-06 11:42:57 +03:00
CArrayObj m_lastProfits;
2026-03-06 10:04:52 +03:00
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();
2026-03-06 11:42:57 +03:00
const CArrayObj* GetLastProfits() const;
const double GetTotalLastProfit() const;
2026-03-06 10:04:52 +03:00
};
#include <MasterOfPuppetsLib\Reporter.mq5>
#endif
//+------------------------------------------------------------------+