Introduction
The Modern Foreign Exchange (Forex) market is one of the most dynamic and profitable markets in the world. Many online traders use different tools and methods to maximize their chances of success. One of these tools is the Meta-trader 4 or MQL4 platform. It is a powerful software suite that contains numerous instruments useful for automated trading and analysis. One of the most popular tools in this platform is the iATR() function. It is a powerful method to extract numeric values from a text string. In this article, we will provide an introduction to the iATR() function, explain how it can be used for automated forex trading, and provide examples on how to extract numbers from text string in MQL4.
What is the iATR() function?
The iATR() function is a powerful tool in the MQL4 suite of trading tools and software programs. It is used to extract information from a given text string. This function can be used to get numbers from a given string, such as a currency or stock name, making it a powerful tool for automated forex trading. It is very useful for extracting numerical values from a given text string that can then be used for further analysis.
How to use the iATR() function?
Using the iATR() function is not difficult. The only information you need to provide are the handle that is returned by the iATR() function, the buffer number, which can be zero or any other desired number, and the start position, which is the index of the string from which you want to extract a substring. Once you have supplied these details, the function will extract the substring from the text line and return it as a copy.
Examples of Using iATR() Function
The iATR() function is a powerful tool for automated trading and it can be used for a variety of different tasks. For example, let’s say you want to extract only the text DB0F64EEC7A2A454E798BF69494A9ACB from TerminalInfoString(TERMINAL_DATA_PATH). The following code can be used to achieve this:
int startpos = 53; // Starting position of the required substring
int endpos = 79; // Ending position of the required substring
string result = iATR(TerminalInfoString(TERMINAL_DATA_PATH), 0, startpos, endpos);
Print(“The Text: ” + result); // Print the extracted result
Conclusion
The iATR() function is an incredibly useful tool for automated trading. It can be used to extract numerical information from text strings, making it an invaluable tool for forex trading strategies. It is relatively simple to use, and once you understand the syntax, it can be a powerful tool for advanced automated trading strategies. We hope that this article has provided an introduction to iATR () and helped you to understand how it can be used to get numbers from a given string in MQL4. , technical
Getting the Number from the MetaTrader 4 String
Working with the Meta Trader 4 terminal requires the user to be familiar with the types of strings found inside the terminal interface. One of the most common strings found in MetaTrader 4 is the unique identifier of the terminal, referred to as the TerminalInfoString. This unique identifier is composed of 32 characters of numbers and letters that includes a DB prefix. One of the tasks sometimes encountered when working with the TerminalInfoString is extracting only the number found in this string for use in custom scripts or Expert Advisors (EAs). This article will discuss what the TerminalInfoString is, and explain how to get the number from a string as found in MetaTrader 4.
What is the TerminalInfoString?
The TerminalInfoString is a 32-character code used to uniquely identify the installation of MetaTrader 4. This string consists of the letters “DB” followed by 30 combination of numbers and letters, which is then followed by a letter 0 or a letter F. This code is generated when the installation of the Meta Trader 4 terminal takes place. The TerminalInfoString does not change when the installation is updated or when MetaTrader 4 is reinstalled.
How to Get the Number from a String with MQL4
Extracting the actual number from the TerminalInfoString is fairly easy and can be accomplished using MQL4. To get the 30 character code from the TerminalInfoString, use the TerminalInfoString() function. The syntax for this function is TerminalInfoString(TERMINAL_DATA_PATH). This will get the 30 character code from the string, but it will not get the DB prefix. To get the DB prefix, call the same function twice. The result of the second call will include the DB prefix. For example, calling the TerminalInfoString() function as TerminalInfoString(TERMINAL_DATA_PATH) will return “DB0F64EEC7A2A454E798BF69494A9ACB” whereas calling it twice as TerminalInfoString(TERMINAL_DATA_PATH)+TerminalInfoString(TERMINAL_DATA_PATH) will return “DB0F64EEC7A2A454E798BF69494A9ACBDB0F64EEC7A2A454E798BF69494A9ACB”. From here all that is needed to extract the actual number to use in scripts or EAs is to strip away the excess characters leaving only the unique ID.
In conclusion, the TerminalInfoString is a unique, 32-character code used to identify a Meta Trader 4 installation. This string includes the letters “DB” followed by a 30-character combination of numbers and letters, and is followed by a “0” or a “F”. It can be found by using the TerminalInfoString() function in MQL4. To actually extract the numerical part of the code it is necessary to call the same function twice, and then strip away the excess characters. This will then leave only the 30-character number which can be used in Expert Advisors or other script projects.