Before we dive deep into coding, let us first show you where all the magic will happen. On your MetaTrader toolbar, you will find a yellowish icon which, when you hover your mouse over it, will show a description tag “MetaQuotes Language Editor.” You can press F4 from your keyboard, and the development environment will popup (Fig.4). When you click on that icon, the development environment will popup. This window is named the “MetaEditor,” and it is the place where you will write all your code to create your trading robot or, in MetaTrader’s lexicon, “Expert Advisor.”

MetaTrader 4 MetaTrader 5
MetaQuotes Language Editor, or the development environment MetaQuotes Language Editor, or the development environment

Fig.4 MetaQuotes Language Editor, or the development environment.

There are many possibilities, and MetaEditor is comprehensive, allowing you to develop complex algorithms with libraries, scripts, and custom indicators. But for the purpose of this guide, we will cover the essential to get you started quickly to develop your strategy into an automated trading robot. From the MetaEditor toolbar, press on “New” (fig.5).

Create a new file

Fig.5 Create a new file.

You will be then asked to choose which type of file you want to create. Select “Expert Advisor (template)” from the list below:

MetaTrader 4 MetaTrader 5
MetaTrader 4 MetaTrader 5

Provide a name to your Expert Advisor, add an author such as your name, your company and eventually copyright (fig.6). Press “Next” until the end of the wizard and leave the rest of the settings by default and finally press “Finish.”

Expert Advisor properties

Fig.6 Expert Advisor properties

Congratulations, you are on the way to create your first robot on MetaTrader (fig.7). You are all set!

Your first piece of code

Fig.7 Your first piece of code.

The colorful text is the code that represents the logic of your trading robot. Colors in programming editors help you to identify keywords and syntaxes. Do not panic; we will get through it step by step, and it will make sense for you rather quickly.

Leave a Reply

57  +    =  59