mql5/Experts/testRefactor2/ClosedPosition.mqh
2026-02-01 21:39:33 +01:00

57 lines
2.1 KiB
MQL5

//+------------------------------------------------------------------+
//| ClosedPosition.mqh – informace o jedné zavřené pozici |
//+------------------------------------------------------------------+
#property copyright "TestRefactor"
#property strict
#ifndef __CLOSED_POSITION_MQH__
#define __CLOSED_POSITION_MQH__
//+------------------------------------------------------------------+
//| CClosedPosition – snapshot zavřené pozice (profit, čas, typ) |
//+------------------------------------------------------------------+
class CClosedPosition {
private:
ulong m_ticket;
string m_symbol;
long m_type;
double m_openPrice;
double m_closePrice;
double m_volume;
double m_profit;
double m_swap;
datetime m_openTime;
datetime m_closeTime;
public:
CClosedPosition() : m_ticket(0), m_symbol(""), m_type(0), m_openPrice(0), m_closePrice(0),
m_volume(0), m_profit(0), m_swap(0), m_openTime(0), m_closeTime(0) {}
void Set(ulong ticket, string symbol, long type, double openPrice, double closePrice,
double volume, double profit, double swap, datetime openTime, datetime closeTime) {
m_ticket = ticket;
m_symbol = symbol;
m_type = type;
m_openPrice = openPrice;
m_closePrice = closePrice;
m_volume = volume;
m_profit = profit;
m_swap = swap;
m_openTime = openTime;
m_closeTime = closeTime;
}
ulong GetTicket() const { return m_ticket; }
string GetSymbol() const { return m_symbol; }
long GetType() const { return m_type; }
double GetOpenPrice() const { return m_openPrice; }
double GetClosePrice() const { return m_closePrice; }
double GetVolume() const { return m_volume; }
double GetProfit() const { return m_profit; }
double GetSwap() const { return m_swap; }
datetime GetOpenTime() const { return m_openTime; }
datetime GetCloseTime() const { return m_closeTime; }
double GetNetProfit() const { return m_profit + m_swap; }
};
#endif