OpenOrder

OpenOrder - adding an open order to the server database.

Example:

{"id": 11, "type":"OpenOrder", "body": {"symbol":"EURUSD.r", "type": 2, "price": 1.0,"volume": 0.01}}

Request Body Fields:

Parameter
Required
Type
Description

symbol

string

the name of the symbol by which you need to get orders

type

int

the order type, can be:

  • 0 - BUY

  • 1 - SELL

  • 2 - BUY LIMIT

  • 3 - SELL LIMIT

  • 4 - BUY STOP

  • 5 - SELL STOP

  • 6 - BUY STOP LIMIT

  • 7 - SELL STOP LIMIT

price

double nullable

order price

price_trigger

double nullable

new price of triggering for stop limit orders

volume

double

the volume of a deal in lots

sl

double nullable

the Stop Loss level of a trade

tp

double nullable

the Take Profit level of a trade

max_lost

double nullable

the amount in currency by which the stop_loss is estimated, limiting the loss on the trade to the specified amount

profit_factor

double nullable

this ratio max_profit/max_lost is used to calculate take_profit if max_lost is specified and max_profit is not specified.

max_profit

double nullable

the amount in the currency for which the take_profit is calculated, limiting the profit on the trade to the specified amount

deviation

int nullable

deviation in %

comment

string nullable

comment

time_out

int64

time in milliseconds that should be wait for async requests results (it can be from 109 msec to 7 sec; if you set time_out <109 msec, it will be 109 msec; if you set time_out > 7 sec, it will be 7 sec)

Responce Type - OpenOrder.

Responce Body Fields:

Parameter
Always returned
Type
Description

result

int

result of operation Meta Trader server

ticket

unsigned long long

the ticket of new opened order on Meta Trader Server

price

double

price of order execution, in case of pending, limit, stop orders price is 0

time

int64

time of order execution, in case of pending, limit, stop orders time is 0

symbol

string

a string with the symbol name

type

int

type of the order

action

int

type of action to which the trade request belongs

price_order

double

the price of an order in a trade request

price_trigger

double

the price, at which a Limit order is placed when the Stop Limit order triggers

tp

double

the Take Profit level

sl

double

the Stop Loss level

volume

double

the Volume of opened trade requests

Example:

Last updated