164 lines
		
	
	
	
		
			5.8 KiB
		
	
	
	
		
			MQL5
		
	
	
	
	
	
			
		
		
	
	
			164 lines
		
	
	
	
		
			5.8 KiB
		
	
	
	
		
			MQL5
		
	
	
	
	
	
//+------------------------------------------------------------------+
 | 
						|
//|                                              BreakEvenResult.mqh |
 | 
						|
//|                                  Copyright 2024, MetaQuotes Ltd. |
 | 
						|
//|                                             https://www.mql5.com |
 | 
						|
//+------------------------------------------------------------------+
 | 
						|
#property copyright "Copyright 2024, MetaQuotes Ltd."
 | 
						|
#property link      "https://www.mql5.com"
 | 
						|
#property version   "1.00"
 | 
						|
#include <Arrays\ArrayLong.mqh>
 | 
						|
#include <Arrays\ArrayDouble.mqh>
 | 
						|
#include <Arrays\ArrayInt.mqh>
 | 
						|
 | 
						|
//+------------------------------------------------------------------+
 | 
						|
//|                                                                  |
 | 
						|
//+------------------------------------------------------------------+
 | 
						|
class BreakEvenResult: public CObject
 | 
						|
  {
 | 
						|
private:
 | 
						|
 | 
						|
 | 
						|
 | 
						|
public:
 | 
						|
   int               Net_Trades;
 | 
						|
   double            Net_Lots;
 | 
						|
   double            Net_Result;
 | 
						|
   //---
 | 
						|
   double            Average_Price;
 | 
						|
   double            distance;
 | 
						|
   
 | 
						|
   CArrayLong        TicketsToClose;
 | 
						|
   CArrayDouble      TicketsLotSizeToClose;
 | 
						|
                     BreakEvenResult();
 | 
						|
                     BreakEvenResult(const BreakEvenResult& that);
 | 
						|
                    ~BreakEvenResult();
 | 
						|
  };
 | 
						|
//+------------------------------------------------------------------+
 | 
						|
//|                                                                  |
 | 
						|
//+------------------------------------------------------------------+
 | 
						|
BreakEvenResult::BreakEvenResult()
 | 
						|
  {
 | 
						|
   Net_Trades=0;
 | 
						|
   Net_Lots=0;
 | 
						|
   Net_Result=0;
 | 
						|
//---
 | 
						|
   Average_Price=0;
 | 
						|
   distance=0;
 | 
						|
  }
 | 
						|
//+------------------------------------------------------------------+
 | 
						|
//|                                                                  |
 | 
						|
//+------------------------------------------------------------------+
 | 
						|
BreakEvenResult::~BreakEvenResult()
 | 
						|
  {
 | 
						|
 if (CheckPointer(&this) == POINTER_DYNAMIC)
 | 
						|
   delete &this;
 | 
						|
 | 
						|
  }
 | 
						|
//+------------------------------------------------------------------+
 | 
						|
BreakEvenResult::BreakEvenResult(const BreakEvenResult &that)   // Copy
 | 
						|
  {
 | 
						|
   this.Net_Trades = that.Net_Trades;
 | 
						|
   this.Net_Lots = that.Net_Lots;
 | 
						|
   this.Net_Result = that.Net_Result;
 | 
						|
   this.Average_Price = that.Average_Price;
 | 
						|
   this.distance = that.distance;
 | 
						|
   this.TicketsToClose = that.TicketsToClose;
 | 
						|
   this.TicketsLotSizeToClose = that.TicketsLotSizeToClose;
 | 
						|
   this.TicketsToClose=that.TicketsToClose;
 | 
						|
   this.TicketsLotSizeToClose=that.TicketsLotSizeToClose;
 | 
						|
   
 | 
						|
  }
 | 
						|
 | 
						|
 | 
						|
//+------------------------------------------------------------------+
 | 
						|
//|                                                                  |
 | 
						|
//+------------------------------------------------------------------+
 | 
						|
class BreakEvenInput: public CObject
 | 
						|
  {
 | 
						|
private:
 | 
						|
 | 
						|
public:
 | 
						|
   bool              Buys;
 | 
						|
   bool              Sells;
 | 
						|
   int               MagicNumber;
 | 
						|
   double            ProfitInMoney;
 | 
						|
   double            HedgeToBreakDownLots;
 | 
						|
                     BreakEvenInput();
 | 
						|
                     BreakEvenInput(const BreakEvenInput& that);
 | 
						|
                    ~BreakEvenInput();
 | 
						|
  };
 | 
						|
 | 
						|
//+------------------------------------------------------------------+
 | 
						|
//|                                                                  |
 | 
						|
//+------------------------------------------------------------------+
 | 
						|
BreakEvenInput::BreakEvenInput()
 | 
						|
  {
 | 
						|
   Buys=false;
 | 
						|
   Sells=false;
 | 
						|
   MagicNumber=0;
 | 
						|
   ProfitInMoney=0;
 | 
						|
   HedgeToBreakDownLots=0;
 | 
						|
 | 
						|
  }
 | 
						|
 | 
						|
//+------------------------------------------------------------------+
 | 
						|
//|                                                                  |
 | 
						|
//+------------------------------------------------------------------+
 | 
						|
BreakEvenInput::BreakEvenInput(const BreakEvenInput &that)   // Copy
 | 
						|
  {
 | 
						|
   this.Buys = that.Buys;
 | 
						|
   this.Sells=that.Sells;
 | 
						|
   this.MagicNumber=that.MagicNumber;
 | 
						|
   this.ProfitInMoney=that.ProfitInMoney;
 | 
						|
   this.HedgeToBreakDownLots=that.HedgeToBreakDownLots;
 | 
						|
  
 | 
						|
 | 
						|
  }
 | 
						|
//+------------------------------------------------------------------+
 | 
						|
//|                                                                  |
 | 
						|
//+------------------------------------------------------------------+
 | 
						|
BreakEvenInput::~BreakEvenInput()
 | 
						|
  {
 | 
						|
 if (CheckPointer(&this) == POINTER_DYNAMIC)
 | 
						|
   delete &this;
 | 
						|
  }
 | 
						|
//+------------------------------------------------------------------+
 | 
						|
//|                                                                  |
 | 
						|
//+------------------------------------------------------------------+
 | 
						|
class BreakEvenHedgeTicketsResult: public CObject
 | 
						|
  {
 | 
						|
private:
 | 
						|
 | 
						|
public:
 | 
						|
   CArrayDouble      lotsizes;
 | 
						|
   CArrayLong        ticketnumbers;
 | 
						|
                     BreakEvenHedgeTicketsResult();
 | 
						|
                     BreakEvenHedgeTicketsResult(const BreakEvenHedgeTicketsResult& that);
 | 
						|
                    ~BreakEvenHedgeTicketsResult();
 | 
						|
   CArrayInt            Buy;
 | 
						|
   
 | 
						|
 | 
						|
  };
 | 
						|
 | 
						|
//+------------------------------------------------------------------+
 | 
						|
BreakEvenHedgeTicketsResult::~BreakEvenHedgeTicketsResult()
 | 
						|
  {
 | 
						|
 if (CheckPointer(&this) == POINTER_DYNAMIC)
 | 
						|
   delete &this;
 | 
						|
  }
 | 
						|
//+------------------------------------------------------------------+
 | 
						|
//|                                                                  |
 | 
						|
//+------------------------------------------------------------------+
 | 
						|
BreakEvenHedgeTicketsResult::BreakEvenHedgeTicketsResult()
 | 
						|
  {}
 | 
						|
//+------------------------------------------------------------------+
 | 
						|
//|                                                                  |
 | 
						|
//+------------------------------------------------------------------+
 | 
						|
BreakEvenHedgeTicketsResult::BreakEvenHedgeTicketsResult(const BreakEvenHedgeTicketsResult &that)   // Copy
 | 
						|
  {
 | 
						|
   this.lotsizes = that.lotsizes;
 | 
						|
   this.ticketnumbers=that.ticketnumbers;
 | 
						|
   this.Buy=that.Buy;
 | 
						|
  
 | 
						|
  }  
 | 
						|
//+------------------------------------------------------------------+
 |