Create a Market Range Close Order (Using Price and Distance)

A market range close order closes a position at the available market rate in case this rate is in the range specified in the command.

Please note that close, stop and limit orders must be permitted for the account in order to be used (see also core.host:execute("getTradingProperty", ...) for details about permissions).

Valuemap field

Datatype

Description

Command

string

The command. Must be CreateOrder.

OrderType

string

The type of the order. Must be CR.

OfferID

string

The identifier of the instrument the order should be placed for. The value must be obtained from the "Offers" table, the OfferID column.

AcctID

string

The identifier of the account the order should be placed for. The value must be obtained from the "Accounts" table, the AccountID column.

Please note that the account identifier may not necessarily be equal to the account name which is shown in the Trading Station application.

TradeID

string

The identifier of the trade to be closed. The value must be obtained from the "Trades" table, the TradeID column. In case the order is net quantity order, this value is ignored.

BuySell

string

The order direction.

The value must be B - for buy orders and S - for sell orders. The order direction must be opposite to the direction of the order which was used to create the position (see the BS column of the trade).

Quantity

number

The quantity of the instrument to be bought or sold. The quantity is expressed in contracts and must be divisible by the value of the lot size (see baseUnitSize trading option in the following call: core.host:execute("getTradingProperty", ...)).

The quantity must be less than or equal to the size of the position (see the Lot column of the trade).

Do not fill this value for the net quantity order.

NetQtyFlag

string

The net quantity flag. The value can be either y or n. The value is optional. The default value is n.

An close order in the netting mode closes all positions which exist at the moment of the order filling and which are created for the order account and order instrument in the direction (see BuySell) opposite to the direction of the order.

Rate

number

The center price of the price range in which the order can be filled.

AtMarket

number

The distance from the rate specified by the Rate field to the minimum and maximum prices of the range in which the order can be filled.

The value must be expressed in pips.

For example, if the pip of the instrument is 0.01 and Rate is equal to 95.12 and the AtMarket value is 20, the range will be from 94.92 to 95.32.

GTC

string

Time-In-Force value.

Can be IOC (Immediate-or-Cancel) or FOK (Fill-or-Kill).

The value is optional.

Market orders are IOC orders by default.

CustomID

string

The custom identifier of the order. This value will be populated into all order-related QTXT columns of the following tables: "Orders", "Trades", and "Closed Trades".

back