Skip to content

Running MQL5 Program Properties

Running MQL5 Program Properties

To obtain information about the currently running mql5 program, constants from ENUM_MQL_INFO_INTEGER and ENUM_MQL_INFO_STRING are used.

For function MQLInfoInteger

ENUM_MQL_INFO_INTEGER

IdentifierDescriptionType
MQL_HANDLES_USEDThe current number of active object handles. These include both dynamic (created via new) and non-dynamic objects, global/local variables or class members. The more handles a program uses, the more resources it consumes.int
MQL_MEMORY_LIMITMaximum possible amount of dynamic memory for MQL5 program in MBint
MQL_MEMORY_USEDMemory used by MQL5 program in MBint
MQL_PROGRAM_TYPEType of the MQL5 programENUM_PROGRAM_TYPE
MQL_DLLS_ALLOWEDThe permission to use DLL for the given running programbool
MQL_TRADE_ALLOWEDThe permission to tradefor the given running programbool
MQL_SIGNALS_ALLOWEDThe permission to modify the Signals for the given running programbool
MQL_DEBUGIndication that the program is running in the debugging modebool
MQL_PROFILERIndication that the program is running in the code profiling modebool
MQL_TESTERIndication that the program is running in the testerbool
MQL_FORWARDIndication that the program is running in the forward testing processbool
MQL_OPTIMIZATIONIndication that the program is running in the optimization modebool
MQL_VISUAL_MODEIndication that the program is running in the visual testing modebool
MQL_FRAME_MODEIndication that the Expert Advisor is running in gathering optimization result frames modebool
MQL_LICENSE_TYPEType of license of the EX5 module. The license refers to the EX5 module, from which a request is made using MQLInfoInteger(MQL_LICENSE_TYPE).ENUM_LICENSE_TYPE
MQL_STARTED_FROM_CONFIGReturns true if a script/EA is launched from the StartUp section of the configuration file. This means that the script/EA had been specified in the configuration file the terminal was launched with.bool

For function MQLInfoString

ENUM_MQL_INFO_STRING

IdentifierDescriptionType
MQL_PROGRAM_NAMEName of the running mql5-programstring
MQL5_PROGRAM_PATHPath for the given running programstring

For information about the type of the running program, values of ENUM_PROGRAM_TYPE are used.

ENUM_PROGRAM_TYPE

IdentifierDescription
PROGRAM_SCRIPTScript
PROGRAM_EXPERTExpert
PROGRAM_INDICATORIndicator
PROGRAM_SERVICEService

ENUM_LICENSE_TYPE

IdentifierDescription
LICENSE_FREEA free unlimited version
LICENSE_DEMOA trial version of a paid product from the Market. It works only in the strategy tester
LICENSE_FULLA purchased licensed version allows at least 5 activations. The number of activations is specified by seller. Seller may increase the allowed number of activations
LICENSE_TIMEA version with a limited term license

Example:

ENUM_PROGRAM_TYPE mql_program=(ENUM_PROGRAM_TYPE)MQLInfoInteger(MQL_PROGRAM_TYPE);
   switch(mql_program)
     {
      case PROGRAM_SCRIPT:
        {
         Print(__FILE__+" is script");
         break;
        }
      case PROGRAM_EXPERT:
        {
         Print(__FILE__+" is Expert Advisor");
         break;
        }
      case PROGRAM_INDICATOR:
        {
         Print(__FILE__+" is custom indicator");
         break;
        }
      default:Print("MQL5 type value is ",mql_program);
   //---
   Print("MQLInfoInteger(MQL_MEMORY_LIMIT)=", MQLInfoInteger(MQL_MEMORY_LIMIT), " MB");
   Print("MQLInfoInteger(MQL_MEMORY_USED)=", MQLInfoInteger(MQL_MEMORY_USED), " MB");
   Print("MQLInfoInteger(MQL_HANDLES_USED)=", MQLInfoInteger(MQL_HANDLES_USED), " handles");
Last updated on