MT5Account API Reference¶
Layer 1 (Low-Level API) - Direct proto/gRPC methods for MetaTrader 5
Source: src/main/java/io/metarpc/mt5/MT5Account.java
Connection Methods¶
connect(String host, int port, String baseChartSymbol)- Connect to MT5 terminalconnectByServerName(String serverName, String baseChartSymbol)- Connect using server namedisconnect()- Disconnect from MT5 terminalclose()- Close gRPC channel and free resources
Account Information¶
accountSummary()- Get complete account summaryaccountInfoDouble(ENUM_ACCOUNT_INFO_DOUBLE property)- Get double propertyaccountInfoInteger(ENUM_ACCOUNT_INFO_INTEGER property)- Get integer propertyaccountInfoString(ENUM_ACCOUNT_INFO_STRING property)- Get string property
Symbol Information¶
quote(String symbol)- Get current quote (alias for symbolInfoTick)quoteMany(String[] symbols)- Get quotes for multiple symbolssymbolInfoTick(String symbol)- Get current tick datasymbolInfoDouble(String symbol, ENUM_SYMBOL_INFO_DOUBLE property)- Get double propertysymbolInfoInteger(String symbol, ENUM_SYMBOL_INFO_INTEGER property)- Get integer propertysymbolInfoString(String symbol, ENUM_SYMBOL_INFO_STRING property)- Get string propertysymbolSelect(String symbol, boolean select)- Enable/disable symbol in Market WatchsymbolName(int index, boolean selectedOnly)- Get symbol name by indexsymbolsTotal(boolean selectedOnly)- Get total symbols countsymbolExist(String symbol)- Check if symbol existssymbolIsSynchronized(String symbol)- Check if symbol data is synchronized
Market Depth (DOM)¶
marketBookAdd(String symbol)- Subscribe to market depthmarketBookGet(String symbol)- Get current market depth datamarketBookRelease(String symbol)- Unsubscribe from market depth
Positions & Orders¶
openedOrders(ENUM_OPENED_ORDER_SORT_TYPE sortType)- Get all open positions and ordersopenedOrdersTickets()- Get only ticket numberspositionsTotal()- Get count of open positionsorderHistory(from, to, sortType, offset, limit)- Get orders historypositionsHistory(from, to, sortType, offset, limit)- Get positions history
Trading Operations¶
orderSend(request)- Place new order (market/pending)orderCheck(request)- Check order before placingorderModify(request)- Modify existing order/positionorderClose(request)- Close positionorderCalcMargin(action, symbol, volume, price)- Calculate required marginorderCalcProfit(action, symbol, volume, priceOpen, priceClose)- Calculate profittickValueWithSize(symbol, tickValue, tickSize, volume)- Calculate tick value
Streaming Subscriptions¶
onSymbolTick(symbols[], observer)- Subscribe to tick data streamonTrade(observer)- Subscribe to trade eventsonPositionProfit(timerPeriod, ignoreEmpty, observer)- Subscribe to position profit updatesonPositionsAndPendingOrdersTickets(timerPeriod, observer)- Subscribe to tickets updatesonTradeTransaction(observer)- Subscribe to trade transactions
Note: All methods throw ApiExceptionMT5 on errors. Use try-catch for error handling.
For detailed documentation with examples, see MT5Account documentation.