Protocol Documentation

Table of Contents

mt4.proto

Top

AccountSummary

Account summary trading information

FieldTypeLabelDescription
Balance double

Balance

Credit double

Credit

Profit double

Profit

Equity double

Equity

Margin double

Used margin

FreeMargin double

Free margin

MarginLevel double

Margin percent

Leverage double

Leverage

Currency string

Currency

Type AccountType

Demo, contest, real

IsInvestor bool

Investor mode (without trading)

AccountSummaryReply

FieldTypeLabelDescription
result AccountSummary

error Error

AccountSummaryRequest

[Example]

{

"id": "demo-token-mt4"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method [Required]

Bar

Quote history bar.

FieldTypeLabelDescription
Time google.protobuf.Timestamp

Bar open time.

Open double

Open price.

High double

Maximum price.

Low double

Minimum price.

Close double

Close price.

Volume double

Volume.

BarsForSymbol

QuoteHistoryMany reply

FieldTypeLabelDescription
Symbol string

Symbols

Bars Bar repeated

Bars

Exception string

Error details

CheckConnectReply

FieldTypeLabelDescription
result string

error Error

CheckConnectRequest

[Example]

{

"id": "demo-token-mt4"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method [Required]

ClientStatus

Client ID with connection status

FieldTypeLabelDescription
Id string

Token

Connected bool

Connection status

User int32

User

Host string

Host

Port int32

Port

ClosedOrdersReply

FieldTypeLabelDescription
result Order repeated

error Error

ClosedOrdersRequest

[Example]

{

"id": "demo-token-mt4"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method [Required]

Company

FieldTypeLabelDescription
companyName string

results Result repeated

ConGroupSec

Security group configuration for client group

FieldTypeLabelDescription
MinLot double

Minimum lot size

MaxLot double

Maximum lot size

LotStep double

Lot step

show int32

enable show and trade for this group of securites

trade int32

enable show and trade for this group of securites

execution int32

dealing mode-EXECUTION_MANUAL,EXECUTION_AUTO,EXECUTION_ACTIVITY

comm_base double

standart commission

comm_type int32

commission type-COMM_TYPE_MONEY,COMM_TYPE_PIPS,COMM_TYPE_PERCENT

comm_lots int32

commission lots mode-COMMISSION_PER_LOT,COMMISSION_PER_DEAL

comm_agent double

agent commission

comm_agent_type int32

agent commission mode-COMM_TYPE_MONEY, COMM_TYPE_PIPS

spread_diff int32

spread difference in compare with default security spread

lot_min int32

allowed minimal and maximal lot values

lot_max int32

allowed minimal and maximal lot values

ie_deviation int32

maximum price deviation in Instant Execution mode

confirmation int32

use confirmation in Request mode

trade_rights int32

clients trade rights-bit mask see TRADE_DENY_NONE,TRADE_DENY_CLOSEBY,TRADE_DENY_MUCLOSEBY

ie_quick_mode int32

ie quick mode

autocloseout_mode int32

auto close-out modes see CLOSE_OUT_NONE,CLOSE_OUT_HIHI, CLOSE_OUT_LOLO, CLOSE_OUT_HILO, CLOSE_OUT_LOHI,CLOSE_OUT_LOHI,CLOSE_OUT_FIFO,CLOSE_OUT_LIFO,CLOSE_OUT_INTRDAY_FIFO

comm_tax double

commission taxes

comm_agent_lots int32

agent commission lots mode-COMMISSION_PER_LOT,COMMISSION_PER_DEAL

freemargin_mode int32

free margin check mode

reserved int32 repeated

reserved

ConSession

Security sessions configurations

FieldTypeLabelDescription
open_hour int32

session open time: hour and minute

open_min int32

session open time: hour and minute

close_hour int32

session close time: hour and minute

close_min int32

session close time: hour and minute

open int32

session open time: hour and minute

close int32

session close time: hour and minute

align int32 repeated

for internal usage

ConSessions

Sessions.

FieldTypeLabelDescription
quote ConSession repeated

quote sessions

trade ConSession repeated

trade sessions

quote_overnight int32

for internal usage

trade_overnight int32

for internal usage

reserved int32 repeated

reserved

ConSymbolGroup

Symbol groups

FieldTypeLabelDescription
name string

group name

description string

group description

ConnectProxyReply

FieldTypeLabelDescription
result string

error Error

ConnectProxyRequest

[Example]

{

"user": "21455",

"password": "1nJeS+Ae",

"host": "95.217.147.61",

"port": "443",

"proxyUser": "ProxyUser123",

"proxyPassword": "qwerty123",

"proxyHost": "65.108.126.217",

"proxyPort": "1080",

"proxyType": "Socks5"

}

FieldTypeLabelDescription
user int32

Account number. [Required]

password string

Password. [Required]

host string

Host - ip adddress or dns name. [Required]

port int32

Port. [Required]

proxyUser string

Proxy user [Required]

proxyPassword string

Proxy password [Required]

proxyHost string

Proxy server ip adddress [Required]

proxyPort int32

Proxy port [Required]

proxyType ProxyTypes

Proxy type. Put 'Socks5' for default parameters [Required]

id string optional

Token returned by 'Connect' method

ConnectReply

FieldTypeLabelDescription
result string

error Error

ConnectRequest

[Example]

{

"user": "500476959",

"password": "ehj4bod",

"host": "mt4-demo.roboforex.com",

"port": "443"

}

FieldTypeLabelDescription
user int32

Account number [Required]

password string

Password [Required]

host string

Host - ip adddress or dns name [Required]

port int32

Port [Required]

DisconnectReply

FieldTypeLabelDescription
result string

error Error

DisconnectRequest

[Example]

{

"id": "demo-token-mt4"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method [Required]

Error

FieldTypeLabelDescription
code ErrorCode

message string

stackTrace string

EventsReply

FieldTypeLabelDescription
result string

error Error

EventsRequest

[Example]

{

"id": "demo-token-mt4"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method

GetClientsReply

FieldTypeLabelDescription
result ClientStatus repeated

error Error

GetClientsRequest

GetLogsByUserReply

FieldTypeLabelDescription
result LogRec repeated

error Error

GetLogsByUserRequest

[Example]

{

"user": "500476959",

"password": "ehj4bod"

}

FieldTypeLabelDescription
user int32

Account number [Required]

password string

Password [Required]

GetLogsReply

FieldTypeLabelDescription
result LogRec repeated

error Error

GetLogsRequest

[Example]

{

"id": "demo-token-mt4"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method [Required]

GetQuoteManyReply

FieldTypeLabelDescription
result QuoteEventArgs repeated

error Error

GetQuoteManyRequest

[Example]

{

"id": "demo-token-mt5",

"msNotOlder": "0"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method [Required]

symbols string repeated

Symbols [Required]

msNotOlder int32 optional

If last quote arrived less than msOlderMs milliseconds ago function returns last quote, overwise - wait for new quote. If zero - always returns last quote.

GroupsReply

FieldTypeLabelDescription
result ConSymbolGroup repeated

error Error

GroupsRequest

[Example]

{

"id": "demo-token-mt4"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method [Required]

IsInvestorReply

FieldTypeLabelDescription
result bool

error Error

IsInvestorRequest

[Example]

{

"id": "demo-token-mt4"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method [Required]

LogRec

FieldTypeLabelDescription
Time google.protobuf.Timestamp

Level LogEventLevel

Message string

Id string

User int32

Password string

MemUsage

FieldTypeLabelDescription
Is64BitProcess bool

PhysicalMemoryUsage int32

BasePriority int32

PriorityClass string

UserProcessorTime string

PrivilegedProcessorTime string

TotalProcessorTime string

PagedSystemMemorySize int32

PagedMemorySize int32

PeakPagedMem int32

PeakVirtualMem int32

PeakWorkingSet int32

MemoryLoadBytes int32

HeapSizeBytes int32

FragmentedBytes int32

HighMemoryLoadThresholdBytes int32

TotalAvailableMemoryBytes int32

Responding bool

MemorySnapshotReply

FieldTypeLabelDescription
result string

error Error

MemorySnapshotRequest

MemoryUsageReply

FieldTypeLabelDescription
result MemUsage

error Error

MemoryUsageRequest

OnDisconnectReply

FieldTypeLabelDescription
result string

error Error

OnDisconnectRequest

[Example]

{

"id": "demo-token-mt4"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method

OnOrderProfitReply

FieldTypeLabelDescription
result ProfitUpdate

error Error

OnOrderProfitRequest

[Example]

{

"id": "demo-token-mt4"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method

OnOrderUpdateReply

FieldTypeLabelDescription
result OrderUpdateSummary

error Error

OnOrderUpdateRequest

[Example]

{

"id": "demo-token-mt4"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method

OnQuoteHistoryReply

FieldTypeLabelDescription
result QuoteHistoryEventArgs

error Error

OnQuoteHistoryRequest

[Example]

{

"id": "demo-token-mt4"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method

OnQuoteReply

FieldTypeLabelDescription
result QuoteEventArgs

error Error

OnQuoteRequest

[Example]

{

"id": "demo-token-mt4"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method

OnTickValueReply

FieldTypeLabelDescription
result SymbolTickValue

error Error

OnTickValueRequest

[Example]

{

"id": "demo-token-mt4"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method

OpenedOrderReply

FieldTypeLabelDescription
result Order

error Error

OpenedOrderRequest

[Example]

{

"id": "demo-token-mt4",

"ticket": "0"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method [Required]

ticket int32

Ticket number [Required]

OpenedOrdersReply

FieldTypeLabelDescription
result Order repeated

error Error

OpenedOrdersRequest

[Example]

{

"id": "demo-token-mt4"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method [Required]

Order

Contains order data.

FieldTypeLabelDescription
PlacedType PlacedType

Placed manually or by expert

Ticket int32

Ticket number.

OpenTime google.protobuf.Timestamp

Open time.

CloseTime google.protobuf.Timestamp

Close time. Just for history orders.

Expiration google.protobuf.Timestamp

Expiration time of pending order.

Type Op

Order type.

Lots double

Amount of lots. Be carefull some brokers use non standart lots.

Symbol string

Trading instrument.

OpenPrice double

Open price.

StopLoss double

Stop loss.

TakeProfit double

Take profit.

ClosePrice double

Close price. Just for history orders.

MagicNumber int32

Identifying (magic) number.

Swap double

Swap value.

Commission double

Commission value.

Comment string

Order comment.

Profit double

Net profit value (without swaps or commissions) in base currency.

RateOpen double

Convertation rate from profit currency to group deposit currency for open time.

RateClose double

Convertation rate from profit currency to group deposit currency for close time.

RateMargin double

Rate of convertation from margin currency to deposit one.

OrderCloseByReply

FieldTypeLabelDescription
result string

error Error

OrderCloseByRequest

[Example]

{

"id": "demo-token-mt4",

"ticket1": "0",

"ticket2": "0"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method [Required]

ticket1 int32

Order ticket [Required]

ticket2 int32

Order ticket [Required]

OrderCloseReply

FieldTypeLabelDescription
result Order

error Error

OrderCloseRequest

[Example]

{

"id": "demo-token-mt4",

"ticket": "0",

"lots": "0",

"price": "0",

"slippage": "0"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method [Required]

ticket int32

Ticket number [Required]

lots double

Lots

price double

Price. Optional, but required in case of Instant Execution.

slippage int32

Slippage. Optional.

OrderDeleteReply

FieldTypeLabelDescription
result string

error Error

OrderDeleteRequest

[Example]

{

"id": "demo-token-mt4",

"ticket": "0"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method [Required]

ticket int32

Ticket number [Required]

OrderHistoryReply

FieldTypeLabelDescription
result Order repeated

error Error

OrderHistoryRequest

[Example]

{

"id": "demo-token-mt4",

"from": "2022-01-01T00:00:00",

"to": "2023-06-01T00:00:00"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method [Required]

from string

'From date' in format: yyyy-MM-ddTHH:mm:ss [Required]

to string

'To date' in format: yyyy-MM-ddTHH:mm:ss

OrderModifyReply

FieldTypeLabelDescription
result Order

error Error

OrderModifyRequest

[Example]

{

"id": "demo-token-mt4",

"ticket": "0",

"stoploss": "0",

"takeprofit": "0",

"price": "0"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method [Required]

ticket int32

Ticket number [Required]

stoploss double

StopLoss. Optional. [Required]

takeprofit double

TakeProfit. Optional. [Required]

price double

Price. Optional, but required in case of Instant Execution.

expiration string

Expiartion in format: yyyy-MM-ddTHH:mm:ss. Optional.

OrderSendReply

FieldTypeLabelDescription
result Order

error Error

OrderSendRequest

[Example]

{

"id": "demo-token-mt4",

"symbol": "EURUSD",

"operation": "Buy",

"volume": "0.1",

"price": "0",

"slippage": "0",

"stoploss": "0",

"takeprofit": "0",

"magic": "0",

"placedType": "Client"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method [Required]

symbol string

Symbol [Required]

operation Op

Buy, Sell, BuyLimit, SellLimit, BuyStop, SellStop [Required]

volume double

Lots [Required]

price double

Price. Optional, but required in case of Instant Execution.

slippage int32

Slippage. Optional.

stoploss double

StopLoss. Optional.

takeprofit double

TakeProfit. Optional.

comment string

Comment. Optional.

magic int32

Magic. Optional.

expiration string

Expiartion in format: yyyy-MM-ddTHH:mm:ss. Optional.

placedType PlacedType

Placed type

OrderUpdateEventArgs

Arguments for OrderUpdate event.

FieldTypeLabelDescription
Order Order

Updated order.

Action UpdateAction

Update action.

OrderUpdateSummary

Order update event details

FieldTypeLabelDescription
Update OrderUpdateEventArgs

Order and update action

Balance double

Balance

Credit double

Credit

Profit double

Account profit

Equity double

Equity

Margin double

Used margin

FreeMargin double

Free margin

MarginLevel double

Margin percent

Leverage double

Leverage

Currency string

Currency

Type AccountType

Demo, contest, real

IsInvestor bool

Investor mode (without trading)

OpenedOrders Order repeated

Opened orders

PingHostManyReply

FieldTypeLabelDescription
result int32 repeated

error Error

PingHostManyRequest

FieldTypeLabelDescription
hosts string repeated

List IP adresses or domain names joined with port by ':' symbol [Required]

PingHostReply

FieldTypeLabelDescription
result int32

error Error

PingHostRequest

[Example]

{

"host": "mt4-demo.roboforex.com",

"port": "443"

}

FieldTypeLabelDescription
host string

Host - ip adddress or dns name [Required]

port int32

Port

PingReply

FieldTypeLabelDescription
result string

error Error

PingRequest

ProfitUpdate

Profit update message

FieldTypeLabelDescription
Balance double

Balance

Credit double

Credit

Profit double

Account profit

Equity double

Equity

Margin double

Used margin

FreeMargin double

Free margin

MarginLevel double

Margin percent

Leverage double

Leverage

Currency string

Currency

Type AccountType

Demo, contest, real

IsInvestor bool

Investor mode (without trading)

Orders Order repeated

Opened orders

QuoteEventArgs

New quote event arguments.

FieldTypeLabelDescription
Symbol string

Trading instrument.

Bid double

Bid.

Ask double

Ask.

Time google.protobuf.Timestamp

Server time.

High double

High.

Low double

Low.

QuoteHistoryEventArgs

Quote history event args.

FieldTypeLabelDescription
Symbol string

Instrument.

Timeframe Timeframe

Timeframe.

Bars Bar repeated

History bars.

QuoteHistoryManyReply

FieldTypeLabelDescription
result BarsForSymbol repeated

error Error

QuoteHistoryManyRequest

[Example]

{

"id": "demo-token-mt4",

"timeframe": "D1",

"from": "2022-10-01T00:00:00",

"count": "10"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method [Required]

symbol string repeated

Symbol [Required]

timeframe Timeframe

Timeframe. M1,M5,M15,M30,H1,H4,D1,W1,MN1 [Required]

from string

'From date' in format: yyyy-MM-ddTHH:mm:ss [Required]

count int32

Number of bars back from specified date. [Required]

QuoteHistoryReply

FieldTypeLabelDescription
result Bar repeated

error Error

QuoteHistoryRequest

[Example]

{

"id": "demo-token-mt4",

"symbol": "EURUSD",

"timeframe": "D1",

"from": "2022-10-01T00:00:00",

"count": "10"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method [Required]

symbol string

Symbol [Required]

timeframe Timeframe

Timeframe. M1,M5,M15,M30,H1,H4,D1,W1,MN1 [Required]

from string

'From date' in format: yyyy-MM-ddTHH:mm:ss [Required]

count int32

Number of bars back from specified date. [Required]

QuoteReply

FieldTypeLabelDescription
result QuoteEventArgs

error Error

QuoteRequest

[Example]

{

"id": "demo-token-mt4",

"symbol": "EURUSD"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method [Required]

symbol string

Symbol [Required]

RequestQuoteHistoryReply

FieldTypeLabelDescription
result string

error Error

RequestQuoteHistoryRequest

[Example]

{

"id": "demo-token-mt4",

"symbol": "EURUSD",

"timeframe": "D1",

"from": "2022-10-01T00:00:00",

"count": "10"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method [Required]

symbol string

Symbol [Required]

timeframe Timeframe

Timeframe. M1,M5,M15,M30,H1,H4,D1,W1,MN1 [Required]

from string

'From date' in format: yyyy-MM-ddTHH:mm:ss [Required]

count int32

Number of bars back from specified date. [Required]

Result

FieldTypeLabelDescription
name string

access string repeated

SearchReply

FieldTypeLabelDescription
result Company repeated

error Error

SearchRequest

[Example]

{

"company": ""

}

FieldTypeLabelDescription
company string

Company name [Required]

ServerTimezoneReply

FieldTypeLabelDescription
result int32

error Error

ServerTimezoneRequest

[Example]

{

"id": "demo-token-mt4"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method [Required]

SetPlacedTypeReply

FieldTypeLabelDescription
result Order repeated

error Error

SetPlacedTypeRequest

[Example]

{

"id": "demo-token-mt4",

"type": "Client"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method [Required]

type PlacedType

Placed type

SubscribeManyReply

FieldTypeLabelDescription
result string

error Error

SubscribeManyRequest

[Example]

{

"id": "demo-token-mt4",

"interval": "0"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method [Required]

symbols string repeated

Required symbols

interval int32

Minimum interval between events in milliseconds

SubscribeOrderProfitReply

FieldTypeLabelDescription
result Order repeated

error Error

SubscribeOrderProfitRequest

[Example]

{

"id": "demo-token-mt4"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method [Required]

SubscribeOrderUpdateReply

FieldTypeLabelDescription
result Order repeated

error Error

SubscribeOrderUpdateRequest

[Example]

{

"id": "demo-token-mt4"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method [Required]

SubscribeQuoteHistoryReply

FieldTypeLabelDescription
result string

error Error

SubscribeQuoteHistoryRequest

[Example]

{

"id": "demo-token-mt4"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method [Required]

SubscribeReply

FieldTypeLabelDescription
result string

error Error

SubscribeRequest

[Example]

{

"id": "demo-token-mt4",

"symbol": "EURUSD",

"interval": "0"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method [Required]

symbol string

Symbol [Required]

interval int32

Minimum interval between events in milliseconds

SubscribeTickValueReply

FieldTypeLabelDescription
result string

error Error

SubscribeTickValueRequest

[Example]

{

"id": "demo-token-mt4",

"symbol": "EURUSD",

"interval": "0"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method [Required]

symbol string

Symbol [Required]

interval int32

Minimum interval between events in milliseconds

SymbolInfo

Instrument parameters.

FieldTypeLabelDescription
Execution Execution

Execution type.

StopsLevel int32

Stop level in points.

Digits int32

Count of digits after decimal point in the symbol prices.

Point double

Point size in the quote currency.

SwapLong double

Swap of the long position.

SwapShort double

Swap of the short position.

Spread int32

Spread value in pips.QuoteClient QC

FreezeLevel int32

Order freeze level in points. If the execution price lies within the range defined by the freeze level, the order cannot be modified, cancelled or closed.

MarginCurrency string

Currency of margin requirments.

ProfitMode ProfitMode

Profit calculation mode.

MarginMode MarginMode

Margin calculation mode.

ContractSize double

Contract size.

Currency string

Currency.

MarginDivider double

Margin divider.

Ex SymbolInfoEx

Execution type.

Code int32

Internal code.

SymbolInfoEx

Security config

FieldTypeLabelDescription
symbol int32 repeated

name

description string

description

source string

synonym

currency string

currency

type int32

security group (see ConSymbolGroup)

digits int32

security precision

trade int32

trade mode

background_color int32

background color

count int32

symbols index

count_original int32

symbols index in market watch

external_unused int32 repeated

internal

realtime int32

allow real time quotes

starting int32

trades starting date (UNIX time)

expiration int32

trades end date (UNIX time)

sessions ConSessions repeated

quote and trade sessions

profit_mode int32

profit calculation mode

profit_reserved int32

reserved

filter int32

filter value

filter_counter int32

filtration parameter

filter_limit double

max. permissible deviation from last quote (percents)

filter_smoothing int32

smoothing

filter_reserved int32

reserved

logging int32

enable to log quotes

spread int32

spread

spread_balance int32

spread balance

exemode int32

execution mode

swap_enable int32

enable swaps

swap_type int32

swap type

swap_long double

swaps values for long and short postions

swap_short double

swaps values for long and short postions

swap_rollover3days int32

triple rollover day: 0-Monday, 1-Tuesday ... 4-Friday

contract_size double

contract size

tick_value double

one tick value

tick_size double

one tick size

stops_level int32

stops deviation value

gtc_pendings int32

GTC mode ORDERS_DAILY, ORDERS_GTC, ORDERS_DAILY_NO_STOPS

margin_mode int32

margin calculation mode

margin_initial double

initial margin

margin_maintenance double

margin maintenance

margin_hedged double

hadget margin

margin_divider double

margin divider

point double

point size - (1/(10^digits)

multiply double

multiply 10^digits

bid_tickvalue double

tickvalue for bid

ask_tickvalue double

tickvalue for ask

long_only int32

allow only BUY positions

instant_max_volume int32

max. volume for Instant Execution

margin_currency string

currency of margin requirments

freeze_level int32

modification freeze level (from market price)

margin_hedged_strong int32

lock open checking mode

value_date int32

value date for this security

quotes_delay int32

quotes delay

swap_openprice int32

use open price at swaps calculation in SWAP_BY_INTEREST mode

unused int32 repeated

reserved

SymbolParams

Information about symbol and his group.

FieldTypeLabelDescription
SymbolName string

Symbol name

Symbol SymbolInfo

Symbol name

Group ConSymbolGroup

Symbol group

GroupParams ConGroupSec

Symbol group parameters

SymbolParamsManyReply

FieldTypeLabelDescription
result SymbolParams repeated

error Error

SymbolParamsManyRequest

[Example]

{

"id": "demo-token-mt4"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method [Required]

symbols string repeated

Required symbols

SymbolParamsReply

FieldTypeLabelDescription
result SymbolParams

error Error

SymbolParamsRequest

[Example]

{

"id": "demo-token-mt4",

"symbol": "EURUSD"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method [Required]

symbol string

Symbol [Required]

SymbolTickValue

Tick value update

FieldTypeLabelDescription
Symbol string

Symbol

TickValue double

Tick value

SymbolsReply

FieldTypeLabelDescription
result string repeated

error Error

SymbolsRequest

[Example]

{

"id": "demo-token-mt4"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method [Required]

TickValueWithSize

Tick value with tick size

FieldTypeLabelDescription
TickValue double

Tick value

TickSize double

Tick size

Symbol string

Symbol

TickValueWithSizeReply

FieldTypeLabelDescription
result TickValueWithSize repeated

error Error

TickValueWithSizeRequest

[Example]

{

"id": "demo-token-mt5"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method [Required]

symbol string repeated

Symbol

UnSubscribeManyReply

FieldTypeLabelDescription
result string

error Error

UnSubscribeManyRequest

[Example]

{

"id": "demo-token-mt4"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method [Required]

symbols string repeated

Required symbols [Required]

UnSubscribeReply

FieldTypeLabelDescription
result string

error Error

UnSubscribeRequest

[Example]

{

"id": "demo-token-mt4",

"symbol": "EURUSD"

}

FieldTypeLabelDescription
id string

Token returned by 'Connect' method [Required]

symbol string

Symbol [Required]

AccountType

Real, contest, demo

NameNumberDescription
AccountType_Real 0

AccountType_Contest 1

AccountType_Demo 2

ErrorCode

NameNumberDescription
INTERNAL_ERROR 0

COMMON_ERROR 2

INVALID_PARAM 3

SERVER_BUSY 4

OLD_VERSION 5

NO_CONNECT 6

NOT_ENOUGH_RIGHTS 7

TOO_FREQUENT_REQUEST 8

NO_CONNECTION 10

SERVICE_NOT_AVAILABLE 11

TOO_FREQUENT_REQUESTS 12

SECRET_KEY_REQUIRED 13

INVALID_ONETIME_PASSWORD 14

ACCOUNT_DISABLED 64

INVALID_ACCOUNT 65

PUBLIC_KEY_NOT_FOUND 66

TRADE_TIMEOUT 128

INVALID_PRICES 129

INVALID_SL_TP 130

INVALID_VOLUME 131

MARKET_CLOSED 132

TRADE_DISABLED 133

NOT_MONEY 134

PRICE_CHANGED 135

OFF_QUOTES 136

BROKER_BUSY 137

REQUOTE 138

ORDER_LOCKED 139

LONG_POS_ALLOWED 140

TOO_MANY_REQUESTS 141

ORDER_ACCEPTED 142

ORDER_IN_PROCESS 143

REQUEST_CANCELLED 144

MODIFICATIONS_DENIED 145

TRADE_CONTEXT_BUSY 146

EXPIRATION_DISABLED 147

TOO_MANY_ORDERS 148

HEDGE_PROHIBITED 149

RPROHIBITED_FIFO 150

INVALID_TOKEN 256

Custom error codes

INVALID_SYMBOL 257

INVALID_TICKET 258

SAME_PARAMS 259

CONNECT_ERROR 260

TIMEOUT 261

Execution

Execution type.

NameNumberDescription
Execution_Request 0

Execution by request.

Execution_Instant 1

Instant execution.

Execution_Market 2

Market execition.

LogEventLevel

NameNumberDescription
LogEventLevel_Verbose 0

LogEventLevel_Debug 1

LogEventLevel_Information 2

LogEventLevel_Warning 3

LogEventLevel_Error 4

LogEventLevel_Fatal 5

MarginMode

Margin types.

NameNumberDescription
MarginMode_Forex 0

Forex.

MarginMode_CFD 1

CFD.

MarginMode_Futures 2

Futures.

MarginMode_CfdIndex 3

CFD Index.

MarginMode_CfdLeverage 4

CFD Leverage.

Op

Operation type for the OrderSend() function.

NameNumberDescription
Op_Buy 0

Buying position.

Op_Sell 1

Selling position.

Op_BuyLimit 2

Buy limit pending position.

Op_SellLimit 3

Sell limit pending position.

Op_BuyStop 4

Buy stop pending position.

Op_SellStop 5

Sell stop pending position.

Op_Balance 6

Balance position.

Op_Credit 7

Credit position.

PlacedType

Placed manually or ByExpert

NameNumberDescription
PlacedType_Client 0

PlacedType_Expert 1

PlacedType_Dealer 2

PlacedType_Signal 3

PlacedType_Gateway 4

PlacedType_Mobile 5

PlacedType_Web 6

PlacedType_Api 7

PlacedType_Default 8

In this case API uses OrderClient.PlaccedType field during OrderSend

ProfitMode

Profit types.

NameNumberDescription
ProfitMode_Forex 0

Forex.

ProfitMode_CFD 1

CFD.

ProfitMode_Futures 2

Futures

ProxyTypes

Specifies the type of proxy servers that an instance of the ProxySocket class can use.

NameNumberDescription
ProxyTypes_None 0

No proxy server; the ProxySocket object behaves exactly like an ordinary Socket object.

ProxyTypes_Https 1

A HTTPS (CONNECT) proxy server.

ProxyTypes_Socks4 2

A SOCKS4[A] proxy server.

ProxyTypes_Socks5 3

A SOCKS5 proxy server.

Timeframe

Timeframe for quote history download.

NameNumberDescription
TIMEFRAME_M0 0

Timeframe_M1 1

1 minute.

Timeframe_M5 5

5 minutes.

Timeframe_M15 15

15 minutes.

Timeframe_M30 30

30 minutes.

Timeframe_H1 60

1 hour.

Timeframe_H4 240

4 hour.

Timeframe_D1 1440

Daily.

Timeframe_W1 10080

Weekly.

Timeframe_MN1 43200

Monthly.

UpdateAction

Type of update action for OrderUpdate event.

NameNumberDescription
UpdateAction_PositionOpen 0

New postion.

UpdateAction_PositionClose 1

Position closed full or partially.

UpdateAction_PositionModify 2

Position was modified.

UpdateAction_PendingOpen 3

New pening order.

UpdateAction_PendingClose 4

Pending order was deleted.

UpdateAction_PendingModify 5

Pending order was modified.

UpdateAction_PendingFill 6

Pending order was filled.

UpdateAction_Balance 7

Balance update(deposit, withdraw).

UpdateAction_Credit 8

Credit update.

Connection

Method NameRequest TypeResponse TypeDescription
Connect ConnectRequest ConnectReply

Connect to account with user, password, host, port. [Example] { "user": "500476959", "password": "ehj4bod", "host": "mt4-demo.roboforex.com", "port": "443" }

ConnectProxy ConnectProxyRequest ConnectProxyReply

Connect to account with user, password, host, port. [Example] { "user": "500476959", "password": "ehj4bod", "host": "mt4-demo.roboforex.com", "port": "443", "proxyUser": "ProxyUser123", "proxyPassword": "qwerty123", "proxyHost": "65.108.126.217", "proxyPort": "1080", "proxyType": "Socks5" }

CheckConnect CheckConnectRequest CheckConnectReply

Check connection state and reconnect if connection lost [Example] { "id": "demo-token-mt4" }

Disconnect DisconnectRequest DisconnectReply

Disconnect from account [Example] { "id": "demo-token-mt4" }

MT4

Method NameRequest TypeResponse TypeDescription
AccountSummary AccountSummaryRequest AccountSummaryReply

Balance, Equity, Currency, FreeMargin, Margin, MarginLevel, Profit, Leverage, Credit [Example] { "id": "demo-token-mt4" }

Groups GroupsRequest GroupsReply

Full infromation about symbol groups [Example] { "id": "demo-token-mt4" }

Quote QuoteRequest QuoteReply

Get quote [Example] { "id": "demo-token-mt4", "symbol": "EURUSD" }

GetQuoteMany GetQuoteManyRequest GetQuoteManyReply

Latest quote for the specified symbol [Example] { "id": "demo-token-mt5", "msNotOlder": "0" }

OpenedOrders OpenedOrdersRequest OpenedOrdersReply

List of opened orders [Example] { "id": "demo-token-mt4" }

Symbols SymbolsRequest SymbolsReply

List of symbols. [Example] { "id": "demo-token-mt4" }

SymbolParams SymbolParamsRequest SymbolParamsReply

Full infromation about symbol and his group [Example] { "id": "demo-token-mt4", "symbol": "EURUSD" }

ServerTimezone ServerTimezoneRequest ServerTimezoneReply

Server timezone. [Example] { "id": "demo-token-mt4" }

SymbolParamsMany SymbolParamsManyRequest SymbolParamsManyReply

Full infromation about symbols [Example] { "id": "demo-token-mt4" }

OpenedOrder OpenedOrderRequest OpenedOrderReply

List of opened orders [Example] { "id": "demo-token-mt4", "ticket": "0" }

OrderHistory OrderHistoryRequest OrderHistoryReply

Order history [Example] { "id": "demo-token-mt4", "from": "2022-01-01T00:00:00", "to": "2023-06-01T00:00:00" }

QuoteHistory QuoteHistoryRequest QuoteHistoryReply

Price history. [Example] { "id": "demo-token-mt4", "symbol": "EURUSD", "timeframe": "D1", "from": "2022-10-01T00:00:00", "count": "10" }

QuoteHistoryMany QuoteHistoryManyRequest QuoteHistoryManyReply

Price history. [Example] { "id": "demo-token-mt4", "timeframe": "D1", "from": "2022-10-01T00:00:00", "count": "10" }

ClosedOrders ClosedOrdersRequest ClosedOrdersReply

Last 10 orders that were closed during current session [Example] { "id": "demo-token-mt4" }

RequestQuoteHistory RequestQuoteHistoryRequest RequestQuoteHistoryReply

Request price history and get result via /events socket connection [Example] { "id": "demo-token-mt4", "symbol": "EURUSD", "timeframe": "D1", "from": "2022-10-01T00:00:00", "count": "10" }

SetPlacedType SetPlacedTypeRequest SetPlacedTypeReply

Subscribe for order profit updates and get results via /events socket connection [Example] { "id": "demo-token-mt4", "type": "Client" }

IsInvestor IsInvestorRequest IsInvestorReply

Check investor mode. [Example] { "id": "demo-token-mt4" }

TickValueWithSize TickValueWithSizeRequest TickValueWithSizeReply

Tick value with size. [Example] { "id": "demo-token-mt5" }

Service

Method NameRequest TypeResponse TypeDescription
Ping PingRequest PingReply

Simple test without parameters

PingHost PingHostRequest PingHostReply

Estimate time to connect to speciffied server and port in milliseconds [Example] { "host": "mt4-demo.roboforex.com", "port": "443" }

PingHostMany PingHostManyRequest PingHostManyReply

Estimate time to connect to speciffied server and port in milliseconds

GetLogs GetLogsRequest GetLogsReply

Logs for specified token [Example] { "id": "demo-token-mt4" }

GetLogsByUser GetLogsByUserRequest GetLogsByUserReply

Logs for specified token [Example] { "user": "500476959", "password": "ehj4bod" }

MemorySnapshot MemorySnapshotRequest MemorySnapshotReply

Memory snapshot

Search SearchRequest SearchReply

Broker search by company name [Example] { "company": "" }

GetClients GetClientsRequest GetClientsReply

Return all active with connection state

MemoryUsage MemoryUsageRequest MemoryUsageReply

Memory usage details

Streams

Method NameRequest TypeResponse TypeDescription
OnOrderUpdate OnOrderUpdateRequest OnOrderUpdateReply stream

All trading activity on accont. [Example] { "id": "demo-token-mt4" }

OnQuote OnQuoteRequest OnQuoteReply stream

Real time quotes. [Example] { "id": "demo-token-mt4" }

OnTickValue OnTickValueRequest OnTickValueReply stream

Real time quotes. [Example] { "id": "demo-token-mt4" }

OnOrderProfit OnOrderProfitRequest OnOrderProfitReply stream

Orders profits updates. [Example] { "id": "demo-token-mt4" } Quote history . [Example] { "id": "demo-token-mt4" } rpc OnQuoteHistory (OnQuoteHistoryRequest) returns (OnQuoteHistoryReply); On disconnect event. [Example] { "id": "demo-token-mt4" } rpc OnDisconnect (OnDisconnectRequest) returns (OnDisconnectReply);

Subscriptions

Method NameRequest TypeResponse TypeDescription
Subscribe SubscribeRequest SubscribeReply

Subscribe symbol for real time quotes and get results via /events socket connection [Example] { "id": "demo-token-mt4", "symbol": "EURUSD", "interval": "0" }

SubscribeMany SubscribeManyRequest SubscribeManyReply

Subscribe symbosl for real time quotes and get results via /events socket connection [Example] { "id": "demo-token-mt4", "interval": "0" }

UnSubscribe UnSubscribeRequest UnSubscribeReply

Unsubscribe symbol for real time quotes and get results via /events socket connection [Example] { "id": "demo-token-mt4", "symbol": "EURUSD" }

UnSubscribeMany UnSubscribeManyRequest UnSubscribeManyReply

UnSubscribe symbosls for real time quotes and get results via /events socket connection [Example] { "id": "demo-token-mt4" }

SubscribeOrderProfit SubscribeOrderProfitRequest SubscribeOrderProfitReply

Subscribe for order profit updates and get results via /events socket connection [Example] { "id": "demo-token-mt4" }

SubscribeTickValue SubscribeTickValueRequest SubscribeTickValueReply

Subscribe symbol for tick value updates [Example] { "id": "demo-token-mt4", "symbol": "EURUSD", "interval": "0" }

SubscribeOrderUpdate SubscribeOrderUpdateRequest SubscribeOrderUpdateReply

Subscribe symbol for tick value updates [Example] { "id": "demo-token-mt4" }

SubscribeQuoteHistory SubscribeQuoteHistoryRequest SubscribeQuoteHistoryReply

Subscribe quote history [Example] { "id": "demo-token-mt4" }

Trading

Method NameRequest TypeResponse TypeDescription
OrderSend OrderSendRequest OrderSendReply

Send market or pending order [Example] { "id": "demo-token-mt4", "symbol": "EURUSD", "operation": "Buy", "volume": "0.1", "price": "0", "slippage": "0", "stoploss": "0", "takeprofit": "0", "magic": "0", "placedType": "Client" }

OrderModify OrderModifyRequest OrderModifyReply

Modify market or pending order [Example] { "id": "demo-token-mt4", "ticket": "0", "stoploss": "0", "takeprofit": "0", "price": "0" }

OrderCloseBy OrderCloseByRequest OrderCloseByReply

Close market order with opposite market order [Example] { "id": "demo-token-mt4", "ticket1": "0", "ticket2": "0" }

OrderDelete OrderDeleteRequest OrderDeleteReply

Delete pending order [Example] { "id": "demo-token-mt4", "ticket": "0" }

OrderClose OrderCloseRequest OrderCloseReply

Close market order with opposite market order [Example] { "id": "demo-token-mt4", "ticket": "0", "lots": "0", "price": "0", "slippage": "0" }

Scalar Value Types

.proto TypeNotesC++JavaPythonGoC#PHPRuby
double double double float float64 double float Float
float float float float float32 float float Float
int32 Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. int32 int int int32 int integer Bignum or Fixnum (as required)
int64 Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. int64 long int/long int64 long integer/string Bignum
uint32 Uses variable-length encoding. uint32 int int/long uint32 uint integer Bignum or Fixnum (as required)
uint64 Uses variable-length encoding. uint64 long int/long uint64 ulong integer/string Bignum or Fixnum (as required)
sint32 Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. int32 int int int32 int integer Bignum or Fixnum (as required)
sint64 Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. int64 long int/long int64 long integer/string Bignum
fixed32 Always four bytes. More efficient than uint32 if values are often greater than 2^28. uint32 int int uint32 uint integer Bignum or Fixnum (as required)
fixed64 Always eight bytes. More efficient than uint64 if values are often greater than 2^56. uint64 long int/long uint64 ulong integer/string Bignum
sfixed32 Always four bytes. int32 int int int32 int integer Bignum or Fixnum (as required)
sfixed64 Always eight bytes. int64 long int/long int64 long integer/string Bignum
bool bool boolean boolean bool bool boolean TrueClass/FalseClass
string A string must always contain UTF-8 encoded or 7-bit ASCII text. string String str/unicode string string string String (UTF-8)
bytes May contain any arbitrary sequence of bytes. string ByteString str []byte ByteString string String (ASCII-8BIT)