- Getting a general list of terminal and program properties
- Terminal build number
- Program type and license
- Terminal and program operating modes
- Permissions
- Checking network connections
- Computing resources: memory, disk, and CPU
- Screen specifications
- Terminal and program string properties
- Custom properties: Bar limit and interface language
- Binding a program to runtime properties
- Checking keyboard status
- Checking the MQL program status and reason for termination
- Programmatically closing the terminal and setting a return code
- Handling runtime errors
- User-defined errors
- Debug management
- Predefined variables
- Predefined constants of the MQL5 language
Terminal and program string properties
The MQLInfoString and TerminalInfoString functions can be used to find out several string properties of the terminal and MQL program.
Identifier |
Description |
---|---|
MQL_PROGRAM_NAME |
The name of the running MQL program |
MQL_PROGRAM_PATH |
Path for this running MQL program |
TERMINAL_LANGUAGE |
Terminal language |
TERMINAL_COMPANY |
Name of the company (broker) |
TERMINAL_NAME |
Terminal name |
TERMINAL_PATH |
The folder from which the terminal is launched |
TERMINAL_DATA_PATH |
The folder where terminal data is stored |
TERMINAL_COMMONDATA_PATH |
The shared folder of all client terminals installed on the computer |
The name of the running program (MQL_PROGRAM_NAME) usually coincides with the name of the main module (mq5 file) but may differ. In particular, if your source code compiles to a library which is imported into another MQL program (Expert Advisor, indicator, script, or service), then the MQL_PROGRAM_NAME property will return the name of the main program, not the library (the library is not an independent program that can be run).
We discussed the arrangement of working terminal folders in Working with files. Using the listed properties, you can find out where the terminal is installed (TERMINAL_PATH), as well as find the working data of the current terminal instance (TERMINAL_DATA_PATH) and of all instances (TERMINAL_COMMONDATA_PATH).
A simple script EnvDescription.mq5 logs all these properties.
void OnStart()
|
Below is an example result.
MQLInfoString(MQL_PROGRAM_NAME)=EnvDescription / ok
|
The interface language of the terminal can be found not only as a string in the TERMINAL_LANGUAGE property but also as a code page number (see the TERMINAL_CODEPAGE property in the next section).