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
MQL5 Cookbook — Macroeconomic events database

MQL5 Cookbook — Macroeconomic events database

The article discusses the possibilities of handling databases based on the SQLite engine. The CDatabase class has been formed for convenience and efficient use of OOP principles. It is subsequently involved in the creation and management of the database of macroeconomic events. The article provides the examples of using multiple methods of the CDatabase class.
preview
Neural networks made easy (Part 16): Practical use of clustering

Neural networks made easy (Part 16): Practical use of clustering

In the previous article, we have created a class for data clustering. In this article, I want to share variants of the possible application of obtained results in solving practical trading tasks.
preview
Developing a Replay System — Market simulation (Part 06): First improvements (I)

Developing a Replay System — Market simulation (Part 06): First improvements (I)

In this article, we will begin to stabilize the entire system, without which we might not be able to proceed to the next steps.
preview
Developing a trading Expert Advisor from scratch (Part 13): Time and Trade (II)

Developing a trading Expert Advisor from scratch (Part 13): Time and Trade (II)

Today we will construct the second part of the Times & Trade system for market analysis. In the previous article "Times & Trade (I)" we discussed an alternative chart organization system, which would allow having an indicator for the quickest possible interpretation of deals executed in the market.
preview
Ready-made templates for including indicators to Expert Advisors (Part 3): Trend indicators

Ready-made templates for including indicators to Expert Advisors (Part 3): Trend indicators

In this reference article, we will look at standard indicators from the Trend Indicators category. We will create ready-to-use templates for indicator use in EAs - declaring and setting parameters, indicator initialization and deinitialization, as well as receiving data and signals from indicator buffers in EAs.
preview
DoEasy. Controls (Part 6): Panel control, auto resizing the container to fit inner content

DoEasy. Controls (Part 6): Panel control, auto resizing the container to fit inner content

In the article, I will continue my work on the Panel WinForms object and implement its auto resizing to fit the general size of Dock objects located inside the panel. Besides, I will add the new properties to the Symbol library object.
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.
preview
Developing a Replay System — Market simulation (Part 21): FOREX (II)

Developing a Replay System — Market simulation (Part 21): FOREX (II)

We will continue to build a system for working in the FOREX market. In order to solve this problem, we must first declare the loading of ticks before loading the previous bars. This solves the problem, but at the same time forces the user to follow some structure in the configuration file, which, personally, does not make much sense to me. The reason is that by designing a program that is responsible for analyzing and executing what is in the configuration file, we can allow the user to declare the elements he needs in any order.
Interview with Sergey Abramov (ATC 2012)
Interview with Sergey Abramov (ATC 2012)

Interview with Sergey Abramov (ATC 2012)

The trading robot of Sergey Abramov (26405) is staying in TOP-10 since the second week. However, it caused much anxiety for its developer. As it turned out, the robot contains a small error in position close block. The robot has been developed almost exclusively on the basis of the past years' results.
preview
Timeseries in DoEasy library (part 52): Cross-platform nature of multi-period multi-symbol  single-buffer standard indicators

Timeseries in DoEasy library (part 52): Cross-platform nature of multi-period multi-symbol single-buffer standard indicators

In the article, consider creation of multi-symbol multi-period standard indicator Accumulation/Distribution. Slightly improve library classes with respect to indicators so that, the programs developed for outdated platform MetaTrader 4 based on this library could work normally when switching over to MetaTrader 5.
preview
Continuous walk-forward optimization (Part 8): Program improvements and fixes

Continuous walk-forward optimization (Part 8): Program improvements and fixes

The program has been modified based on comments and requests from users and readers of this article series. This article contains a new version of the auto optimizer. This version implements requested features and provides other improvements, which I found when working with the program.
preview
Data Science and Machine Learning (Part 07): Polynomial Regression

Data Science and Machine Learning (Part 07): Polynomial Regression

Unlike linear regression, polynomial regression is a flexible model aimed to perform better at tasks the linear regression model could not handle, Let's find out how to make polynomial models in MQL5 and make something positive out of it.
preview
Tips from a professional programmer (Part III): Logging. Connecting to the Seq log collection and analysis system

Tips from a professional programmer (Part III): Logging. Connecting to the Seq log collection and analysis system

Implementation of the Logger class for unifying and structuring messages which are printed to the Experts log. Connection to the Seq log collection and analysis system. Monitoring log messages online.
Interview with Sergey Pankratyev (ATC 2012)
Interview with Sergey Pankratyev (ATC 2012)

Interview with Sergey Pankratyev (ATC 2012)

The Championship is coming to an end leaving us with vivid impressions of many unusual trading strategies. However, the trading robot of Sergey Pankratyev (s75) is showing really peculiar things - it is trading all 12 currency pairs opening only long positions. It is not an error but just a response to some certain market conditions.
preview
Creating a ticker tape panel: Improved version

Creating a ticker tape panel: Improved version

How do you like the idea of reviving the basic version of our ticker tape panel? The first thing we will do is change the panel to be able to add an image, such as an asset logo or some other image, so that the user could quickly and easily identify the displayed symbol.
preview
Neural networks made easy (Part 67): Using past experience to solve new tasks

Neural networks made easy (Part 67): Using past experience to solve new tasks

In this article, we continue discussing methods for collecting data into a training set. Obviously, the learning process requires constant interaction with the environment. However, situations can be different.
Who Is Who in MQL5.community?
Who Is Who in MQL5.community?

Who Is Who in MQL5.community?

The MQL5.com website remembers all of you quite well! How many of your threads are epic, how popular your articles are and how often your programs in the Code Base are downloaded – this is only a small part of what is remembered at MQL5.com. Your achievements are available in your profile, but what about the overall picture? In this article we will show the general picture of all MQL5.community members achievements.
preview
Master MQL5 from beginner to pro (Part I): Getting started with programming

Master MQL5 from beginner to pro (Part I): Getting started with programming

This article is an introduction to a series of articles about programming. It is assumed here that the reader has never dealt with programming before. So, this series starts from the very basics. Programming knowledge level: Absolute Beginner.
preview
Backpropagation Neural Networks using MQL5 Matrices

Backpropagation Neural Networks using MQL5 Matrices

The article describes the theory and practice of applying the backpropagation algorithm in MQL5 using matrices. It provides ready-made classes along with script, indicator and Expert Advisor examples.
preview
Population optimization algorithms: Gravitational Search Algorithm (GSA)

Population optimization algorithms: Gravitational Search Algorithm (GSA)

GSA is a population optimization algorithm inspired by inanimate nature. Thanks to Newton's law of gravity implemented in the algorithm, the high reliability of modeling the interaction of physical bodies allows us to observe the enchanting dance of planetary systems and galactic clusters. In this article, I will consider one of the most interesting and original optimization algorithms. The simulator of the space objects movement is provided as well.
preview
Forecasting with ARIMA models in MQL5

Forecasting with ARIMA models in MQL5

In this article we continue the development of the CArima class for building ARIMA models by adding intuitive methods that enable forecasting.
preview
Neural networks made easy (Part 25): Practicing Transfer Learning

Neural networks made easy (Part 25): Practicing Transfer Learning

In the last two articles, we developed a tool for creating and editing neural network models. Now it is time to evaluate the potential use of Transfer Learning technology using practical examples.
Interview with Mariusz Zarnowski (ATC 2012)
Interview with Mariusz Zarnowski (ATC 2012)

Interview with Mariusz Zarnowski (ATC 2012)

As December 28 is approaching, the list of leaders of the Automated Trading Championship 2012 is becoming clearer. With only two weeks to go until the end of the Championship, Mariusz Zarnowski (zrn) from Poland stands a good chance to be in the top three. His EA has already demonstrated how it can triple the initial deposit in just a couple of weeks.
preview
Developing a trading Expert Advisor from scratch (Part 10): Accessing custom indicators

Developing a trading Expert Advisor from scratch (Part 10): Accessing custom indicators

How to access custom indicators directly in an Expert Advisor? A trading EA can be truly useful only if it can use custom indicators; otherwise, it is just a set of codes and instructions.
preview
Neural networks made easy (Part 49): Soft Actor-Critic

Neural networks made easy (Part 49): Soft Actor-Critic

We continue our discussion of reinforcement learning algorithms for solving continuous action space problems. In this article, I will present the Soft Actor-Critic (SAC) algorithm. The main advantage of SAC is the ability to find optimal policies that not only maximize the expected reward, but also have maximum entropy (diversity) of actions.
preview
Population optimization algorithms: Grey Wolf Optimizer (GWO)

Population optimization algorithms: Grey Wolf Optimizer (GWO)

Let's consider one of the newest modern optimization algorithms - Grey Wolf Optimization. The original behavior on test functions makes this algorithm one of the most interesting among the ones considered earlier. This is one of the top algorithms for use in training neural networks, smooth functions with many variables.
preview
Graphics in DoEasy library (Part 100): Making improvements in handling extended standard graphical objects

Graphics in DoEasy library (Part 100): Making improvements in handling extended standard graphical objects

In the current article, I will eliminate obvious flaws in simultaneous handling of extended (and standard) graphical objects and form objects on canvas, as well as fix errors detected during the test performed in the previous article. The article concludes this section of the library description.
Graphics in DoEasy library (Part 85): Graphical object collection - adding newly created objects
Graphics in DoEasy library (Part 85): Graphical object collection - adding newly created objects

Graphics in DoEasy library (Part 85): Graphical object collection - adding newly created objects

In this article, I will complete the development of the descendant classes of the abstract graphical object class and start implementing the ability to store these objects in the collection class. In particular, I will create the functionality for adding newly created standard graphical objects to the collection class.
preview
Data Science and Machine Learning (Part 06): Gradient Descent

Data Science and Machine Learning (Part 06): Gradient Descent

The gradient descent plays a significant role in training neural networks and many machine learning algorithms. It is a quick and intelligent algorithm despite its impressive work it is still misunderstood by a lot of data scientists let's see what it is all about.
preview
Introduction to MQL5 (Part 1): A Beginner's Guide into Algorithmic Trading

Introduction to MQL5 (Part 1): A Beginner's Guide into Algorithmic Trading

Dive into the fascinating realm of algorithmic trading with our beginner-friendly guide to MQL5 programming. Discover the essentials of MQL5, the language powering MetaTrader 5, as we demystify the world of automated trading. From understanding the basics to taking your first steps in coding, this article is your key to unlocking the potential of algorithmic trading even without a programming background. Join us on a journey where simplicity meets sophistication in the exciting universe of MQL5.
preview
Studying PrintFormat() and applying ready-made examples

Studying PrintFormat() and applying ready-made examples

The article will be useful for both beginners and experienced developers. We will look at the PrintFormat() function, analyze examples of string formatting and write templates for displaying various information in the terminal log.
preview
Data Science and Machine Learning (Part 13): Improve your financial market analysis with Principal Component Analysis (PCA)

Data Science and Machine Learning (Part 13): Improve your financial market analysis with Principal Component Analysis (PCA)

Revolutionize your financial market analysis with Principal Component Analysis (PCA)! Discover how this powerful technique can unlock hidden patterns in your data, uncover latent market trends, and optimize your investment strategies. In this article, we explore how PCA can provide a new lens for analyzing complex financial data, revealing insights that would be missed by traditional approaches. Find out how applying PCA to financial market data can give you a competitive edge and help you stay ahead of the curve
preview
Experiments with neural networks (Part 2): Smart neural network optimization

Experiments with neural networks (Part 2): Smart neural network optimization

In this article, I will use experimentation and non-standard approaches to develop a profitable trading system and check whether neural networks can be of any help for traders. MetaTrader 5 as a self-sufficient tool for using neural networks in trading.
preview
Developing a trading Expert Advisor from scratch (Part 11): Cross order system

Developing a trading Expert Advisor from scratch (Part 11): Cross order system

In this article we will create a system of cross orders. There is one type of assets that makes traders' life very difficult for traders — futures contracts. But why do they make life difficult?
preview
Revisiting Murray system

Revisiting Murray system

Graphical price analysis systems are deservedly popular among traders. In this article, I am going to describe the complete Murray system, including its famous levels, as well as some other useful techniques for assessing the current price position and making a trading decision.
Population optimization algorithms
Population optimization algorithms

Population optimization algorithms

This is an introductory article on optimization algorithm (OA) classification. The article attempts to create a test stand (a set of functions), which is to be used for comparing OAs and, perhaps, identifying the most universal algorithm out of all widely known ones.
preview
Neural networks made easy (Part 31): Evolutionary algorithms

Neural networks made easy (Part 31): Evolutionary algorithms

In the previous article, we started exploring non-gradient optimization methods. We got acquainted with the genetic algorithm. Today, we will continue this topic and will consider another class of evolutionary algorithms.
preview
Developing a Replay System — Market simulation (Part 20): FOREX (I)

Developing a Replay System — Market simulation (Part 20): FOREX (I)

The initial goal of this article is not to cover all the possibilities of Forex trading, but rather to adapt the system so that you can perform at least one market replay. We'll leave simulation for another moment. However, if we don't have ticks and only bars, with a little effort we can simulate possible trades that could happen in the Forex market. This will be the case until we look at how to adapt the simulator. An attempt to work with Forex data inside the system without modifying it leads to a range of errors.
preview
Developing a Replay System — Market simulation (Part 04): adjusting the settings (II)

Developing a Replay System — Market simulation (Part 04): adjusting the settings (II)

Let's continue creating the system and controls. Without the ability to control the service, it is difficult to move forward and improve the system.
preview
Neural networks made easy (Part 55): Contrastive intrinsic control (CIC)

Neural networks made easy (Part 55): Contrastive intrinsic control (CIC)

Contrastive training is an unsupervised method of training representation. Its goal is to train a model to highlight similarities and differences in data sets. In this article, we will talk about using contrastive training approaches to explore different Actor skills.