MQL5 programming fundamentals

Like any other programming language, MQL5 is based on some fundamental concepts used to create more complex structures and, eventually, programs as a whole. In this Part, we are going to learn most of the concepts, such as data types, identifiers, variables, expressions, and operators, as well as the techniques to combine various statements in the code for building the desired program operation logic.

The material assists our readers in progressing to the independent practical application of the procedural programming, This is one of the very first programming trends to solve various problems. In fact, it is the formation of a program from small steps (statements) to be executed in the required sequence for data processing. The text script shown in Part 1 of this book is an example of such a style.

This section covers a broad spectrum of fundamental concepts and tools essential for successful MQL5 programming, including the following subsections:

Identifiers:

  • Identifiers form the foundation of any program code. This subsection discusses the purpose and rules for naming identifiers in MQL5.

Built-in data types:

  • MQL5 includes a variety of built-in data types, each designed to store and process specific types of information. This section provides a comprehensive understanding of basic data types.

Variables:

Variables are used to store and manage data in a program. The "Variables" section teaches the basics of working with variables and considers how to declare, initializing, and assign values to them.

Arrays:

  • Arrays provide a structured way to store data. This section covers the basics of creating and using arrays in MQL5.

Expressions:

  • Expressions form the basis of calculations and program logic. From this subsection, you will learn how to construct and evaluate expressions in MQL5.

Type conversion:

  • Data type conversion is an integral part of programming. The "Type Conversion" section provides an understanding of the process related of converting data between different types in MQL5.

Statements:

  • Statements are commands that control program execution. In this section, we will look at various types of statements and their applications.

Functions:

  • Functions allow for code structuring and reuse. This section dives into the basics of creating and calling functions in MQL5.

Preprocessor:

  • The MQL5 preprocessor processes the source code before compilation. The "Preprocessor" section describes the principles of using preprocessor directives and their impact on the code.

 

Procedural programming principles will act as the basis for the subsequent learning of a more powerful paradigm, i.e., Object-Oriented Programming (OOP). It will be referred to in Part 3.