Client Terminal Properties

Information about the client terminal can be obtained by two functions: TerminalInfoInteger() and TerminalInfoString(). For parameters, these functions accept values from ENUM_TERMINAL_INFO_INTEGER and ENUM_TERMINAL_INFO_STRING respectively.

ENUM_TERMINAL_INFO_INTEGER

Identifier

Description

Type

TERMINAL_BUILD

The client terminal build number

int

TERMINAL_COMMUNITY_ACCOUNT

The flag indicates the presence of MQL5.community authorization data in the terminal

bool

TERMINAL_COMMUNITY_CONNECTION

Connection to MQL5.community

bool

TERMINAL_CONNECTED

Connection to a trade server

bool

TERMINAL_DLLS_ALLOWED

Permission to use DLL

bool

TERMINAL_TRADE_ALLOWED

Permission to trade

bool

TERMINAL_EMAIL_ENABLED

Permission to send e-mails using SMTP-server and login, specified in the terminal settings

bool

TERMINAL_FTP_ENABLED

Permission to send reports using FTP-server and login, specified in the terminal settings

bool

TERMINAL_NOTIFICATIONS_ENABLED

Permission to send notifications to smartphone

bool

TERMINAL_MAXBARS

The maximal bars count on the chart

int

TERMINAL_MQID

The flag indicates the presence of MetaQuotes ID data for Push notifications

bool

TERMINAL_CODEPAGE

Number of the code page of the language installed in the client terminal

int

TERMINAL_CPU_CORES

The number of CPU cores in the system

int

TERMINAL_DISK_SPACE

Free disk space for the MQL5\Files folder of the terminal (agent), MB

int

TERMINAL_MEMORY_PHYSICAL

Physical memory in the system, MB

int

TERMINAL_MEMORY_TOTAL

Memory available to the process of the terminal (agent), MB

int

TERMINAL_MEMORY_AVAILABLE

Free memory of the terminal (agent) process, MB

int

TERMINAL_MEMORY_USED

Memory used by the terminal (agent), MB

int

TERMINAL_X64

Indication of the "64-bit terminal"

bool

TERMINAL_OPENCL_SUPPORT

The version of the supported OpenCL in the format of 0x00010002 = 1.2.  "0" means that OpenCL is not supported

int

TERMINAL_SCREEN_DPI

The resolution of information display on the screen is measured as number of Dots in a line per Inch (DPI).

Knowing the parameter value, you can set the size of graphical objects so that they look the same on monitors with different resolution characteristics.

int

TERMINAL_SCREEN_LEFT

The left coordinate of the virtual screen. A virtual screen is a rectangle that covers all monitors. If the system has two monitors ordered from right to left, then the left coordinate of the virtual screen can be on the border of two monitors.

int

TERMINAL_SCREEN_TOP

The top coordinate of the virtual screen

int

TERMINAL_SCREEN_WIDTH

Terminal width

int

TERMINAL_SCREEN_HEIGHT

Terminal height

int

TERMINAL_LEFT

The left coordinate of the terminal relative to the virtual screen

int

TERMINAL_TOP

The top coordinate of the terminal relative to the virtual screen

int

TERMINAL_RIGHT

The right coordinate of the terminal relative to the virtual screen

int

TERMINAL_BOTTOM

The bottom coordinate of the terminal relative to the virtual screen

int

TERMINAL_PING_LAST

The last known value of a ping to a trade server in microseconds. One second comprises of one million microseconds

int

TERMINAL_VPS

Indication that the terminal is launched on the MetaTrader Virtual Hosting server (MetaTrader VPS)

bool

Key identifier

Description

 

TERMINAL_KEYSTATE_LEFT

State of the "Left arrow" key

int

TERMINAL_KEYSTATE_UP

State of the "Up arrow" key

int

TERMINAL_KEYSTATE_RIGHT

State of the "Right arrow" key

int

TERMINAL_KEYSTATE_DOWN

State of the "Down arrow" key

int

TERMINAL_KEYSTATE_SHIFT

State of the "Shift" key

int

TERMINAL_KEYSTATE_CONTROL

State of the "Ctrl" key

int

TERMINAL_KEYSTATE_MENU

State of the "Windows" key

int

TERMINAL_KEYSTATE_CAPSLOCK

State of the "CapsLock" key

int

TERMINAL_KEYSTATE_NUMLOCK

State of the "NumLock" key

int

TERMINAL_KEYSTATE_SCRLOCK

State of the "ScrollLock" key

int

TERMINAL_KEYSTATE_ENTER

State of the "Enter" key

int

TERMINAL_KEYSTATE_INSERT

State of the "Insert" key

int

TERMINAL_KEYSTATE_DELETE

State of the "Delete" key

int

TERMINAL_KEYSTATE_HOME

State of the "Home" key

int

TERMINAL_KEYSTATE_END

State of the "End" key

int

TERMINAL_KEYSTATE_TAB

State of the "Tab" key

int

TERMINAL_KEYSTATE_PAGEUP

State of the "PageUp" key

int

TERMINAL_KEYSTATE_PAGEDOWN

State of the "PageDown" key

int

TERMINAL_KEYSTATE_ESCAPE

State of the "Escape" key

int

Call to TerminalInfoInteger(TERMINAL_KEYSTATE_XXX) returns the same state code of a key as the GetKeyState() function in MSDN.

 

Example of scaling factor calculation:

//--- Creating a 1.5 inch wide button on a screen
int screen_dpi = TerminalInfoInteger(TERMINAL_SCREEN_DPI); // Find DPI of the user monitor
int base_width = 144;                                      // The basic width in the screen points for standard monitors with DPI=96
int width      = (button_width * screen_dpi) / 96;         // Calculate the button width for the user monitor (for the specific DPI)
...
 
//--- Calculating the scaling factor as a percentage
int scale_factor=(TerminalInfoInteger(TERMINAL_SCREEN_DPI) * 100) / 96;
//--- Use of the scaling factor
width=(base_width * scale_factor) / 100;

In the above example, the graphical resource looks the same on monitors with different resolution characteristics. The size of control elements (buttons, dialog windows, etc.) corresponds to personalization settings.

 

ENUM_TERMINAL_INFO_DOUBLE

Identifier

Description

Type

TERMINAL_COMMUNITY_BALANCE

Balance in MQL5.community

double

TERMINAL_RETRANSMISSION

Percentage of resent network packets in the TCP/IP protocol for all running applications and services on the given computer. Packet loss occurs even in the fastest and correctly configured networks. In this case, there is no confirmation of packet delivery between the recipient and the sender, therefore lost packets are resent.

 

It is not an indication of the connection quality between a particular terminal and a trade server, since the percentage is calculated for the entire network activity, including system and background activity.

 

The TERMINAL_RETRANSMISSION value is requested from the operating system once per minute. The terminal itself does not calculate this value.

double

 

File operations can be performed only in two directories; corresponding paths can be obtained using the request for TERMINAL_DATA_PATH and TERMINAL_COMMONDATA_PATH properties.

ENUM_TERMINAL_INFO_STRING

Identifier

Description

Type

TERMINAL_LANGUAGE

Language of the terminal

string

TERMINAL_COMPANY

Company name

string

TERMINAL_NAME

Terminal name

string

TERMINAL_PATH

Folder from which the terminal is started

string

TERMINAL_DATA_PATH

Folder in which terminal data are stored

string

TERMINAL_COMMONDATA_PATH

Common path for all of the terminals installed on a computer

string

TERMINAL_CPU_NAME

CPU name

string

TERMINAL_CPU_ARCHITECTURE

CPU architecture

string

TERMINAL_OS_VERSION

User's OS name

string

For a better understanding of paths, stored in properties of TERMINAL_PATH, TERMINAL_DATA_PATH and TERMINAL_COMMONDATA_PATH parameters, it is recommended to execute the script, which will return these values for the current copy of the client terminal, installed on your computer

Example: Script returns information about the client terminal paths

//+------------------------------------------------------------------+
//|                                          Check_TerminalPaths.mq5 |
//|                        Copyright 2009, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "2009, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
   Print("TERMINAL_PATH = ",TerminalInfoString(TERMINAL_PATH));
   Print("TERMINAL_DATA_PATH = ",TerminalInfoString(TERMINAL_DATA_PATH));
   Print("TERMINAL_COMMONDATA_PATH = ",TerminalInfoString(TERMINAL_COMMONDATA_PATH));
  }

As result of the script execution in the Experts Journal you will see a messages, like the following:

Getting data on a working folder of the terminal