- LogLevel
- SetExpertMagicNumber
- SetDeviationInPoints
- SetTypeFilling
- SetTypeFillingBySymbol
- SetAsyncMode
- SetMarginMode
- OrderOpen
- OrderModify
- OrderDelete
- PositionOpen
- PositionModify
- PositionClose
- PositionClosePartial
- PositionCloseBy
- Buy
- Sell
- BuyLimit
- BuyStop
- SellLimit
- SellStop
- Request
- RequestAction
- RequestActionDescription
- RequestMagic
- RequestOrder
- RequestSymbol
- RequestVolume
- RequestPrice
- RequestStopLimit
- RequestSL
- RequestTP
- RequestDeviation
- RequestType
- RequestTypeDescription
- RequestTypeFilling
- RequestTypeFillingDescription
- RequestTypeTime
- RequestTypeTimeDescription
- RequestExpiration
- RequestComment
- RequestPosition
- RequestPositionBy
- Result
- ResultRetcode
- ResultRetcodeDescription
- ResultDeal
- ResultOrder
- ResultVolume
- ResultPrice
- ResultBid
- ResultAsk
- ResultComment
- CheckResult
- CheckResultRetcode
- CheckResultRetcodeDescription
- CheckResultBalance
- CheckResultEquity
- CheckResultProfit
- CheckResultMargin
- CheckResultMarginFree
- CheckResultMarginLevel
- CheckResultComment
- PrintRequest
- PrintResult
- FormatRequest
- FormatRequestResult
CTrade
CTrade is a class for easy access to the trade functions.
Description
CTrade class provides easy access to the trade functions.
Declaration
class CTrade : public CObject |
Title
#include <Trade\Trade.mqh> |
Inheritance hierarchyCTrade Direct descendants CExpertTrade |
Class methods by groups
Setting parameters |
|
---|---|
Sets logging level |
|
Sets the expert ID |
|
Sets the allowed deviation |
|
Sets filling type of the order |
|
Sets filling type of the order according to the specified symbol settings |
|
Sets asynchronous mode for trade operations |
|
Sets margin calculation mode in accordance with the current account settings |
|
Operations with orders |
|
Places a pending order with specified parameters |
|
Modifies the pending order parameters |
|
Deletes a pending order |
|
Operations with positions |
|
Opens a position with specified parameters |
|
Modifies position parameters by the specified symbol or position ticket |
|
Closes a position for the specified symbol |
|
Partially closes a position on a specified symbol or having a specified ticket |
|
Closes a position with the specified ticket by an opposite position |
|
Additional methods |
|
Opens a long position with specified parameters |
|
Opens a short position with specified parameters |
|
Places a pending order of the Buy Limit type with specified parameters |
|
Places a pending order of the Buy Stop type with specified parameters |
|
Places a pending order of the Sell Limit type with specified parameters |
|
Places a pending order of the Sell Stop type with specified parameters |
|
Access to the last request parameters |
|
Gets the copy of the last request structure |
|
Gets the trade operation type |
|
Gets the trade operation type as string |
|
Gets the magic number of the Expert Advisor |
|
Gets the order ticket used in the last request |
|
Gets the name of the symbol used in the last request |
|
Gets the trade volume (in lots) used in the last request |
|
Gets the price used in the last request |
|
Gets the price of pending order of Stop Limit type used in the last request |
|
Gets the Stop Loss price of the order used in the last request |
|
Gets the Take Profit price of the order used in the last request |
|
Gets the maximum allowable price deviation of the order used in the last request |
|
Gets the type of the order used in the last request |
|
Gets the type of the order (as string) used in the last request |
|
Gets the filling type of the order used in the last request |
|
Gets the filling type of the order (as string) used in the last request |
|
Gets the validity period of the order used in the last request |
|
Gets the validity period of the order (as string) used in the last request |
|
Gets the expiration time of the order used in the last request |
|
Gets the comment of the order used in the last request |
|
Gets position ticket |
|
Gets opposite position ticket |
|
Access to the last request checking results |
|
Gets the copy of the structure of the last request check result. |
|
Gets the value of the retcode field of MqlTradeCheckResult type, filled while checking the request correctness |
|
Gets the string description of the retcode field of MqlTradeCheckResult type, filled while checking the request correctness |
|
Gets the value of the balance field of MqlTradeCheckResult type, filled while checking the request correctness |
|
Gets the value of the equity field of MqlTradeCheckResult type, filled while checking the request correctness |
|
Gets the value of the floating profit after executing a trading operation. |
|
Gets the value of the margin field of MqlTradeCheckResult type, filled while checking the request correctness |
|
Gets the value of the margin_free field of MqlTradeCheckResult type, filled while checking the request correctness |
|
Gets the value of the margin_level field of MqlTradeCheckResult type, filled while checking the request correctness |
|
Gets the value of the comment field of MqlTradeCheckResult type, filled while checking the request correctness |
|
Access to the last request execution results |
|
Gets the copy of the structure of the last request result |
|
Gets the code of request result |
|
Gets the code of request result as a string |
|
Gets the deal ticket |
|
Gets the order ticket |
|
Gets the volume of deal or order |
|
Gets the price, confirmed by broker |
|
Gets the current bid price (the requote) |
|
Gets the current ask price (the requote) |
|
Gets the broker comment |
|
Auxiliary methods |
|
Prints the last request parameters into journal |
|
Prints the results of the last request into journal |
|
Prepares the formatted string with last request parameters |
|
Prepares the formatted string with results of the last request execution |