MQL5 Programming Articles

icon

Study the MQL5 language for programming trading strategies in numerous published articles mostly written by you - the community members. The articles are grouped into categories to help you quicker find answers to any questions related to programming: Integration, Tester, Trading Strategies, etc.

Follow our new publications and discuss them on the Forum!

Add a new article
latest | best
ATC Champions League: Interview with Boris Odintsov (ATC 2011)
ATC Champions League: Interview with Boris Odintsov (ATC 2011)

ATC Champions League: Interview with Boris Odintsov (ATC 2011)

Interview with Boris Odintsov (bobsley) is the last one within the ATC Champions League project. Boris won the Automated Trading Championship 2010 - the first Championship held for the Expert Advisors in the new MQL5 language. Having appeared in the top ten already in the first week of the ATC 2010, his EA brought it to the finish and earned $77,000. This year, Boris participates in the competition with the same Expert Advisor with modified settings. Perhaps the robot would still be able to repeat its success.
Dr. Tradelove or How I Stopped Worrying and Created a Self-Training Expert Advisor
Dr. Tradelove or How I Stopped Worrying and Created a Self-Training Expert Advisor

Dr. Tradelove or How I Stopped Worrying and Created a Self-Training Expert Advisor

Just over a year ago joo, in his article "Genetic Algorithms - It's Easy!", gave us a tool for implementation of the genetic algorithm in MQL5. Now utilizing the tool we will create an Expert Advisor that will genetically optimize its own parameters upon certain boundary conditions...
Interview with Ge Senlin (ATC 2011)
Interview with Ge Senlin (ATC 2011)

Interview with Ge Senlin (ATC 2011)

The Expert Advisor by Ge Senlin (yyy999) from China got featured in the top ten of the Automated Trading Championship 2011 in late October and hasn't left it since then. Not often participants from the PRC show good results in the Championship - Forex trading is not allowed in this country. After the poor results in the previous year ATC, Senlin has prepared a new multicurrency Expert Advisor that never closes loss positions and uses position increase instead. Let's see whether this EA will be able to rise even higher with such a risky strategy.
Using MetaTrader 5 as a Signal Provider for MetaTrader 4
Using MetaTrader 5 as a Signal Provider for MetaTrader 4

Using MetaTrader 5 as a Signal Provider for MetaTrader 4

Analyse and examples of techniques how trading analysis can be performed on MetaTrader 5 platform, but executed by MetaTrader 4. Article will show you how to create simple signal provider in your MetaTrader 5, and connect to it with multiple clients, even running MetaTrader 4. Also you will find out how you can follow participants of Automated Trading Championship in your real MetaTrader 4 account.
Interview with Ilnur Khasanov (ATC 2011)
Interview with Ilnur Khasanov (ATC 2011)

Interview with Ilnur Khasanov (ATC 2011)

The Expert Advisor of Ilnur Khasanov (aharata) is holding its place in our TOP-10 chart of the Automated Trading Championship 2011 participants from the third week already, though Ilnur's acquaintance with Forex has started only a year ago. The idea that forms the basis of the Expert Advisor is simple but the trading robot contains self-optimization elements. Perhaps, that is the key to its survival? Besides, the author had to change the Expert Advisor planned to be submitted for the Championship...
Interview with Igor Korepin (ATC 2011)
Interview with Igor Korepin (ATC 2011)

Interview with Igor Korepin (ATC 2011)

Appearance of the Expert Advisor cs2011 by Igor Korepin (Xupypr) at the very top of the Automated Trading Championship 2011 was really impressive - its balance was almost twice that of the EA featured on the second place. However, despite such a sound breakaway, the Expert Advisor could not stay long on the first line. Igor frankly said that he relied much on a lucky start of his trading robot in the competition. We'll see if luck helps this simple EA to take the lead in the ATC 2011 race again.
Creating MQL5 Expert Advisors in minutes using EA Tree: Part One
Creating MQL5 Expert Advisors in minutes using EA Tree: Part One

Creating MQL5 Expert Advisors in minutes using EA Tree: Part One

EA Tree is the first drag and drop MetaTrader MQL5 Expert Advisor builder. You can create complex MQL5 using a very easy to use graphical user interface. In EA Tree, Expert Advisors are created by connecting boxes together. Boxes may contain MQL5 functions, technical indicators, custom indicators, or values. Using the "tree of boxes", EA Tree generates the MQL5 code of the Expert Advisor.
Interview with Tim Fass (ATC 2011)
Interview with Tim Fass (ATC 2011)

Interview with Tim Fass (ATC 2011)

A student from Germany Tim Fass (Tim) is participating in the Automated Trading Championship for the first time. Nevertheless, his Expert Advisor The_Wild_13 already got featured at the very top of the Championship rating and seems to be holding his position in the top ten. Tim told us about his Expert Advisor, his faith in the success of simple strategies and his wildest dreams.
ATC Champions League: Interview with Olexandr Topchylo (ATC 2011)
ATC Champions League: Interview with Olexandr Topchylo (ATC 2011)

ATC Champions League: Interview with Olexandr Topchylo (ATC 2011)

Interview with Olexandr Topchylo (Better) is the second publication within the "ATC Champions League" project. Having won the Automated Trading Championship 2007, this professional trader caught the attention of investors. Olexandr says that his first place in the ATC 2007 is one of the major events of his trading experience. However, later on this popularity helped him discover the biggest disappointment - it is so easy to lose investors after the first drawdown on an investor account.
Interview with Atsushi Yamanaka (ATC 2011)
Interview with Atsushi Yamanaka (ATC 2011)

Interview with Atsushi Yamanaka (ATC 2011)

What is common between skydiving, Futures, Hawaii, translations and spies? We didn't know it until we've managed to communicate with disqualified participant Atsushi Yamanaka (alohafx). His has a creed "Life is Good!", and one can hardly doubt that. It was interesting to know that distances between the continents are not an obstacle for communication among our Championship's participants.
Interview with Andrei Moraru (ATC 2011)
Interview with Andrei Moraru (ATC 2011)

Interview with Andrei Moraru (ATC 2011)

Ukrainian programmer Andrei Moraru (enivid) is an active participant of the Automated Trading Championship beginning from 2007. Andrei had already come in our view at that time and now we have decided to find out if there occured any changes in his attitude towards trading and selection of trading strategies for the past four years, and also to know about his new Expert Advisor.
Interview with Sergey Nikitin (ATC 2011)
Interview with Sergey Nikitin (ATC 2011)

Interview with Sergey Nikitin (ATC 2011)

In the second week of the competition, the Expert Advisor of Sergey Nikitin (VNIK) trading on two currency pairs EURUSD and EURJPY got featured on the very top drawing away from the rest. Multicurrency Expert Advisors always attract attention in the Championship, especially those that show good results. We talked with Sergey about the role of luck in a trader's life and his way of trading.
ATC Champions League: Interview with Roman Zamozhniy (ATC 2011)
ATC Champions League: Interview with Roman Zamozhniy (ATC 2011)

ATC Champions League: Interview with Roman Zamozhniy (ATC 2011)

This is the first interview in the "ATC Champions League" project. Roman Zamozhniy (Rich) from Ukraine was the winner of the first Automated Trading Championship in 2006. In addition, he is a regular participant of our Championships - he has not missed a single contest. In this interview, we talked about Roman's first place and tried to figure out what is necessary for successful participation.
Interview with Antonio Morillas (ATC 2011)
Interview with Antonio Morillas (ATC 2011)

Interview with Antonio Morillas (ATC 2011)

Antonio Morillas from Spain (sallirom, by the way - it is reversed surname!) was first who doubled his starting balance from the beginning of the Championship and thus attracted our attention. His trading strategy is extremely risky. We decided to talk to Antonio about risk and luck as these are part and parcel of Automated Trading Championship.
Interview with Matúš German (ATC 2011)
Interview with Matúš German (ATC 2011)

Interview with Matúš German (ATC 2011)

On the second day of the Championship the Expert Advisor created by Matúš German (gery18) increased its capital by 2.5 times and took the lead being ahead of all competitors. Matúš himself doubts his Expert Advisor will win, he thinks that luck and high risk were the reasons of such unexpected rise.
Custom Graphical Controls. Part 1: Creating a Simple Control
Custom Graphical Controls. Part 1: Creating a Simple Control

Custom Graphical Controls. Part 1: Creating a Simple Control

This article covers general principles of development of graphical controls. We are going to prepare tools for a quick and convenient work with graphical objects, analyze an example of creation of a simple control for entering text or numeric data as well as the ways of using it.
Nikolay Ivanov (Techno): "What is important for programs is the accuracy of their algorithms"
Nikolay Ivanov (Techno): "What is important for programs is the accuracy of their algorithms"

Nikolay Ivanov (Techno): "What is important for programs is the accuracy of their algorithms"

A programmer from Krasnoyarsk Nikolay Ivanov (Techno) is a leader among the developers in terms of the number of completed orders - he has implemented already more than 200 applications in the Jobs service. In this interview, he is talking about the Jobs service, its specific features and challengers faced by programmers.
Andrey Bolkonsky (abolk): "Any programmer knows that there is no software without bugs"
Andrey Bolkonsky (abolk): "Any programmer knows that there is no software without bugs"

Andrey Bolkonsky (abolk): "Any programmer knows that there is no software without bugs"

Andrey Bolkonsky (abolk) has been participating in the Jobs service since its opening. He has developed dozens of indicators and Expert Advisors for the MetaTrader 4 and MetaTrader 5 platforms. We will talk with Andrey about what a server is from the perspective of a programmer.
Andrey Voitenko (avoitenko): "Developers benefit from the ideas that they code? Nonsense!"
Andrey Voitenko (avoitenko): "Developers benefit from the ideas that they code? Nonsense!"

Andrey Voitenko (avoitenko): "Developers benefit from the ideas that they code? Nonsense!"

A Ukrainian developer Andrey Voitenko (avoitenko) is an active participant of the "Jobs" service at mql5.com, helping traders from all over the world to implement their ideas. Last year Andrey's Expert Advisor was on the fourth place in the Automated Trading Championship 2010, being slightly behind the bronze winner. This time we are discussing the Jobs service with Andrey.
Creating Custom Criteria of Optimization of Expert Advisors
Creating Custom Criteria of Optimization of Expert Advisors

Creating Custom Criteria of Optimization of Expert Advisors

The MetaTrader 5 Client Terminal offers a wide range of opportunities for optimization of Expert Advisor parameters. In addition to the optimization criteria included in the strategy tester, developers are given the opportunity of creating their own criteria. This leads to an almost limitless number of possibilities of testing and optimizing of Expert Advisors. The article describes practical ways of creating such criteria - both complex and simple ones.
Applying The Fisher Transform and Inverse Fisher Transform to Markets Analysis in MetaTrader 5
Applying The Fisher Transform and Inverse Fisher Transform to Markets Analysis in MetaTrader 5

Applying The Fisher Transform and Inverse Fisher Transform to Markets Analysis in MetaTrader 5

We now know that probability density function (PDF) of a market cycle does not remind a Gaussian but rather a PDF of a sine wave and most of the indicators assume that the market cycle PDF is Gaussian we need a way to "correct" that. The solution is to use Fisher Transform. The Fisher transform changes PDF of any waveform to approximately Gaussian. This article describes the mathematics behind the Fisher Transform and the Inverse Fisher Transform and their application to trading. A proprietary trading signal module based on the Inverse Fisher Transform is presented and evaluated.
3 Methods of Indicators Acceleration by the Example of the Linear Regression
3 Methods of Indicators Acceleration by the Example of the Linear Regression

3 Methods of Indicators Acceleration by the Example of the Linear Regression

The article deals with the methods of indicators computational algorithms optimization. Everyone will find a method that suits his/her needs best. Three methods are described here.One of them is quite simple, the next one requires solid knowledge of Math and the last one requires some wit. Indicators or MetaTrader5 terminal design features are used to realize most of the described methods. The methods are quite universal and can be used not only for acceleration of the linear regression calculation, but also for many other indicators.
William Blau's Indicators and Trading Systems in MQL5. Part 1: Indicators
William Blau's Indicators and Trading Systems in MQL5. Part 1: Indicators

William Blau's Indicators and Trading Systems in MQL5. Part 1: Indicators

The article presents the indicators, described in the book by William Blau "Momentum, Direction, and Divergence". William Blau's approach allows us to promptly and accurately approximate the fluctuations of the price curve, to determine the trend of the price movements and the turning points, and eliminate the price noise. Meanwhile, we are also able to detect the overbought/oversold states of the market, and signals, indicating the end of a trend and reversal of the price movement.
The Player of Trading Based on Deal History
The Player of Trading Based on Deal History

The Player of Trading Based on Deal History

The player of trading. Only four words, no explanation is needed. Thoughts about a small box with buttons come to your mind. Press one button - it plays, move the lever - the playback speed changes. In reality, it is pretty similar. In this article, I want to show my development that plays trade history almost like it is in real time. The article covers some nuances of OOP, working with indicators and managing charts.
How to Add New UI Languages to the MetaTrader 5 Platform
How to Add New UI Languages to the MetaTrader 5 Platform

How to Add New UI Languages to the MetaTrader 5 Platform

User interface of the MetaTrader 5 platform is translated into several languages. Don't worry if your native language is not among the supported ones. You can easily complete the translation using the special MetaTrader 5 MultiLanguage Pack utility, offered by MetaQuotes Software Corp. for free to all comers. In this article we will show some examples of how to add a new user interface languages to the MetaTrader 5 platform.
Payments and payment methods
Payments and payment methods

Payments and payment methods

MQL5.community Services offer great opportunities for traders as well as for the developers of applications for the MetaTrader terminal. In this article, we explain how payments for MQL5 services are performed, how the earned money can be withdraw, and how the operation security is ensured.
Using Self-Organizing Feature Maps (Kohonen Maps) in MetaTrader 5
Using Self-Organizing Feature Maps (Kohonen Maps) in MetaTrader 5

Using Self-Organizing Feature Maps (Kohonen Maps) in MetaTrader 5

One of the most interesting aspects of Self-Organizing Feature Maps (Kohonen maps) is that they learn to classify data without supervision. In its basic form it produces a similarity map of input data (clustering). The SOM maps can be used for classification and visualizing of high-dimensional data. In this article we will consider several simple applications of Kohonen maps.
Using WinInet in MQL5.  Part 2:  POST Requests and Files
Using WinInet in MQL5.  Part 2:  POST Requests and Files

Using WinInet in MQL5. Part 2: POST Requests and Files

In this article, we continue studying the principles of working with Internet using HTTP requests and exchange of information with server. It describes new functions of the CMqlNet class, methods of sending information from forms and sending of files using POST requests as well as authorization on websites under your login using Cookies.
Decreasing Memory Consumption by Auxiliary Indicators
Decreasing Memory Consumption by Auxiliary Indicators

Decreasing Memory Consumption by Auxiliary Indicators

If an indicator uses values of many other indicators for its calculations, it consumes a lot of memory. The article describes several methods of decreasing the memory consumption when using auxiliary indicators. Saved memory allows increasing the number of simultaneously used currency pairs, indicators and strategies in the client terminal. It increases the reliability of trade portfolio. Such a simple care about technical resources of your computer can turn into money resources at your deposit.
Advanced Adaptive Indicators Theory and Implementation in MQL5
Advanced Adaptive Indicators Theory and Implementation in MQL5

Advanced Adaptive Indicators Theory and Implementation in MQL5

This article will describe advanced adaptive indicators and their implementation in MQL5: Adaptive Cyber Cycle, Adaptive Center of Gravity and Adaptive RVI. All indicators were originally presented in "Cybernetic Analysis for Stocks and Futures" by John F. Ehlers.
preview
The Fundamentals of Testing in MetaTrader 5

The Fundamentals of Testing in MetaTrader 5

What are the differences between the three modes of testing in MetaTrader 5, and what should be particularly looked for? How does the testing of an EA, trading simultaneously on multiple instruments, take place? When and how are the indicator values calculated during testing, and how are the events handled? How to synchronize the bars from different instruments during testing in an "open prices only" mode? This article aims to provide answers to these and many other questions.
MQL5 Wizard for Dummies
MQL5 Wizard for Dummies

MQL5 Wizard for Dummies

In early 2011 we released the first version of the MQL5 Wizard. This new application provides a simple and convenient tool to automatically generate trading robots. Any MetaTrader 5 user can create a custom Expert Advisor without even knowing how to program in MQL5.
Statistical Estimations
Statistical Estimations

Statistical Estimations

Estimation of statistical parameters of a sequence is very important, since most of mathematical models and methods are based on different assumptions. For example, normality of distribution law or dispersion value, or other parameters. Thus, when analyzing and forecasting of time series we need a simple and convenient tool that allows quickly and clearly estimating the main statistical parameters. The article shortly describes the simplest statistical parameters of a random sequence and several methods of its visual analysis. It offers the implementation of these methods in MQL5 and the methods of visualization of the result of calculations using the Gnuplot application.
MQL5 Wizard: New Version
MQL5 Wizard: New Version

MQL5 Wizard: New Version

The article contains descriptions of the new features available in the updated MQL5 Wizard. The modified architecture of signals allow creating trading robots based on the combination of various market patterns. The example contained in the article explains the procedure of interactive creation of an Expert Advisor.
Using MetaTrader 5 Indicators with ENCOG Machine Learning Framework for Timeseries Prediction
Using MetaTrader 5 Indicators with ENCOG Machine Learning Framework for Timeseries Prediction

Using MetaTrader 5 Indicators with ENCOG Machine Learning Framework for Timeseries Prediction

This article presents connecting MetaTrader 5 to ENCOG - Advanced Neural Network and Machine Learning Framework. It contains description and implementation of a simple neural network indicator based on a standard technical indicators and an Expert Advisor based on a neural indicator. All source code, compiled binaries, DLLs and an exemplary trained network are attached to the article.
How to Order an Expert Advisor and Obtain the Desired Result
How to Order an Expert Advisor and Obtain the Desired Result

How to Order an Expert Advisor and Obtain the Desired Result

How to write correctly the Requirement Specifications? What should and should not be expected from a programmer when ordering an Expert Advisor or an indicator? How to keep a dialog, what moments to pay special attention to? This article gives the answers to these, as well as to many other questions, which often don't seem obvious to many people.
Tracing, Debugging and Structural Analysis of Source Code
Tracing, Debugging and Structural Analysis of Source Code

Tracing, Debugging and Structural Analysis of Source Code

The entire complex of problems of creating a structure of an executed code and its tracing can be solved without serious difficulties. This possibility has appeared in MetaTrader 5 due to the new feature of the MQL5 language - automatic creation of variables of complex type of data (structures and classes) and their elimination when going out of local scope. The article contains the description of the methodology and the ready-made tool.
The Indicators of the Micro, Middle and Main Trends
The Indicators of the Micro, Middle and Main Trends

The Indicators of the Micro, Middle and Main Trends

The aim of this article is to investigate the possibilities of trade automation and the analysis, on the basis of some ideas from a book by James Hyerczyk "Pattern, Price & Time: Using Gann Theory in Trading Systems" in the form of indicators and Expert Advisor. Without claiming to be exhaustive, here we investigate only the Model - the first part of the Gann theory.
The Implementation of Automatic Analysis of the Elliott Waves in MQL5
The Implementation of Automatic Analysis of the Elliott Waves in MQL5

The Implementation of Automatic Analysis of the Elliott Waves in MQL5

One of the most popular methods of market analysis is the Elliott Wave Principle. However, this process is quite complicated, which leads us to the use of additional tools. One of such instruments is the automatic marker. This article describes the creation of an automatic analyzer of Elliott Waves in MQL5 language.
Electronic Tables in MQL5
Electronic Tables in MQL5

Electronic Tables in MQL5

The article describes a class of dynamic two-dimensional array that contains data of different types in its first dimension. Storing data in the form of a table is convenient for solving a wide range of problems of arrangement, storing and operation with bound information of different types. The source code of the class that implements the functionality of working with tables is attached to the article.