95 lines
3.4 KiB
MQL5
95 lines
3.4 KiB
MQL5
|
//--- Connection with the main file of the Expert Advisor
|
||
|
#include "../../Experts/MultiSymbolExpert/MultiSymbolExpert.mq5"
|
||
|
//--- Include custom libraries
|
||
|
#include "../../Include/MultiSymbolExpert/Enums.mqh"
|
||
|
#include "../../Include/MultiSymbolExpert/InitializeArrays.mqh"
|
||
|
#include "../../Include/MultiSymbolExpert/Errors.mqh"
|
||
|
#include "../../Include/MultiSymbolExpert/TradeSignals.mqh"
|
||
|
#include "../../Include/MultiSymbolExpert/TradeFunctions.mqh"
|
||
|
#include "../../Include/MultiSymbolExpert/ToString.mqh"
|
||
|
#include "../../Include/MultiSymbolExpert/Auxiliary.mqh"
|
||
|
//+------------------------------------------------------------------+
|
||
|
//| Converting the position duration to a string |
|
||
|
//+------------------------------------------------------------------+
|
||
|
string CurrentPositionDurationToString(ulong time)
|
||
|
{
|
||
|
//--- A dash if there is no position
|
||
|
string result="-";
|
||
|
//--- If the position exists
|
||
|
if(pos.exists)
|
||
|
{
|
||
|
//--- Variables for calculation results
|
||
|
ulong days=0;
|
||
|
ulong hours=0;
|
||
|
ulong minutes=0;
|
||
|
ulong seconds=0;
|
||
|
//---
|
||
|
seconds=time%60;
|
||
|
time/=60;
|
||
|
//---
|
||
|
minutes=time%60;
|
||
|
time/=60;
|
||
|
//---
|
||
|
hours=time%24;
|
||
|
time/=24;
|
||
|
//---
|
||
|
days=time;
|
||
|
//--- Generate a string in the specified format DD:HH:MM:SS
|
||
|
result=StringFormat("%02u d: %02u h : %02u m : %02u s",days,hours,minutes,seconds);
|
||
|
}
|
||
|
//--- Return result
|
||
|
return(result);
|
||
|
}
|
||
|
//+------------------------------------------------------------------+
|
||
|
//| Converting position type to a string |
|
||
|
//+------------------------------------------------------------------+
|
||
|
string PositionTypeToString(ENUM_POSITION_TYPE type)
|
||
|
{
|
||
|
string str="";
|
||
|
//---
|
||
|
if(type==POSITION_TYPE_BUY)
|
||
|
str="buy";
|
||
|
else if(type==POSITION_TYPE_SELL)
|
||
|
str="sell";
|
||
|
else
|
||
|
str="wrong value";
|
||
|
//---
|
||
|
return(str);
|
||
|
}
|
||
|
//+------------------------------------------------------------------+
|
||
|
//| Converting time frame to a string |
|
||
|
//+------------------------------------------------------------------+
|
||
|
string TimeframeToString(ENUM_TIMEFRAMES timeframe)
|
||
|
{
|
||
|
string str="";
|
||
|
//--- If the passed value is incorrect, take the time frame of the current chart
|
||
|
if(timeframe==WRONG_VALUE|| timeframe== NULL)
|
||
|
timeframe= Period();
|
||
|
switch(timeframe)
|
||
|
{
|
||
|
case PERIOD_M1 : str="M1"; break;
|
||
|
case PERIOD_M2 : str="M2"; break;
|
||
|
case PERIOD_M3 : str="M3"; break;
|
||
|
case PERIOD_M4 : str="M4"; break;
|
||
|
case PERIOD_M5 : str="M5"; break;
|
||
|
case PERIOD_M6 : str="M6"; break;
|
||
|
case PERIOD_M10 : str="M10"; break;
|
||
|
case PERIOD_M12 : str="M12"; break;
|
||
|
case PERIOD_M15 : str="M15"; break;
|
||
|
case PERIOD_M20 : str="M20"; break;
|
||
|
case PERIOD_M30 : str="M30"; break;
|
||
|
case PERIOD_H1 : str="H1"; break;
|
||
|
case PERIOD_H2 : str="H2"; break;
|
||
|
case PERIOD_H3 : str="H3"; break;
|
||
|
case PERIOD_H4 : str="H4"; break;
|
||
|
case PERIOD_H6 : str="H6"; break;
|
||
|
case PERIOD_H8 : str="H8"; break;
|
||
|
case PERIOD_H12 : str="H12"; break;
|
||
|
case PERIOD_D1 : str="D1"; break;
|
||
|
case PERIOD_W1 : str="W1"; break;
|
||
|
case PERIOD_MN1 : str="MN1"; break;
|
||
|
}
|
||
|
//---
|
||
|
return(str);
|
||
|
}
|
||
|
//+------------------------------------------------------------------+
|