Skip to content

Terminal

Terminal state and configuration.


Models

TerminalInfo

TerminalInfo

Bases: BaseModel

State and configuration of the connected MetaTrader 5 terminal.

Wraps the raw TerminalInfo struct returned by mt5.terminal_info(). Useful for verifying that the terminal is ready for trading before submitting orders.

ATTRIBUTE DESCRIPTION
community_account

Whether the terminal is connected with a MQL5 community account.

TYPE: bool

community_connection

Whether the MQL5 community server is reachable.

TYPE: bool

connected

Whether the terminal is connected to the broker server.

TYPE: bool

dlls_allowed

Whether DLL imports are permitted.

TYPE: bool

trade_allowed

Whether trading is enabled in the terminal settings.

TYPE: bool

tradeapi_disabled

Whether the trade API has been disabled by the broker.

TYPE: bool

email_enabled

Whether email notifications are enabled.

TYPE: bool

ftp_enabled

Whether FTP report delivery is enabled.

TYPE: bool

notifications_enabled

Whether push notifications are enabled.

TYPE: bool

mqid

Whether the terminal has a valid MQL5 ID.

TYPE: bool

build

Terminal build number.

TYPE: int

maxbars

Maximum number of bars in a chart.

TYPE: int

codepage

Code page used for string encoding.

TYPE: int

ping_last

Last measured round-trip latency to the broker server (ms).

TYPE: int

community_balance

MQL5 community account balance.

TYPE: float

retransmission

Network packet retransmission ratio (0.0โ€“1.0).

TYPE: float

company

Broker company name as shown in the terminal.

TYPE: str

name

Terminal product name.

TYPE: str

language

Terminal interface language.

TYPE: str

path

Path to the terminal executable.

TYPE: str

data_path

Path to the terminal data directory.

TYPE: str

commondata_path

Path to the shared data directory for all terminals.

TYPE: str

version property

version: str

Terminal version as a human-readable string (e.g. "Build 4000").

RETURNS DESCRIPTION
str

Version string derived from the build number.

is_ready_for_trading property

is_ready_for_trading: bool

Whether the terminal is in a state where trade requests can be submitted.

All three conditions must hold: the terminal must be connected to the broker, trading must be enabled in the terminal settings, and the trade API must not have been disabled by the broker.

RETURNS DESCRIPTION
bool

True if the terminal can accept trade requests.


Service

TerminalService

TerminalService

Retrieves terminal state and configuration from MT5.

Wraps mt5.terminal_info() via call_mt5, parses the raw TerminalInfo struct into a typed model, and returns Result[TerminalInfo].


Usage

res = mt5.terminal_info()

if res.success:
    term = res.data
    print(f"Build: {term.build}")
    print(f"Connected: {term.connected}")
    print(f"Ready for trading: {term.is_ready_for_trading}")
    print(f"Ping: {term.ping_last} ms")