MQL4 - automated forex trading   /  

MQL4 Book

Screenshot
USDJPY, D1
Real
Strategy MA AdvancedStrategy MA Advanced Try product
Strategy MA Advanced
Author: net
Subscribe to signal
Viktor profi
188.24%, 7 096.04 RUR
MAX_SC a trend follower using dynamic supports and resistancesIndicator
MAX_SC a trend follower using dynamic supports and resistances
Author: maximus71
Ten "Errors" of a Newcomer in Trading?Ten "Errors" of a Newcomer in Trading?

MQL4 Book  Basics of MQL4

Upgrade to
Book in One File

Basics of MQL4


This section represents basic terms underlying programming language MQL4:
  • Some Basic Concepts

    Such terms as 'tick' (a price change), 'control' in algorithms, 'comment' in programs are described. The main event when trading on financial markets is the change of price. This is why tick is an important event that makes the basic mechanisms of MQL4 programs run. What to do when a new tick incomes? What actions to take? This is control that moves to the forefront here. But don't forget to comment upon your code.

  • Constants and Variables

    The terms of constants and variables are introduced, the difference between these terms is explained. As the term suggests, a constant is something continuous, set once for all. Unlike the constant, a variable is a programming code object that can modify its content. It is impossible to write a program without using unchangeable objects (constants) and/or objects that can be modified during the program execution (variables).

  • Data Types

    Certain types of data are used in any programming language. The type of a variable is chosen according to its purpose. How can we declare a variable, how can we initialize it (preset its initial value)? A wrong choice of the type for a variable may slow down the program or even result in its wrong actions.

  • Operations and Expressions

    Operations operate upon operands. What types of operations are there? What is typecasting used for? What are special features of operations on integers? Why is it important to remember about precedences of data of different types? Without knowing about the features of some operations, you can make subtle errors.

  • Operators

    Simple and compound operators. A necessary action should not always be executed by a simple operator. If it is required that a group of operators is executed as one big operator, this group should be included into one compound operator. Requirements and specific examples of using operators are given.

  • Functions

    The necessity of getting a simple code brings us to the term of Function. In order to use the function from different locations in the program, it is necessary to provide it with Function Parameters. We will consider the process of the custom function creation. The examples of using standard functions are given.

  • Program Types

    Scripts, indicators and Expert Advisors are the types of MQL4 programs that allow you to cover practically the whole class of problems concerning trading in fincancial markets. It is necessary to understand the purposes of each type of programs in order to use MetaTrader 4 Client Terminal in the best way.