2.7FXB.Order object

The framework uses the FXB.Order object to represent all of the following, because of their similarities:

Pending/working orders

Open trades

Historic closed trades

Historic, cancelled orders

Credit movements on the account (such as deposits and withdrawals)

Some properties within the object are only applicable depending on its context (its orderType). For example, credit movements only have an orderId, reference, orderType, openTime, closeTime (same as openTime), profit, and comment (if the platform supports it). Properties such as instrumentId or volume are obviously inapplicable on a credit movement, and not defined.

Property

Type

Description

orderId

Text

ID of the order (usually but not necessarily numeric)

reference

Text

Client-facing reference number for the order

orderType

FXB.OrderTypes enumeration

Type of order (or credit movement etc)

instrumentId

Text

ID of the FXB.Instrument

volume

Number (trading volume)

Trading volume - always specified in cash/units terms, such as 10000, not lots such as 0.10

openPrice

Number

Opening price of the order

openTime

Integer (millisecond time value)

Open/creation time

sl

Number

Current stop-loss price on the order, or zero if none

tp

Number

Current take-profit price on the order, or zero if none

trail

Number

Current trailing-stop distance on the order, as a price amount such as 0.0020, or zero. Requires the account to offer trailing stops.

comment

Text

Textual comment on the order. Requires the account to support order comments.

magicNumber

Integer

MT4/5-style "magic number" on the order. Requires the account to support magic numbers.

profit

Number

Profit on the order (zero for pending or cancelled orders)

swap

Number

Accumulated rollover/interest/swap on the order

commission

Number

Commission charged on the order

closeTime

Integer (millisecond time value)

Close/cancellation time of the order. Zero for open trades and pending orders.

closePrice

Number

Current or close price. For closed trades and cancelled orders: the final price. For open trades: the opposite side of the spread. For pending orders: the same side of the spread (e.g. the bid price on a pending sell-limit).