Unisciti alla nostra fan page
SymbolsLib - script per MetaTrader 4
- Visualizzazioni:
- 28067
- Valutazioni:
- Pubblicato:
- 2009.10.30 16:29
- Aggiornato:
- 2014.04.21 14:54
- Hai bisogno di un robot o indicatore basato su questo codice? Ordinalo su Freelance Vai a Freelance
ATTENTION: Undocummented solution, it may not work in the other versions of MetaTrader
Among the standard MQL4 functions there is very useful function MarketInfo()
which returns the various information on the financial instruments
listed in"Market Watch" window. However, in some cases, the additional
information about the instruments is need. For example, the list of the
symbols listed in "Market Watch" window, their order in the list, the
full description of the instrument, or full list of the financial
instruments provided by broker.
It has been discovered, that during any changes in the "Market
Watch" window, the client terminal opens and modifies the binary file symbols.sel
in the history
folder. Analysis of the structure of this file shows that the terminal
records for the every instrument of the "Market Watch" window has a
128-byte
structure. The first 12 bytes allocated for the symbol name, the other
bytes are filled with the other information: Bid, Ask, High, Low, etc.
The instument order is the same as in "Market Watch" window. And if the
user changes
the ordering of symbols, the changes are immediately
reflected in the file.
Note: the first 4 bytes are reserved for MQL version and they are constant
However, the information contained in the file symbols.sel may not be complete. Especially if the "Market Watch" window has no all listed financial instruments. Therefore, if you need a complete list of available symbols, provided by broker, then this method will not work. The good idea based on analysis of file symbols.raw has been proposed by kaisa. However, its implementation using the API functions is not the best solution.
This problem can be solved and the "pure" MQL. Analysis of the structure of this file shows that each symbol is recorded in a file in the binary structure of the size of 1936 bytes. The first 12 bytes are for the short symbol name, and the next of 64-bytes block contain an extended symbol description.
On the basis of the analysis proposed here it has been developed library that contains a several functions for more information about financial instruments loaded in the client terminal.
Here is a list of the exported functions:
SymbolsList- returns the symbol list (listed in "Market Watch" or all of the symbols).
SymbolDescription- returns the detailed name description of the specified financial symbol.
SymbolType - returns a type of the financial instrument.
An example of the library usage is presented in the script SymbolsSample.mq4.
Tradotto dal russo da MetaQuotes Ltd.
Codice originale https://www.mql5.com/ru/code/9102
This script will allow you to use the information about the market watch and the client terminal settings. It can be very useful to study the client terminal and market watch options.
Stairs strategyThe multicurrency expert, which uses the "Stairs" strategy
When the price is approaching to the Signal Lines, the indicator sends Alert.
Two Pole Smoothed Ehlers OscillatorThis oscillator is based on Ehlers' Two Pole Super Smoother, converted as an oscillator, and smoothed using Ehlers' Instantaneous trendline.