MQL4 Book  Program in MQL4

Upgrade to
Book in One File

Program in MQL4

It should be noted from the very beginning that anyone can program in MQL4, though it requires attention and certain knowledge.

Perhaps some traders expect difficulties in studying programming; it is hard for them to imagine complicated processes running in the interior of their computers. Fortunately, developers of MQL4 language tried to make it widely available for users. A pleasant peculiarity of creating programs in MQL4 is that a programmer need not necessarily have special knowledge about the interaction of the client terminal with an operating system, of network protocol characteristics, or of a compiler structure.

The process of creating programs in MQL4 is simple and easy work. For example, a driver does not have to know a motor structure for driving a car—he only needs to learn pedaling and steering. However, before driving a car on busy streets, each driver has to undergo training. Something like that should be done by a starting programmer—learning some simple principles of creating programs, and after that, slowly starting to "drive."

Program structure
Although there are numerous types of programs in MQL4, they all have general features. It may be said that correct structure is the basis of correctly written code. That is why it is necessary to understand the components of a program.

Special functions
There are a lot of functions built in the MQL4 language. Such functions are called standard functions of the language. But, there are several extremely important functions, which are called special functions. A program cannot be executed without them. Each of these functions has its own allocation.

Program execution
One must correctly understand how an MQL4 program operates. Not all code parts are used with the same frequency. What functions are executed in the first instance? Where should the main part of a program be placed? What program type should be used for this or that purpose?

Examples of implementation
A new language is better learned on examples. How do you write a simple program? What errors can occur?