Join our fan page

MQL5 Programming for Traders – Source Codes from the Book. Part 4 - expert for MetaTrader 5
- Views:
- 7172
- Rating:
- Published:
- 2023.12.15 14:51
- Updated:
- 2024.03.11 14:34
-
Need a robot or indicator based on this code? Order it on Freelance Go to Freelance
Part 4. Common MQL5 APIs
In the previous sections of the book, we delved into the basics of the MQL5 programming language and studied its syntax, rules of use, and key concepts. However, to write real-life programs employing data processing and automated trading, you should use many built-in functions to interact with the MetaTrader 5 terminal.
In "Part 4. Common MQL5 APIs", we will focus on mastering built-in functions (MQL5 API) and will gradually delve into specialized subsystems. Any MQL5 program can utilize a plethora of technologies and functionalities. Therefore, it makes sense to begin with the most simple and useful functions that can be utilized in most programs.
Among the primary topics, we will study array operations, string processing, file interactions, data conversion, and user interaction functions. We will also explore mathematical functions and program environment management.
Unlike some other programming languages, using the built-in functions of the MQL5 API does not require additional preprocessor directives. The names of all MQL5 API functions are available in the global context (namespace) and can always be accessed unconditionally.
We will also discuss the possibility of using similar names in different program contexts, such as class method names or custom namespaces. In such cases, you should use the context resolution operator to call the global function, which we discussed in the section on nested types, namespaces, and the context operator '::'.
Programming often requires operations with various data types. In previous sections, we have already seen the mechanisms for explicit and implicit conversion of built-in data types. However, they may not always be suitable for different reasons. To provide more fine-tuned data conversion between different types, the MQL5 API includes a set of conversion functions. Particular attention is paid to functions for conversions between strings and other types, such as numbers, dates and times, colors, structures, and enumerations.
Translated from Russian by MetaQuotes Ltd.
Original code: https://www.mql5.com/ru/code/45593

Part 3 "Object Oriented Programming in MQL5" offers an immersion into the world of object-oriented programming (OOP) in the MQL5 language. Software development often involves the complexity related to the management of multiple entities, requiring advanced technology to improve programming convenience, productivity, and quality.

Part 2 "MQL5 programming fundamentals" is an introduction to the key concepts of this programming language. This part of the book is devoted to data types, identifiers, variables, expressions, and operators. You will learn how to combine different instructions to form the program logic.

In Part 5 of the book, we'll delve deeper into the APIs associated with algorithmic trading, including financial data analysis and processing, chart visualization, automation, and user interactions.

In Part 6 of the "MQL5 Programming for Traders", we will study a key component of the MQL5 language – trading automation. We will start with a description of the fundamental entities, such as financial instrument specifications and trading account settings. These are prerequisites for creating properly operating Expert Advisors.