Skip to content

Client Terminal Properties

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

IdentifierDescriptionType
TERMINAL_BUILDThe client terminal build numberint
TERMINAL_COMMUNITY_ACCOUNTThe flag indicates the presence of MQL5.community authorization data in the terminalbool
TERMINAL_COMMUNITY_CONNECTIONConnection to MQL5.communitybool
TERMINAL_CONNECTEDConnection to a trade serverbool
TERMINAL_DLLS_ALLOWEDPermission to use DLLbool
TERMINAL_TRADE_ALLOWEDPermission to tradebool
TERMINAL_EMAIL_ENABLEDPermission to send e-mails using SMTP-server and login, specified in the terminal settingsbool
TERMINAL_FTP_ENABLEDPermission to send reports using FTP-server and login, specified in the terminal settingsbool
TERMINAL_NOTIFICATIONS_ENABLEDPermission to send notifications to smartphonebool
TERMINAL_MAXBARSThe maximal bars count on the chartint
TERMINAL_MQIDThe flag indicates the presence of MetaQuotes ID data for Push notificationsbool
TERMINAL_CODEPAGENumber of the code page of the language installed in the client terminalint
TERMINAL_CPU_CORESThe number of CPU cores in the systemint
TERMINAL_DISK_SPACEFree disk space for the MQL5\Files folder of the terminal (agent), MBint
TERMINAL_MEMORY_PHYSICALPhysical memory in the system, MBint
TERMINAL_MEMORY_TOTALMemory available to the process of the terminal (agent), MBint
TERMINAL_MEMORY_AVAILABLEFree memory of the terminal (agent) process, MBint
TERMINAL_MEMORY_USEDMemory used by the terminal (agent), MBint
TERMINAL_X64Indication of the “64-bit terminal”bool
TERMINAL_OPENCL_SUPPORTThe version of the supported OpenCL in the format of 0x00010002 = 1.2. “0” means that OpenCL is not supportedint
TERMINAL_SCREEN_DPIThe 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_LEFTThe 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_TOPThe top coordinate of the virtual screenint
TERMINAL_SCREEN_WIDTHTerminal widthint
TERMINAL_SCREEN_HEIGHTTerminal heightint
TERMINAL_LEFTThe left coordinate of the terminal relative to the virtual screenint
TERMINAL_TOPThe top coordinate of the terminal relative to the virtual screenint
TERMINAL_RIGHTThe right coordinate of the terminal relative to the virtual screenint
TERMINAL_BOTTOMThe bottom coordinate of the terminal relative to the virtual screenint
TERMINAL_PING_LASTThe last known value of a ping to a trade server in microseconds. One second comprises of one million microsecondsint
TERMINAL_VPSIndication that the terminal is launched on the MetaTrader Virtual Hosting server (MetaTrader VPS)bool
Key identifierDescription
TERMINAL_KEYSTATE_LEFTState of the “Left arrow” keyint
TERMINAL_KEYSTATE_UPState of the “Up arrow” keyint
TERMINAL_KEYSTATE_RIGHTState of the “Right arrow” keyint
TERMINAL_KEYSTATE_DOWNState of the “Down arrow” keyint
TERMINAL_KEYSTATE_SHIFTState of the “Shift” keyint
TERMINAL_KEYSTATE_CONTROLState of the “Ctrl” keyint
TERMINAL_KEYSTATE_MENUState of the “Windows” keyint
TERMINAL_KEYSTATE_CAPSLOCKState of the “CapsLock” keyint
TERMINAL_KEYSTATE_NUMLOCKState of the “NumLock” keyint
TERMINAL_KEYSTATE_SCRLOCKState of the “ScrollLock” keyint
TERMINAL_KEYSTATE_ENTERState of the “Enter” keyint
TERMINAL_KEYSTATE_INSERTState of the “Insert” keyint
TERMINAL_KEYSTATE_DELETEState of the “Delete” keyint
TERMINAL_KEYSTATE_HOMEState of the “Home” keyint
TERMINAL_KEYSTATE_ENDState of the “End” keyint
TERMINAL_KEYSTATE_TABState of the “Tab” keyint
TERMINAL_KEYSTATE_PAGEUPState of the “PageUp” keyint
TERMINAL_KEYSTATE_PAGEDOWNState of the “PageDown” keyint
TERMINAL_KEYSTATE_ESCAPEState of the “Escape” keyint

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

IdentifierDescriptionType
TERMINAL_COMMUNITY_BALANCEBalance in MQL5.communitydouble
TERMINAL_RETRANSMISSIONPercentage 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

IdentifierDescriptionType
TERMINAL_LANGUAGELanguage of the terminalstring
TERMINAL_COMPANYCompany namestring
TERMINAL_NAMETerminal namestring
TERMINAL_PATHFolder from which the terminal is startedstring
TERMINAL_DATA_PATHFolder in which terminal data are storedstring
TERMINAL_COMMONDATA_PATHCommon path for all of the terminals installed on a computerstring
TERMINAL_CPU_NAMECPU namestring
TERMINAL_CPU_ARCHITECTURECPU architecturestring
TERMINAL_OS_VERSIONUser’s OS namestring
TERMINAL_COLORTHEME_NAMETerminal color scheme; possible values: Light and Dark.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

Get Terminal Color Scheme Information

The terminal supports two color schemes: Light (default) and Dark. When developing custom applications with graphical user interfaces, programmers should take the current terminal color scheme into account. Visual components used in the application should be dynamically adaptable to enhance user experience and maintain visual consistency.

To support this, the language provides functions for detecting the terminal color scheme:

IdentifierDescriptionProperty type
THEME_COLOR_WINDOWWindow backgroundcolor
THEME_COLOR_WINDOWTEXTText in the windowcolor
THEME_COLOR_BTNTEXTButton textcolor
THEME_COLOR_GRAYTEXTInactive (disabled) textcolor
THEME_COLOR_INFOTEXTTooltip textcolor
THEME_COLOR_INFOBKTooltip backgroundcolor
THEME_COLOR_3DFACEFront face of 3D elementscolor
THEME_COLOR_3DLIGHTLight side of 3D elementscolor
THEME_COLOR_3DSHADOWShadow side of 3D elementscolor
THEME_COLOR_3DDKSHADOWDark shadow of 3D elementscolor
THEME_COLOR_3DHILIGHTHighlight of 3D elementscolor
THEME_COLOR_HIGHLIGHTBackground of selected elementscolor
THEME_COLOR_HIGHLIGHTTEXTText of selected elementscolor
THEME_COLOR_BTNFACEButton front facecolor
THEME_COLOR_BTNHILIGHTButton highlightcolor
THEME_COLOR_BTNSHADOWButton shadowcolor
THEME_COLOR_MENUMenu backgroundcolor
THEME_COLOR_MENUBARMenu bar backgroundcolor
THEME_COLOR_MENUTEXTMenu textcolor
THEME_COLOR_MENUHILIGHTHighlight of selected menu itemcolor
THEME_COLOR_ACTIVECAPTIONActive window titlecolor
THEME_COLOR_INACTIVECAPTIONInactive window titlecolor
THEME_COLOR_GRADIENTINACTIVECAPTIONGradient of inactive window titlecolor
THEME_COLOR_CAPTIONTEXTWindow title textcolor
THEME_COLOR_INACTIVECAPTIONTEXTInactive window title textcolor
THEME_COLOR_HOTTEXTHyperlinks or active elementscolor
THEME_COLOR_NONEColor not selectedcolor
THEME_COLOR_SEPARATORSeparatorcolor
THEME_COLOR_SCROLLBACKScrollbarcolor
THEME_COLOR_LINE1Background color of odd rows in the Journalcolor
THEME_COLOR_LINE2Background color of even rows in the Journalcolor
THEME_COLOR_GRIDGrid color in the Journalcolor
THEME_COLOR_SUMMARYBackground color of summary row in the Journalcolor
THEME_COLOR_ERRORError message text colorcolor
THEME_COLOR_INVALIDInvalid value text colorcolor
THEME_COLOR_NEGATIVENegative value colorcolor
THEME_COLOR_POSITIVEPositive value colorcolor
THEME_COLOR_LINKLink colorcolor
THEME_COLOR_LINKHOVERLink hover colorcolor
THEME_COLOR_LINKTESTERLink color from cached results of previous testing/optimization runscolor
THEME_COLOR_TEXTUP“Button released” statecolor
THEME_COLOR_TEXTDOWN“Button pressed” statecolor
THEME_COLOR_BACKUPColor of “BUY” and “SELL” buttons in “One Click Trading” when the quote increasescolor
THEME_COLOR_BACKDOWNColor of “BUY” and “SELL” buttons in “One Click Trading” when the quote decreasescolor
THEME_COLOR_CLOSE“Close” operation button colorcolor
THEME_COLOR_BUY“BUY” operation button colorcolor
THEME_COLOR_SELL“SELL” operation button colorcolor
THEME_COLOR_DEPOSIT“Deposit” button colorcolor
THEME_COLOR_WITHDRAWAL“Withdrawal” button colorcolor
THEME_COLOR_BIDBid line colorcolor
THEME_COLOR_ASKAsk line colorcolor
THEME_COLOR_STOPSStop line colorcolor
THEME_COLOR_STOPS_REDStopLoss value highlight when profit is negative (Trade tab)color
THEME_COLOR_STOPS_GREENStopLoss value highlight when profit is positive (Trade tab)color
THEME_COLOR_CONFIRM“Accept” button color in the order submission windowcolor
THEME_COLOR_REQUOTE“Requote” button color in the order submission windowcolor
THEME_COLOR_REJECT“Reject” button color in the order submission windowcolor
THEME_COLOR_NOTIFICATIONColor of a change notification from the server in the order submission windowcolor
THEME_COLOR_RATINGRating bar color in the learning systemcolor
THEME_COLOR_BOOK_BUYBackground color of buy levels in the Depth of Marketcolor
THEME_COLOR_BOOK_SELLBackground color of sell levels in the Depth of Marketcolor
THEME_COLOR_BOOK_LASTColor of the last trade in the Depth of Marketcolor
THEME_COLOR_BOOK_STOPStopLoss level color in the Depth of Marketcolor
THEME_COLOR_BOOK_SPREADBackground color of levels within the spread in the Depth of Marketcolor
THEME_COLOR_TICKS_BIDBid line color on the tick chart in the order submission windowcolor
THEME_COLOR_TICKS_ASKAsk line color on the tick chart in the order submission windowcolor
THEME_COLOR_TICKS_LASTLast line color on the tick chart in the order submission windowcolor
THEME_COLOR_TICKS_CROSSCrosshair color on the tick chart in the order submission windowcolor
THEME_COLOR_TICKS_SLStopLoss line color on the tick chart in the order submission windowcolor
THEME_COLOR_TICKS_TPTakeProfit line color on the tick chart in the order submission windowcolor
THEME_COLOR_TESTER_START“Start” button color in testing/optimizationcolor
THEME_COLOR_TESTER_STOP“Stop” button color in testing/optimizationcolor
THEME_COLOR_TESTER_START_FRAMEBorder color of the “Start” button in testing/optimizationcolor
THEME_COLOR_TESTER_STOP_FRAMEBorder color of the “Stop” button in testing/optimizationcolor
THEME_COLOR_TESTER_PROGRESSProgress bar color in testing/optimizationcolor
THEME_COLOR_TESTER_BALANCEBalance line color in the Strategy Testercolor
THEME_COLOR_TESTER_EQUITYEquity line color in the Strategy Testercolor
THEME_COLOR_TESTER_MARGINDeposit Load graph color in the Strategy Testercolor
THEME_COLOR_PROFILER_CALLColor of the code line with a call during Profilingcolor
THEME_COLOR_PROFILER_CALLSELSelected code line color with a call during Profilingcolor
THEME_COLOR_PROFILER_LINELine color in the Profiler Journalcolor
THEME_COLOR_PROFILER_LINESELSelected line color in the Profiler Journalcolor
Last updated on