What is MetaEditor for MetaTrader 4?

If you are looking to modify or create MQL4 code you need to know and be familiar with MetaEditor, this is the tool you will use the most. To understand this article you must already know What is MQL4 and What is MetaTrader, these are the starting concepts.

metaeditor-open-about

In the previous articles we introduced MetaTrader, the most popular trading platform, and we met MQL4, the powerful scripting language that will improve your trading capabilities. For all the traders interested in coding with MQL the third main tool to know is MetaEditor. The word MetaEditor sounds similar to MetaTrader but it includes Editor Basically MetaEditor is a dedicated Editor to develop, manage and compile MQL programs. As already explained in What is MQL4 MQL is a scripting language and the source files are text files with extension MQ4 and MQH, being text files they can be opened with any text editor, for example Notepad, Wordpad, Word, so why do we need MetaEditor? MetaEditor facilitates the tasks of creating and editing files in the following ways:

  • Present the code well formatted and coloured, easy to read
  • Navigator panel to browse between the files
  • Option to insert coding elements like variables and functions
  • Autocompletion to predict and suggest the word that is being typed
  • Highlight of errors

One of the main functions of MetaEditor is the ability to compile the source files, this needs to be explained as not everyone has clear what compile a program means. As you know the computer is a very complex calculator, it perform matematical operations in a binary system, the code that you write may make sense for you but as it is in a source file does not make sense for a computer to run, this is because it needs to be compiled!

Compile is that task that takes a text source file, in this case with a MQ4 extension, and transforms it in a file, in this case with a EX4 extension, that can be executed by a computer or another software. So in other words, after you have created your source MQ4 file you need to compile it to produce an executable EX4 file. Compiled files can be only run and not read, so you cannot retrieve the source code they have been created from.

MetaEditor is included in the installation of MetaTrader and is also kept updated by the same. To open MetaEditor you have three options.

 

Option 1 – In MetaTrader click the menu Tools and then click the MetaQuotes Language Editor option.

 

metaeditor-open-1
Option 2 – In the Standard Bar click the MetaEditor Icon.


metaeditor-open-2

 

Option 3 – In the Windows Start Menu open the MetaTrader 4 group and select MetaEditor.


metaeditor-open-3

 

Once you open MetaEditor the interface is quite intuitive, you can browse the files in the Navigator, save, open, compile and run from the menu and bars and check for errors, logs, articles and additional code in the Toolbox. You will get familiar with it quickly.

 

metaeditor-open-base

 

Now you should have a basic understanding of the tools required to Automate Your Trading:

  • MetaTrader, to trade and run your code
  • MQL, the scripting language
  • MetaEditor, to create, edit and compile your code

You should be ready to start learning how to code at this point, check out the Basics section for more article ad Fundamentals of coding in MQL language.

 

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.