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
Creating an EA that works automatically (Part 03): New functions

Creating an EA that works automatically (Part 03): New functions

Today we'll see how to create an Expert Advisor that simply and safely works in automatic mode. In the previous article, we started to develop an order system that we will use in our automated EA. However, we have created only one of the necessary functions.
preview
Neural networks made easy (Part 36): Relational Reinforcement Learning

Neural networks made easy (Part 36): Relational Reinforcement Learning

In the reinforcement learning models we discussed in previous article, we used various variants of convolutional networks that are able to identify various objects in the original data. The main advantage of convolutional networks is the ability to identify objects regardless of their location. At the same time, convolutional networks do not always perform well when there are various deformations of objects and noise. These are the issues which the relational model can solve.
preview
Learn how to design a trading system by Bill Williams' MFI

Learn how to design a trading system by Bill Williams' MFI

This is a new article in the series in which we learn how to design a trading system based on popular technical indicators. This time we will cover Bill Williams' Market Facilitation Index (BW MFI).
The Role of Statistical Distributions in Trader's Work
The Role of Statistical Distributions in Trader's Work

The Role of Statistical Distributions in Trader's Work

This article is a logical continuation of my article Statistical Probability Distributions in MQL5 which set forth the classes for working with some theoretical statistical distributions. Now that we have a theoretical base, I suggest that we should directly proceed to real data sets and try to make some informational use of this base.
Tips for Purchasing a Product on the Market. Step-By-Step Guide
Tips for Purchasing a Product on the Market. Step-By-Step Guide

Tips for Purchasing a Product on the Market. Step-By-Step Guide

This step-by-step guide provides tips and tricks for better understanding and searching for a required product. The article makes an attempt to puzzle out different methods of searching for an appropriate product, sorting out unwanted products, determining product efficiency and essentiality for you.
The Most Active MQL5.community Members Have Been Awarded iPhones!
The Most Active MQL5.community Members Have Been Awarded iPhones!

The Most Active MQL5.community Members Have Been Awarded iPhones!

After we decided to reward the most outstanding MQL5.com participants, we have selected the key criteria to determine each participant's contribution to the Community development. As a result, we have the following champions who published the greatest amount of articles on the website - investeo (11 articles) and victorg (10 articles), and who submitted their programs to Code Base – GODZILLA (340 programs), Integer (61 programs) and abolk (21 programs).
preview
Data Science and Machine Learning (Part 09): The K-Nearest Neighbors Algorithm (KNN)

Data Science and Machine Learning (Part 09): The K-Nearest Neighbors Algorithm (KNN)

This is a lazy algorithm that doesn't learn from the training dataset, it stores the dataset instead and acts immediately when it's given a new sample. As simple as it is, it is used in a variety of real-world applications.
preview
Simple Mean Reversion Trading Strategy

Simple Mean Reversion Trading Strategy

Mean reversion is a type of contrarian trading where the trader expects the price to return to some form of equilibrium which is generally measured by a mean or another central tendency statistic.
Graphics in DoEasy library (Part 87): Graphical object collection - managing object property modification on all open charts
Graphics in DoEasy library (Part 87): Graphical object collection - managing object property modification on all open charts

Graphics in DoEasy library (Part 87): Graphical object collection - managing object property modification on all open charts

In this article, I will continue my work on tracking standard graphical object events and create the functionality allowing users to control changes in the properties of graphical objects placed on any charts opened in the terminal.
preview
Category Theory in MQL5 (Part 16): Functors with Multi-Layer Perceptrons

Category Theory in MQL5 (Part 16): Functors with Multi-Layer Perceptrons

This article, the 16th in our series, continues with a look at Functors and how they can be implemented using artificial neural networks. We depart from our approach so far in the series, that has involved forecasting volatility and try to implement a custom signal class for setting position entry and exit signals.
preview
Trader-friendly stop loss and take profit

Trader-friendly stop loss and take profit

Stop loss and take profit can have a significant impact on trading results. In this article, we will look at several ways to find optimal stop order values.
preview
DoEasy. Controls (Part 2): Working on the CPanel class

DoEasy. Controls (Part 2): Working on the CPanel class

In the current article, I will get rid of some errors related to handling graphical elements and continue the development of the CPanel control. In particular, I will implement the methods for setting the parameters of the font used by default for all panel text objects.
preview
Complex indicators made easy using objects

Complex indicators made easy using objects

This article provides a method to create complex indicators while also avoiding the problems that arise when dealing with multiple plots, buffers and/or combining data from multiple sources.
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
Neural networks made easy (Part 27): Deep Q-Learning (DQN)

Neural networks made easy (Part 27): Deep Q-Learning (DQN)

We continue to study reinforcement learning. In this article, we will get acquainted with the Deep Q-Learning method. The use of this method has enabled the DeepMind team to create a model that can outperform a human when playing Atari computer games. I think it will be useful to evaluate the possibilities of the technology for solving trading problems.
preview
Neural networks made easy (Part 30): Genetic algorithms

Neural networks made easy (Part 30): Genetic algorithms

Today I want to introduce you to a slightly different learning method. We can say that it is borrowed from Darwin's theory of evolution. It is probably less controllable than the previously discussed methods but it allows training non-differentiable models.
preview
Matrix and Vector operations in MQL5

Matrix and Vector operations in MQL5

Matrices and vectors have been introduced in MQL5 for efficient operations with mathematical solutions. The new types offer built-in methods for creating concise and understandable code that is close to mathematical notation. Arrays provide extensive capabilities, but there are many cases in which matrices are much more efficient.
preview
Creating an EA that works automatically (Part 15): Automation (VII)

Creating an EA that works automatically (Part 15): Automation (VII)

To complete this series of articles on automation, we will continue discussing the topic of the previous article. We will see how everything will fit together, making the EA run like clockwork.
preview
Neural networks made easy (Part 26): Reinforcement Learning

Neural networks made easy (Part 26): Reinforcement Learning

We continue to study machine learning methods. With this article, we begin another big topic, Reinforcement Learning. This approach allows the models to set up certain strategies for solving the problems. We can expect that this property of reinforcement learning will open up new horizons for building trading strategies.
preview
Timeseries in DoEasy library (part 49): Multi-period multi-symbol multi-buffer standard indicators

Timeseries in DoEasy library (part 49): Multi-period multi-symbol multi-buffer standard indicators

In the current article, I will improve the library classes to implement the ability to develop multi-symbol multi-period standard indicators requiring several indicator buffers to display their data.
preview
Creating an EA that works automatically (Part 04): Manual triggers (I)

Creating an EA that works automatically (Part 04): Manual triggers (I)

Today we'll see how to create an Expert Advisor that simply and safely works in automatic mode.
DIY technical indicator
DIY technical indicator

DIY technical indicator

In this article, I will consider the algorithms allowing you to create your own technical indicator. You will learn how to obtain pretty complex and interesting results with very simple initial assumptions.
preview
Timeseries in DoEasy library (part 56): Custom indicator object, get data from indicator objects in the collection

Timeseries in DoEasy library (part 56): Custom indicator object, get data from indicator objects in the collection

The article considers creation of the custom indicator object for the use in EAs. Let’s slightly improve library classes and add methods to get data from indicator objects in EAs.
preview
How to deal with lines using MQL5

How to deal with lines using MQL5

In this article, you will find your way to deal with the most important lines like trendlines, support, and resistance by MQL5.
preview
Building and testing Aroon Trading Systems

Building and testing Aroon Trading Systems

In this article, we will learn how we can build an Aroon trading system after learning the basics of the indicators and the needed steps to build a trading system based on the Aroon indicator. After building this trading system, we will test it to see if it can be profitable or needs more optimization.
How to create and test custom MOEX symbols in MetaTrader 5
How to create and test custom MOEX symbols in MetaTrader 5

How to create and test custom MOEX symbols in MetaTrader 5

The article describes the creation of a custom exchange symbol using the MQL5 language. In particular, it considers the use of exchange quotes from the popular Finam website. Another option considered in this article is the possibility to work with an arbitrary format of text files used in the creation of the custom symbol. This allows working with any financial symbols and data sources. After creating a custom symbol, we can use all the capabilities of the MetaTrader 5 Strategy Tester to test trading algorithms for exchange instruments.
preview
Experiments with neural networks (Part 6): Perceptron as a self-sufficient tool for price forecast

Experiments with neural networks (Part 6): Perceptron as a self-sufficient tool for price forecast

The article provides an example of using a perceptron as a self-sufficient price prediction tool by showcasing general concepts and the simplest ready-made Expert Advisor followed by the results of its optimization.
preview
Learn how to design a trading system by Chaikin Oscillator

Learn how to design a trading system by Chaikin Oscillator

Welcome to our new article from our series about learning how to design a trading system by the most popular technical indicator. Through this new article, we will learn how to design a trading system by the Chaikin Oscillator indicator.
Other classes in DoEasy library (Part 68): Chart window object class and indicator object classes in the chart window
Other classes in DoEasy library (Part 68): Chart window object class and indicator object classes in the chart window

Other classes in DoEasy library (Part 68): Chart window object class and indicator object classes in the chart window

In this article, I will continue the development of the chart object class. I will add the list of chart window objects featuring the lists of available indicators.
Graphics in DoEasy library (Part 79): "Animation frame" object class and its descendant objects
Graphics in DoEasy library (Part 79): "Animation frame" object class and its descendant objects

Graphics in DoEasy library (Part 79): "Animation frame" object class and its descendant objects

In this article, I will develop the class of a single animation frame and its descendants. The class is to allow drawing shapes while maintaining and then restoring the background under them.
preview
Population optimization algorithms: Ant Colony Optimization (ACO)

Population optimization algorithms: Ant Colony Optimization (ACO)

This time I will analyze the Ant Colony optimization algorithm. The algorithm is very interesting and complex. In the article, I make an attempt to create a new type of ACO.
Creating a "Snake" Game in MQL5
Creating a "Snake" Game in MQL5

Creating a "Snake" Game in MQL5

This article describes an example of "Snake" game programming. In MQL5, the game programming became possible primarily due to event handling features. The object-oriented programming greatly simplifies this process. In this article, you will learn the event processing features, the examples of use of the Standard MQL5 Library classes and details of periodic function calls.
Tales of Trading Robots: Is Less More?
Tales of Trading Robots: Is Less More?

Tales of Trading Robots: Is Less More?

Two years ago in "The Last Crusade" we reviewed quite an interesting yet currently not widely used method for displaying market information - point and figure charts. Now I suggest you try to write a trading robot based on the patterns detected on the point and figure chart.
Other classes in DoEasy library (Part 71): Chart object collection events
Other classes in DoEasy library (Part 71): Chart object collection events

Other classes in DoEasy library (Part 71): Chart object collection events

In this article, I will create the functionality for tracking some chart object events — adding/removing symbol charts and chart subwindows, as well as adding/removing/changing indicators in chart windows.
preview
Learn how to design a trading system by Force Index

Learn how to design a trading system by Force Index

Welcome to a new article in our series about how to design a trading system by the most popular technical indicators. In this article, we will learn about a new technical indicator and how to create a trading system using the Force Index indicator.
preview
Data Science and Machine Learning (Part 10): Ridge Regression

Data Science and Machine Learning (Part 10): Ridge Regression

Ridge regression is a simple technique to reduce model complexity and prevent over-fitting which may result from simple linear regression
preview
Rebuy algorithm: Multicurrency trading simulation

Rebuy algorithm: Multicurrency trading simulation

In this article, we will create a mathematical model for simulating multicurrency pricing and complete the study of the diversification principle as part of the search for mechanisms to increase the trading efficiency, which I started in the previous article with theoretical calculations.
Connection of Expert Advisor with ICQ in MQL5
Connection of Expert Advisor with ICQ in MQL5

Connection of Expert Advisor with ICQ in MQL5

This article describes the method of information exchange between the Expert Advisor and ICQ users, several examples are presented. The provided material will be interesting for those, who wish to receive trading information remotely from a client terminal, through an ICQ client in their mobile phone or PDA.
Better Programmer (Part 04): How to become a faster developer
Better Programmer (Part 04): How to become a faster developer

Better Programmer (Part 04): How to become a faster developer

Every developer wants to be able to write code faster, and being able to code faster and effective is not some kind of special ability that only a few people are born with. It's a skill that can be learned by every coder, regardless of years of experience on the keyboard.
MQL5 Cookbook: Reducing the Effect of Overfitting and Handling the Lack of Quotes
MQL5 Cookbook: Reducing the Effect of Overfitting and Handling the Lack of Quotes

MQL5 Cookbook: Reducing the Effect of Overfitting and Handling the Lack of Quotes

Whatever trading strategy you use, there will always be a question of what parameters to choose to ensure future profits. This article gives an example of an Expert Advisor with a possibility to optimize multiple symbol parameters at the same time. This method is intended to reduce the effect of overfitting parameters and handle situations where data from a single symbol are not enough for the study.