If you are looking to modify or create new MQL4 code, you need to be familiar with MetaEditor. It is the most important tool for MQL4 coders and is indispensable even if you want to make a small change to some source code. To better understand this guide, you must already know what MQL4 is and what MetaTrader is — these are the starting concepts.
If you already have some experience with MetaTrader, the most popular trading platform, you have probably also heard about MQL4, the powerful scripting language that will improve your trading capabilities. For all the traders interested in coding with MQL4, the third main tool to know is MetaEditor. The word MetaEditor sounds similar to MetaTrader, but it focuses on Editor. Basically, MetaEditor is a dedicated Editor to develop, manage, and compile MQL4 programs. MQL4 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++ or Wordpad. So why do we need MetaEditor? MetaEditor facilitates the tasks of creating and editing such files in the following ways:
One of the main functions of MetaEditor is the ability to compile the source files. This needs to be explained as not everyone has a clear idea what does it mean to compile a program. As you know, a computer is a very complex calculator, it perform mathematical operations in a binary system. The code that you write may make sense to you, but as it is in a source file, it does not make sense for a computer to run. This is because it needs to be compiled first!
Compilation is the task that takes a text source file, in this case with a MQ4 extension, and transforms it into an executable file, in this case with a EX4 extension. It can now 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 process that updates your MetaTrader. To open MetaEditor, you have four options:
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 toolbars, and check for errors, logs, articles, and additional code in the Toolbox. You will get familiar with it quickly.
Now you should have a basic understanding of the tools required to automate your trading:
You should be ready to start learning how to code at this point.
If you want to get news of the most recent updates to our guides or anything else related to Forex trading, you can subscribe to our monthly newsletter.