This Expert Advisor closes all positions if the total profit exceeds a predefined limit. In fact, this is a global take profit for all positions simultaneously.
//+----------------------------------------------+
//| Enumeration for profit calculation options |
//+----------------------------------------------+
enum TakeMode
{
ENUM_PERCENT, //profit in percentage
ENUM_CARRENCY //profit in the deposit currency
};
//+----------------------------------------------+
//| Input parameters of the EA indicator |
//+----------------------------------------------+
input TakeMode LMode=ENUM_PERCENT; //profit calculation method
input double TakeProfit=100.0; //take profit
//+----------------------------------------------+
//| Enumeration for profit calculation options |
//+----------------------------------------------+
enum TakeMode
{
ENUM_PERCENT, //profit in percentage
ENUM_CARRENCY //profit in the deposit currency
};
//+----------------------------------------------+
//| Input parameters of the EA indicator |
//+----------------------------------------------+
input TakeMode LMode=ENUM_PERCENT; //profit calculation method
input double TakeProfit=100.0; //take profit
//+----------------------------------------------+