Trader’s Tech – Writing Your Own EA Part 2 – Starting with MetaTrader

As promised, in this Trader’s Tech article we’re going to look at what you need to write your own EA. As I’ve said, we’re going to go at this a piece at a time so non-programmers can follow along. Please don’t hesitate to ask questions, we like questions.  And, as always, you can follow me on Twitter. And again, we’re talking about programming for Metatrader 4 (MT4.)

Your first order of business is to get set up with a demo account at a broker that offers MT4. (If you don’t have a preferred broker you may want to try Arrowfield Trading.)  Choose your broker, sign up for a demo account and download your MT4 platform.  Your broker can help you with those details.

Trader's Tech - MT4 Install

Except for a small detail, I recommend accepting all the defaults in the installation of your MT4 platform. The exception is the folder in which to install it. MT4 defaults to installation in the Program Files folder on your Windows machine. Since MT4 writes data to its own folder (non-standard Windows behavior), it may not have sufficient permission to write to its folder in the Program Files folder.  I usually create a folder called MT4 in the root of your hard drive to hold the MT4 installations.  This will alleviate future problems with your MT4 installation.


Hopefully, you have successfully completed the installation of your platform.  Let’s take a look at the EA development tool called MetaEditor.


Trader's Tech MetaEditor Button


Open your MT4 platform and click the MetaEditor button in the upper toolbar to open the MetaEditor.






TT-EA2-MetaEditor_Description The MetaEditor will open in a separate window. You’ll notice that you can have any number of EAs or Indicators open in the editor with a tab for each one at the top.  Just below that, the largest area of the editor is the code area. This is the space in which you will enter your program code – also known as source code. As you’ve heard me say, don’t be intimidated by what you see in this code space, this is a simple, experimental EA that I wrote a couple of years ago just to test out a theory. Much of what you see there is standard stuff in a program.  We’ll go into great detail in the next few weeks about what all of this means.

To the right of the code area, you will see the Navigator area. The Navigator allows you to see/open other EAs, libraries, include files, etc. In addition, there is an MQL4 (the programming language of MT4) dictionary with a search feature so you can easily see the exact syntax of each piece of pre-written code you will use (known as functions.) The area below the code area will show you the results of compiling your program (compiling is the term for having the computer convert the human-readable source code that you wrote to computer-readable executable code that the computer will execute.) You will also see the results of searching the MQL4 dictionary.

I believe that’s enough for one day. Please don’t hesitate to ask any questions you may have in the comments below, I’ll try to answer them as quickly as possible.

Have a great day!


The following two tabs change content below.
Winners Edge Trading was founded in 2009 and is working to create the most current and useful Forex information and training available on the internet.

Winner’s Edge Trading, as seen on:

Winner's Edge Trading in the news