MQL4 Reference Constants, Enumerations and Structures Environment State Client Terminal Properties

MQL4 Help as One File:

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 to send 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 MQL4\Files folder of the terminal, Mb

int

TERMINAL_MEMORY_PHYSICAL

Physical memory in the system, Mb

int

TERMINAL_MEMORY_TOTAL

Memory available to the process of the terminal , Mb

int

TERMINAL_MEMORY_AVAILABLE

Free memory of the terminal process, Mb

int

TERMINAL_MEMORY_USED

Memory used by the terminal , Mb

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_PING_LAST

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

int

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

 

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

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