- Getting available symbols and Market Watch lists
- Editing the Market Watch list
- Checking if a symbol exists
- Checking the symbol data relevance
- Getting the last tick of a symbol
- Schedules of trading and quoting sessions
- Symbol margin rates
- Overview of functions for getting symbol properties
- Checking symbol status
- Price type for building symbol charts
- Base, quote, and margin currencies of the instrument
- Price representation accuracy and change steps
- Permitted volumes of trading operations
- Trading permission
- Symbol trading conditions and order execution modes
- Margin requirements
- Pending order expiration rules
- Spreads and order distance from the current price
- Getting swap sizes
- Current market information (tick)
- Descriptive symbol properties
- Depth of Market
- Custom symbol properties
- Specific properties (stock exchange, derivatives, bonds)
Symbol margin rates
Among the characteristics of the symbol specification available in the MQL5 API, which we will discuss in detail in further sections, there are several characteristics related to margin requirements, which apply when opening and maintaining trading positions. Due to the fact that the terminal provides trading on different markets and different types of instruments, these requirements may vary significantly. In a generalized form, this is expressed in the application of margin correction rates that are set individually for symbols and different types of trading operations. For the user, the rates are displayed in the terminal in the Specifications window.
As we will see below, the multiplier (if applied) is multiplied by the margin value from the symbol properties. The margin ratio can be obtained programmatically using the SymbolInfoMarginRate function.
bool SymbolInfoMarginRate(const string symbol, ENUM_ORDER_TYPE orderType, double &initial, double &maintenance)
For the specified symbol and order type (ENUM_ORDER_TYPE), the function fills in passed by reference initial and maintenance parameters with initial and maintaining margin ratios, respectively. The resulting rates should be multiplied by the margin value of the corresponding type (how to request it is described in the section on margin requirements) to get the amount that will be reserved in the account when placing an order such as orderType.
The function returns true in case of successful execution.
Let's use as an example a simple script SymbolMarginRate.mq5, which outputs margin ratios for Market Watch or all available symbols, depending on the MarketWatchOnly parameter. The operation type can be specified in the OrderType parameter.
#include <MQL5Book/MqlError.mqh>
|
Below is the log.
Margin rates per symbol for ORDER_TYPE_BUY:
|
You can compare the received values with the symbol specifications in the terminal.