- 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)
Checking symbol status
Earlier we looked at several functions related to the status of a symbol. Recall that SymbolExist is used to check for the existence of a symbol, and SymbolSelect is used to check for inclusion or exclusion from the Market Watch list. Among the properties of the symbol, there are several flags similar in purpose, the use of which has both pluses and minuses compared to the above functions.
In particular, the SYMBOL_SELECT property allows you to find out if the specified symbol is selected in Market Watch, while the SymbolSelect function changes this property.
The SymbolExist function, unlike the similar SYMBOL_EXIST property, additionally populates the output variable with an indication that the symbol is a user-defined one. When querying properties, it would be necessary to analyze these two attributes separately, since the attribute of the custom symbol is stored in another property, SYMBOL_CUSTOM. However, in some cases, the program may need only one property, and then the possibility of a separate query becomes a plus.
All flags are boolean values obtained through the SymbolInfoInteger function.
Identifier |
Description |
---|---|
SYMBOL_EXIST |
Indicates that a symbol with the given name exists |
SYMBOL_SELECT |
Indicates that the symbol is selected in Market Watch |
SYMBOL_VISIBLE |
Indicates that the specified symbol is displayed in Market Watch |
Of particular interest is SYMBOL_VISIBLE. The fact is that some symbols (as a rule, these are cross rates that are necessary for calculating margin requirements and profit in the deposit currency) are selected in Market Watch automatically and are not displayed in the list visible to the user. Such symbols must be explicitly chosen (by the user or programmatically) to be displayed. Thus, it is the SYMBOL_VISIBLE property that allows you to determine whether a symbol is visible in the window: it can be equal to false for some elements of the list, obtained using a pair of functions SymbolsTotal and SymbolName with the selected parameter equal to true.
Consider a simple script (SymbolInvisible.mq5), which searches the terminal for implicitly selected symbols, that is, those that are not displayed in the Market Watch (SYMBOL_VISIBLE is reset) while SYMBOL_SELECT for them is equal to true.
#define PUSH(A,V) (A[ArrayResize(A, ArraySize(A) + 1) - 1] = V)
|
Try compiling and running the script on different accounts. The situation when a symbol is implicitly selected is not always encountered. For example, if in Market Watch tickers of Russian blue chips that are quoted in rubles are selected, and the trading account is in a different currency (for example, dollars or euros, but not rubles), then the USDRUB symbol will be automatically selected. Of course, this assumes that it has not been previously added to the Market Watch explicitly. Then we get the following result in the log:
Symbols: total=50681, selected=49, implicit=1
|