Download MetaTrader 5

Deal Properties

A deal is the reflection of the fact of a trade operation execution based on an order that contains a trade request. Each trade is described by properties that allow to obtain information about it. In order to read values of properties, functions of the HistoryDealGet...() type are used, that return values from corresponding enumerations.

For the function HistoryDealGetInteger()

ENUM_DEAL_PROPERTY_INTEGER

Identifier

Description

Type

DEAL_TICKET

Deal ticket. Unique number assigned to each deal

long

DEAL_ORDER

Deal order number

long

DEAL_TIME

Deal time

datetime

DEAL_TIME_MSC

The time of a deal execution in milliseconds since 01.01.1970

long

DEAL_TYPE

Deal type

ENUM_DEAL_TYPE

DEAL_ENTRY

Deal entry - entry in, entry out, reverse

ENUM_DEAL_ENTRY

DEAL_MAGIC

Deal magic number (see ORDER_MAGIC)

long

DEAL_POSITION_ID

Identifier of a position, in the opening, modification or closing of which this deal took part. Each position has a unique identifier that is assigned to all deals executed for the symbol during the entire lifetime of the position.

long

For the function HistoryDealGetDouble()

ENUM_DEAL_PROPERTY_DOUBLE

Identifier

Description

Type

DEAL_VOLUME

Deal volume

double

DEAL_PRICE

Deal price

double

DEAL_COMMISSION

Deal commission

double

DEAL_SWAP

Cumulative swap on close

double

DEAL_PROFIT

Deal profit

double

For the function HistoryDealGetString()

ENUM_DEAL_PROPERTY_STRING

Identifier

Description

Type

DEAL_SYMBOL

Deal symbol

string

DEAL_COMMENT

Deal comment

string

DEAL_EXTERNAL_ID

Deal identifier in an external trading system (on the Exchange)

string

 

Each deal is characterized by a type, allowed values are enumerated in ENUM_DEAL_TYPE. In order to obtain information about the deal type, use the HistoryDealGetInteger() function with the DEAL_TYPE modifier.

ENUM_DEAL_TYPE

Identifier

Description

DEAL_TYPE_BUY

Buy

DEAL_TYPE_SELL

Sell

DEAL_TYPE_BALANCE

Balance

DEAL_TYPE_CREDIT

Credit

DEAL_TYPE_CHARGE

Additional charge

DEAL_TYPE_CORRECTION

Correction

DEAL_TYPE_BONUS

Bonus

DEAL_TYPE_COMMISSION

Additional commission

DEAL_TYPE_COMMISSION_DAILY

Daily commission

DEAL_TYPE_COMMISSION_MONTHLY

Monthly commission

DEAL_TYPE_COMMISSION_AGENT_DAILY

Daily agent commission

DEAL_TYPE_COMMISSION_AGENT_MONTHLY

Monthly agent commission

DEAL_TYPE_INTEREST

Interest rate

DEAL_TYPE_BUY_CANCELED

Canceled buy deal. There can be a situation when a previously executed buy deal is canceled. In this case, the type of the previously executed deal (DEAL_TYPE_BUY) is changed to DEAL_TYPE_BUY_CANCELED, and its profit/loss is zeroized. Previously obtained profit/loss is charged/withdrawn using a separated balance operation

DEAL_TYPE_SELL_CANCELED

Canceled sell deal. There can be a situation when a previously executed sell deal is canceled. In this case, the type of the previously executed deal (DEAL_TYPE_SELL) is changed to DEAL_TYPE_SELL_CANCELED, and its profit/loss is zeroized. Previously obtained profit/loss is charged/withdrawn using a separated balance operation

 

Deals differ not only in their types set in ENUM_DEAL_TYPE, but also in the way they change positions. This can be a simple position opening, or accumulation of a previously opened position (market entering), position closing by an opposite deal of a corresponding volume (market exiting), or position reversing, if the opposite-direction deal covers the volume of the previously opened position.

All these situations are described by values from the ENUM_DEAL_ENTRY enumeration. In order to receive this information about a deal, use the HistoryDealGetInteger() function with the DEAL_ENTRY modifier.

ENUM_DEAL_ENTRY

Identifier

Description

DEAL_ENTRY_IN

Entry in

DEAL_ENTRY_OUT

Entry out

DEAL_ENTRY_INOUT

Reverse

DEAL_ENTRY_OUT_BY

Сlose a position by an opposite one

 

 


Updated: 2016.03.31