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
preview
Data Science and Machine Learning (Part 02): Logistic Regression

Data Science and Machine Learning (Part 02): Logistic Regression

Data Classification is a crucial thing for an algo trader and a programmer. In this article, we are going to focus on one of classification logistic algorithms that can probability help us identify the Yes's or No's, the Ups and Downs, Buys and Sells.
Working with GSM Modem from an MQL5 Expert Advisor
Working with GSM Modem from an MQL5 Expert Advisor

Working with GSM Modem from an MQL5 Expert Advisor

There is currently a fair number of means for a comfortable remote monitoring of a trading account: mobile terminals, push notifications, working with ICQ. But it all requires Internet connection. This article describes the process of creating an Expert Advisor that will allow you to stay in touch with your trading terminal even when mobile Internet is not available, through calls and text messaging.
preview
MQL5 Wizard techniques you should know (Part 06): Fourier Transform

MQL5 Wizard techniques you should know (Part 06): Fourier Transform

The Fourier transform introduced by Joseph Fourier is a means of deconstructing complex data wave points into simple constituent waves. This feature could be resourceful to traders and this article takes a look at that.
preview
Learn how to design a trading system by DeMarker

Learn how to design a trading system by DeMarker

Here is a new article in our series about how to design a trading system by the most popular technical indicators. In this article, we will present how to create a trading system by the DeMarker indicator.
preview
How to choose an Expert Advisor: Twenty strong criteria to reject a trading bot

How to choose an Expert Advisor: Twenty strong criteria to reject a trading bot

This article tries to answer the question: how can we choose the right expert advisors? Which are the best for our portfolio, and how can we filter the large trading bots list available on the market? This article will present twenty clear and strong criteria to reject an expert advisor. Each criterion will be presented and well explained to help you make a more sustained decision and build a more profitable expert advisor collection for your profits.
Graphics in DoEasy library (Part 91): Standard graphical object events. Object name change history
Graphics in DoEasy library (Part 91): Standard graphical object events. Object name change history

Graphics in DoEasy library (Part 91): Standard graphical object events. Object name change history

In this article, I will refine the basic functionality for providing control over graphical object events from a library-based program. I will start from implementing the functionality for storing the graphical object change history using the "Object name" property as an example.
preview
Developing a trading Expert Advisor from scratch (Part 15): Accessing data on the web (I)

Developing a trading Expert Advisor from scratch (Part 15): Accessing data on the web (I)

How to access online data via MetaTrader 5? There are a lot of websites and places on the web, featuring a huge amount information. What you need to know is where to look and how best to use this information.
preview
Neural networks made easy (Part 14): Data clustering

Neural networks made easy (Part 14): Data clustering

It has been more than a year since I published my last article. This is quite a lot time to revise ideas and to develop new approaches. In the new article, I would like to divert from the previously used supervised learning method. This time we will dip into unsupervised learning algorithms. In particular, we will consider one of the clustering algorithms—k-means.
preview
Testing different Moving Average types to see how insightful they are

Testing different Moving Average types to see how insightful they are

We all know the importance of the Moving Average indicator for a lot of traders. There are other Moving average types that can be useful in trading, we will identify these types in this article and make a simple comparison between each one of them and the most popular simple Moving average type to see which one can show the best results.
preview
Learn how to design a trading system by Accumulation/Distribution (AD)

Learn how to design a trading system by Accumulation/Distribution (AD)

Welcome to the new article from our series about learning how to design trading systems based on the most popular technical indicators. In this article, we will learn about a new technical indicator called Accumulation/Distribution indicator and find out how to design an MQL5 trading system based on simple AD trading strategies.
preview
Cycle analysis using the Goertzel algorithm

Cycle analysis using the Goertzel algorithm

In this article we present code utilities that implement the goertzel algorithm in Mql5 and explore two ways in which the technique can be used in the analysis of price quotes for possible strategy development.
Other classes in DoEasy library (Part 69): Chart object collection class
Other classes in DoEasy library (Part 69): Chart object collection class

Other classes in DoEasy library (Part 69): Chart object collection class

With this article, I start the development of the chart object collection class. The class will store the collection list of chart objects with their subwindows and indicators providing the ability to work with any selected charts and their subwindows or with a list of several charts at once.
preview
Visual evaluation of optimization results

Visual evaluation of optimization results

In this article, we will consider how to build graphs of all optimization passes and to select the optimal custom criterion. We will also see how to create a desired solution with little MQL5 knowledge, using the articles published on the website and forum comments.
Arranging a mailing campaign by means of Google services
Arranging a mailing campaign by means of Google services

Arranging a mailing campaign by means of Google services

A trader may want to arrange a mailing campaign to maintain business relationships with other traders, subscribers, clients or friends. Besides, there may be a necessity to send screenshotas, logs or reports. These may not be the most frequently arising tasks but having such a feature is clearly an advantage. The article deals with using several Google services simultaneously, developing an appropriate assembly on C# and integrating it with MQL tools.
preview
Developing a trading Expert Advisor from scratch (Part 16): Accessing data on the web (II)

Developing a trading Expert Advisor from scratch (Part 16): Accessing data on the web (II)

Knowing how to input data from the Web into an Expert Advisor is not so obvious. It is not so easy to do without understanding all the possibilities offered by MetaTrader 5.
preview
Build Self Optmising Expert Advisors in MQL5

Build Self Optmising Expert Advisors in MQL5

Build expert advisors that look forward and adjust themselves to any market.
preview
DoEasy. Controls (Part 15): TabControl WinForms object — several rows of tab headers, tab handling methods

DoEasy. Controls (Part 15): TabControl WinForms object — several rows of tab headers, tab handling methods

In this article, I will continue working on the TabControl WinForm object — I will create a tab field object class, make it possible to arrange tab headers in several rows and add methods for handling object tabs.
Calculating mathematical expressions (Part 2). Pratt and shunting yard parsers
Calculating mathematical expressions (Part 2). Pratt and shunting yard parsers

Calculating mathematical expressions (Part 2). Pratt and shunting yard parsers

In this article, we consider the principles of mathematical expression parsing and evaluation using parsers based on operator precedence. We will implement Pratt and shunting-yard parser, byte-code generation and calculations by this code, as well as view how to use indicators as functions in expressions and how to set up trading signals in Expert Advisors based on these indicators.
Prices in DoEasy library (part 61): Collection of symbol tick series
Prices in DoEasy library (part 61): Collection of symbol tick series

Prices in DoEasy library (part 61): Collection of symbol tick series

Since a program may use different symbols in its work, a separate list should be created for each of them. In this article, I will combine such lists into a tick data collection. In fact, this will be a regular list based on the class of dynamic array of pointers to instances of CObject class and its descendants of the Standard library.
Continuous futures contracts in MetaTrader 5
Continuous futures contracts in MetaTrader 5

Continuous futures contracts in MetaTrader 5

A short life span of futures contracts complicates their technical analysis. It is difficult to technically analyze short charts. For example, number of bars on the day chart of the UX-9.13 Ukrainian Stock index future is more than 100. Therefore, trader creates synthetic long futures contracts. This article explains how to splice futures contracts with different dates in the MetaTrader 5 terminal.
Interview with Leonid Velichkovsky: "The Biggest Myth about Neural Networks is Super-Profitability" (ATC 2010)
Interview with Leonid Velichkovsky: "The Biggest Myth about Neural Networks is Super-Profitability" (ATC 2010)

Interview with Leonid Velichkovsky: "The Biggest Myth about Neural Networks is Super-Profitability" (ATC 2010)

The hero of our interview Leonid Velichkovski (LeoV) has already participated in Automated Trading Championships. In 2008, his multicurrency neural network was like a bright flash in the sky, earning $110,000 in a certain moment, but eventually fell victim to its own aggressive money management. Two years ago, in his interview Leonid share his own trading experience and told us about the features of his Expert Advisor. On the eve of the ATC 2010, Leonid talks about the most common myths and misconceptions associated with neural networks.
preview
Data Science and Machine Learning (Part 05): Decision Trees

Data Science and Machine Learning (Part 05): Decision Trees

Decision trees imitate the way humans think to classify data. Let's see how to build trees and use them to classify and predict some data. The main goal of the decision trees algorithm is to separate the data with impurity and into pure or close to nodes.
preview
Developing a trading Expert Advisor from scratch (Part 12): Times and Trade (I)

Developing a trading Expert Advisor from scratch (Part 12): Times and Trade (I)

Today we will create Times & Trade with fast interpretation to read the order flow. It is the first part in which we will build the system. In the next article, we will complete the system with the missing information. To implement this new functionality, we will need to add several new things to the code of our Expert Advisor.
preview
Metamodels in machine learning and trading: Original timing of trading orders

Metamodels in machine learning and trading: Original timing of trading orders

Metamodels in machine learning: Auto creation of trading systems with little or no human intervention — The model decides when and how to trade on its own.
preview
Building and testing Keltner Channel trading systems

Building and testing Keltner Channel trading systems

In this article, we will try to provide trading systems using a very important concept in the financial market which is volatility. We will provide a trading system based on the Keltner Channel indicator after understanding it and how we can code it and how we can create a trading system based on a simple trading strategy and then test it on different assets.
preview
DirectX Tutorial (Part I): Drawing the first triangle

DirectX Tutorial (Part I): Drawing the first triangle

It is an introductory article on DirectX, which describes specifics of operation with the API. It should help to understand the order in which its components are initialized. The article contains an example of how to write an MQL5 script which renders a triangle using DirectX.
preview
Creating an EA that works automatically (Part 14): Automation (VI)

Creating an EA that works automatically (Part 14): Automation (VI)

In this article, we will put into practice all the knowledge from this series. We will finally build a 100% automated and functional system. But before that, we still have to learn one last detail.
preview
Developing a trading Expert Advisor from scratch (Part 29): The talking platform

Developing a trading Expert Advisor from scratch (Part 29): The talking platform

In this article, we will learn how to make the MetaTrader 5 platform talk. What if we make the EA more fun? Financial market trading is often too boring and monotonous, but we can make this job less tiring. Please note that this project can be dangerous for those who experience problems such as addiction. However, in a general case, it just makes things less boring.
Timeseries in DoEasy library (part 44): Collection class of indicator buffer objects
Timeseries in DoEasy library (part 44): Collection class of indicator buffer objects

Timeseries in DoEasy library (part 44): Collection class of indicator buffer objects

The article deals with creating a collection class of indicator buffer objects. I am going to test the ability to create and work with any number of buffers for indicators (the maximum number of buffers that can be created in MQL indicators is 512).
Graphics in DoEasy library (Part 82): Library objects refactoring and collection of graphical objects
Graphics in DoEasy library (Part 82): Library objects refactoring and collection of graphical objects

Graphics in DoEasy library (Part 82): Library objects refactoring and collection of graphical objects

In this article, I will improve all library objects by assigning a unique type to each object and continue the development of the library graphical objects collection class.
Interview with Anton Nel (ATC 2012)
Interview with Anton Nel (ATC 2012)

Interview with Anton Nel (ATC 2012)

Today we talk to Anton Nel (ROMAN5) from South Africa, a professional developer of automated trading systems. Obviously, his Expert Advisor just could not go unnoticed. Breaking into the top ten from the very start of the Championship, it has been holding the first place for more than a week.
Mountain or Iceberg charts
Mountain or Iceberg charts

Mountain or Iceberg charts

How do you like the idea of adding a new chart type to the MetaTrader 5 platform? Some people say it lacks a few things that other platforms offer. But the truth is, MetaTrader 5 is a very practical platform as it allows you to do things that can't be done (or at least can't be done easily) in many other platforms.
Graphics in DoEasy library (Part 96): Graphics in form objects and handling mouse events
Graphics in DoEasy library (Part 96): Graphics in form objects and handling mouse events

Graphics in DoEasy library (Part 96): Graphics in form objects and handling mouse events

In this article, I will start creating the functionality for handling mouse events in form objects, as well as add new properties and their tracking to a symbol object. Besides, I will improve the symbol object class since the chart symbols now have new properties to be considered and tracked.
preview
Neural networks made easy (Part 19): Association rules using MQL5

Neural networks made easy (Part 19): Association rules using MQL5

We continue considering association rules. In the previous article, we have discussed theoretical aspect of this type of problem. In this article, I will show the implementation of the FP Growth method using MQL5. We will also test the implemented solution using real data.
preview
Creating an EA that works automatically (Part 05): Manual triggers (II)

Creating an EA that works automatically (Part 05): Manual triggers (II)

Today we'll see how to create an Expert Advisor that simply and safely works in automatic mode. At the end of the previous article, I suggested that it would be appropriate to allow manual use of the EA, at least for a while.
Selection and navigation utility in MQL5 and MQL4: Adding "homework" tabs and saving graphical objects
Selection and navigation utility in MQL5 and MQL4: Adding "homework" tabs and saving graphical objects

Selection and navigation utility in MQL5 and MQL4: Adding "homework" tabs and saving graphical objects

In this article, we are going to expand the capabilities of the previously created utility by adding tabs for selecting the symbols we need. We will also learn how to save graphical objects we have created on the specific symbol chart, so that we do not have to constantly create them again. Besides, we will find out how to work only with symbols that have been preliminarily selected using a specific website.
preview
Non-linear indicators

Non-linear indicators

In this article, I will make an attempt to consider some ways of building non-linear indicators and their use in trading. There are quite a few indicators in the MetaTrader trading platform that use non-linear approaches.
preview
Population optimization algorithms: Bacterial Foraging Optimization (BFO)

Population optimization algorithms: Bacterial Foraging Optimization (BFO)

E. coli bacterium foraging strategy inspired scientists to create the BFO optimization algorithm. The algorithm contains original ideas and promising approaches to optimization and is worthy of further study.
preview
Neural networks made easy (Part 28): Policy gradient algorithm

Neural networks made easy (Part 28): Policy gradient algorithm

We continue to study reinforcement learning methods. In the previous article, we got acquainted with the Deep Q-Learning method. In this method, the model is trained to predict the upcoming reward depending on the action taken in a particular situation. Then, an action is performed in accordance with the policy and the expected reward. But it is not always possible to approximate the Q-function. Sometimes its approximation does not generate the desired result. In such cases, approximation methods are applied not to utility functions, but to a direct policy (strategy) of actions. One of such methods is Policy Gradient.
preview
How to create a custom Donchian Channel indicator using MQL5

How to create a custom Donchian Channel indicator using MQL5

There are many technical tools that can be used to visualize a channel surrounding prices, One of these tools is the Donchian Channel indicator. In this article, we will learn how to create the Donchian Channel indicator and how we can trade it as a custom indicator using EA.