GMT |  Tokyo |  London |  New York

Install MetaTrader EAs – Expert Advisors

Posted in Learn by Lewis Wolfe
Monday, February 16th, 2009 14:41 PM GMT

It’s easy to include add-ons into MetaTraderindicators, expert advisors (EAs), and other scripts, customising it to your particular requirements - this makes the software very flexible and is probably the main reason it currently leads the field. But what, why, and how?

Filetypes
There are two different filetypes used by MetaTrader 4 – program files (.mq4) and the executable files (.ex4).

Program files are standard text files – you could open and edit them in a normal text editor (Wordpad etc.) These contain the source code in MQL4 programming language, which is readable, hopefully, by humans. To install an EA in MetaTrader, an mq4 file has to be compiled, that is converted to a binary code – but, no problem, MetaTrader will do this for you.

MetaTrader comes complete with its own mq4 file editor, called, surprisingly, MetaEditor. If you already have MetaTrader installed on your desktop, the editor is associated with this file extension and will (should) open the file if you double-click on the icon.

Installation
You’ve downloaded a mq4 file and you want to install it.

First – and it’s best to do this now, rather than later – you’ll need to copy the downloaded mq4 file to the correct folder in your copy of MetaTrader.

So use a file explorer program, and find out where your MetaTrader is installed. Most likely it’ll be found at C:\Program Files\MetaTrader

(It might be at C:\MetaTrader and the MetaTrader name might vary – if you’ve downloaded it as part of a broker’s demo package)

Now, locate the correct subfolder:
If it is an expert advisor – the mq4 file should be copied to C:\Program Files\MetaTrader\experts

If it’s an indicator, then it should go in C:\Program Files\MetaTrader\experts\indicators

A library? C:\Program Files\MetaTrader\experts\libaries – you should be getting the idea.

Compilation
Double-click on the icon of the mq4 file to open in MetaEditor – you’ll see the source code in the upper window – and hit the ‘Compile’ button in the toolbar, simple as that. If all’s gone well, you’ll see a message, ’successfully compiled, 0 errors’.

And the work is done for you – if you look in the subfolder, you should see a new, identically-named ex4 file – and this will appear in your Expert Advisors list, ready for use. It doesn’t do any harm to restart MetaTrader at this point.

If there are errors in the compilation process, this is because the code isn’t written properly – as can happen, downloading stuff from the net – and would need fixing, which beyond our scope to discuss here, or simply, deleting. Move on to something that does work.

You may see, at times, .mqh files associated with MetaTrader – these are snippets for programming and go in experts\includes – you can’t compile them to .ex4 files. As always with first steps in programming – if you’re not sure, you probably shouldn’t be doing, and leave well alone…

forex-metatrader.gif

One Response to “Install MetaTrader EAs – Expert Advisors”

  1. [...] further to our quick tutorial on installing mq4 files in MetaTrader – if you’ve downloaded an expert advisor or forex indicator or similar that is in the form of [...]

Leave a Reply