Skip to main content
Glama

metatrader-mcp-server

is_trade_allowed.py767 B
import logging from ..exceptions import AccountInfoError, ConnectionError logger = logging.getLogger("MT5Account") def is_trade_allowed(connection) -> bool: """ Check if trading is allowed for this account. Returns: bool: True if trading is allowed, False otherwise. Raises: AccountInfoError: If trading permission cannot be determined. ConnectionError: If not connected to terminal. """ if not connection.is_connected(): raise ConnectionError("Not connected to MetaTrader 5 terminal.") logger.debug("Checking if trading is allowed...") import MetaTrader5 as mt5 trade_allowed = mt5.terminal_info().trade_allowed logger.debug(f"Trading allowed: {trade_allowed}") return bool(trade_allowed)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ariadng/metatrader-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server