What is MQL4 Programming Language?

What is MQL4? MQL4 stands for MetaQuotes Language 4 and it is a programming language included in MetaTrader 4. MQL4 is the MQL version 4, the one that works with MetaTrader 4. If you don’t know what is a programming language it means that you have never written code before, which is fine. A programming language is a language that allows a developer, in this case you, to tell the computer to perform specific actions, a sequence of actions then results in a program.

MQL4 was released with the first version of MetaTrader 4 around 2005 and has gone through many updates over the years, an important update was released in 2014, when it was given more power, security and features, to bring it to almost the same level of the MQL5.

MQL4 and MQL5 have some important differences but for now we will focus only on MQL4 and MetaTrader 4.

File Extensions

MQL4 files have the following extensions:

  • .mq4 is the source file, it is basically a text file format that contains all the instructions to be executed, you can open with MetaEditor or any text file editor, this file must be compiled to run in MetaTrader
  • .ex4 is the compiled version, the actual program that can be run by MetaTrader, you cannot open it with any other program other than MetaTrader, if you buy an Expert Advisor or Trading Robot for MetaTrader you will probably receive the software with the .ex4 extension
  • .mqh are libraries, which are files containing additional functions that you can include and use in your programs, like the .mq4 files, you can open them with MetaEditor or any text file editor

 

metatrader-mql4-2

 

metatrader-mql4-4

 

MQL4 uses a syntax similar to C++/C#/C/Java so if you already know some of these languages it will not take long to learn how to use this language.

What can you really do with MQL4?

MQL4 is an extremely powerful tool that used properly can expand you trading possibilities. To give you some examples, with MQL you can:

  • perform mathematical operations, like for example calculate a position size given risk parameters
  • calculate stop loss and/or take profit prices
  • open and close orders
  • send notifications on the screen or via email
  • create log files and reports
  • create custom indicators
  • automate your trading, yes, your computer can trade for you without your interaction

As you can see MQL4 gives you great powers and learning this language will allow you to benefit from all of them.

MQL programs can be divided in three main categories:

 

metatrader-mql4-3

 

We will see the these categories more in details in the article Differences between Scripts, Indicators and Expert Advisors.

Have you already installed MetaTrader 4? If not see How to Install MetaTrader 4 Client Terminal.

 

Please leave a comment if you have any feedback or doubt and remember to like us on Social Media!

We use cookies to ensure that we give you the best experience on our website.