HookTradeRequestClose
HookTradeRequestClose¶
Adds a validated trade request to the processing queue.
virtual int HookTradeRequestClose(
const TradeRecord& trade, // reference to the trade request object
const GroupRecord& group, // reference to the group configuration object
const SymbolRecord& symbol, // reference to the symbol configuration object
const AccountRecord& user, // reference to the account object
const MarginLevel& margin, // reference to the margin state
TradeDiffRecord& trade_dif // [in/out] reference to the trade changes to apply after processing the request (see below)
);
Parameters¶
-
trade
[in]reference to the trade request object. -
group
[in]Reference to the client group configuration for which the request is processed. -
symbol
[in]Reference to the symbol configuration for which the request is processed. -
user
[in]Reference to the current account associated with the request. -
margin
[in]Reference to the current account associated with the request. -
trade_dif
[in/out]Reference to the new trade order object to create as a result of processing the request. It is populated only for requests that create a new order (see below). The order is ready to be added to the trading database, with every field except the ticket populated. The order is created and assigned a ticket only after the hook returnsMT_RET_OK.
Return Value¶
- If
RET_OKis returned, the operation is confirmed. - Otherwise, the request is rejected with the corresponding code.
Notes¶
Depending on the trade request type, the hook can: - modify the request, - reject the request, - accept the request without changes.
trade_dif is populated only for the following request types (EnTradeActions):
- TA_REQUEST
- TA_INSTANT
- TA_MARKET
- TA_EXCHANGE
- TA_PENDING
- TA_DEALER_POS_EXECUTE
- TA_ACTIVATE_SL
- TA_ACTIVATE_TP
- TA_STOPOUT_POSITION
Changes to trade_dif are not applied for other request types.