Posted By:
30 Jul, 2014 10:00 am PDT

Basic Concepts of MetaTrader

 There are three types of applications created in MQL4 and intended for working in the client terminal:

1. Custom Indicator

2. Expert Advisor

3. Script

DataTypes, Functions and Operations are an important part of any code.



Market analysis and trade management in MetaTrader 4 Client Terminal is implemented with the help of programming tools. MQL4 language allows creating such programs. There are three types of applications created in MQL4 and intended for working in the client terminal:

• A custom indicator is a program that graphically displays market regularities according to an author's algorithm written into the program.

• An Expert Advisor is a program that allows partial automation of trading operations, or allows fully automated trading.

• A script is a program for executing one-time actions, including the execution of trade operations.


A tick is an event that is characterized by a new price of the symbol at some instant. Ticks are delivered to every client terminal by a server that is installed in a dealing center. As appropriate to the current market situation, ticks may be received more or less frequently, but each of them brings a new quotethe cost of one currency expressed in terms of another currency.


A comment is an optional and non-executable part of a program that explains the code. So, comment is an optional part of a program. It means that a ready program will work according to its code irrespective of whether there are comments in it or not. However, comments facilitate understanding of the program code very much. There are one-line and multi-line comments. A one-line comment is any sequence of characters following a double slash (//) on the same line. The sign of a one-line comment is ended by line feed. A multi-line comment starts with the characters of /* and is ended by */



In MQL4, the following data types are used (for the values of constants, variables, and the values returned by functions):

int (integers)

double (real numbers)

bool (Boolean values, that is logical values)

string (values of string type)

color (values of color type)

datetime (values of date and time)


These are the following types of operations in MQL4:







•Function call



A function is a named, specific part of a program that describes a method of data conversion.

We will consider two aspects of functions: function descriptions and function calls.

A function description is a specific, named part of a program intended for execution.

A function call (or, function reference) is a record, the execution of which results in the execution of the function to which it refers.


int square(int a,int b){

int c;


return c;


int value;




An Expert Advisor (EA) is a program coded in MQL4 and called by the client terminal to be executed at every tick. The main purpose of EAs is the programmed control over trades. EAs are coded by users. There are no built-in EAs in the client terminal.

A script is a program coded in MQL4 and executed by the client terminal only once. Scripts are intended to perform operations that should be executed only once. Scripts are coded by users. They are not delivered with the client terminal as built-in programs.

A custom indicator is a program coded in MQL4 and called by the client terminal to be executed at every tick. It is basically intended for graphical displaying of preliminarily calculated data, such as lines. Indicators cannot trade. There are two types of indicators: technical (built-in) indicators and custom indicators.

Was it useful?  

Please login to reply to this problem.