MQL4 and 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
Timeseries in DoEasy library (part 57): Indicator buffer data object

Timeseries in DoEasy library (part 57): Indicator buffer data object

In the article, develop an object which will contain all data of one buffer for one indicator. Such objects will be necessary for storing serial data of indicator buffers. With their help, it will be possible to sort and compare buffer data of any indicators, as well as other similar data with each other.
preview
Neural networks made easy (Part 23): Building a tool for Transfer Learning

Neural networks made easy (Part 23): Building a tool for Transfer Learning

In this series of articles, we have already mentioned Transfer Learning more than once. However, this was only mentioning. in this article, I suggest filling this gap and taking a closer look at Transfer Learning.
preview
Neural networks made easy (Part 20): Autoencoders

Neural networks made easy (Part 20): Autoencoders

We continue to study unsupervised learning algorithms. Some readers might have questions regarding the relevance of recent publications to the topic of neural networks. In this new article, we get back to studying neural networks.
preview
Developing a trading Expert Advisor from scratch (Part 27): Towards the future (II)

Developing a trading Expert Advisor from scratch (Part 27): Towards the future (II)

Let's move on to a more complete order system directly on the chart. In this article, I will show a way to fix the order system, or rather, to make it more intuitive.
Vladimir Tsyrulnik: The Essense of my program is improvisation! (ATC 2010)
Vladimir Tsyrulnik: The Essense of my program is improvisation! (ATC 2010)

Vladimir Tsyrulnik: The Essense of my program is improvisation! (ATC 2010)

Vladimir Tsyrulnik is the holder of one of the brightest highs of the current Championship. By the end of the third trading week Vladimir's Expert Advisor was on the sixth position. The IMEX algorithm the Expert Advisor is based on was developed by Vladimir. To learn more about this algorithm, we had an interview with Vladimir.
preview
Neural networks made easy (Part 50): Soft Actor-Critic (model optimization)

Neural networks made easy (Part 50): Soft Actor-Critic (model optimization)

In the previous article, we implemented the Soft Actor-Critic algorithm, but were unable to train a profitable model. Here we will optimize the previously created model to obtain the desired results.
preview
Neural networks made easy (Part 38): Self-Supervised Exploration via Disagreement

Neural networks made easy (Part 38): Self-Supervised Exploration via Disagreement

One of the key problems within reinforcement learning is environmental exploration. Previously, we have already seen the research method based on Intrinsic Curiosity. Today I propose to look at another algorithm: Exploration via Disagreement.
preview
DoEasy. Controls (Part 30): Animating the ScrollBar control

DoEasy. Controls (Part 30): Animating the ScrollBar control

In this article, I will continue the development of the ScrollBar control and start implementing the mouse interaction functionality. In addition, I will expand the lists of mouse state flags and events.
preview
Neural networks made easy (Part 43): Mastering skills without the reward function

Neural networks made easy (Part 43): Mastering skills without the reward function

The problem of reinforcement learning lies in the need to define a reward function. It can be complex or difficult to formalize. To address this problem, activity-based and environment-based approaches are being explored to learn skills without an explicit reward function.
Interview with Alexander Topchylo (ATC 2010)
Interview with Alexander Topchylo (ATC 2010)

Interview with Alexander Topchylo (ATC 2010)

Alexander Topchylo (Better) is the winner of the Automated Trading Championship 2007. Alexander is an expert in neural networks - his Expert Advisor based on a neural network was on top of best EAs of year 2007. In this interview Alexander tells us about his life after the Championships, his own business and new algorithms for trading systems.
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.
preview
Implementing the Generalized Hurst Exponent and the Variance Ratio test in MQL5

Implementing the Generalized Hurst Exponent and the Variance Ratio test in MQL5

In this article, we investigate how the Generalized Hurst Exponent and the Variance Ratio test can be utilized to analyze the behaviour of price series in MQL5.
preview
Population optimization algorithms: Stochastic Diffusion Search (SDS)

Population optimization algorithms: Stochastic Diffusion Search (SDS)

The article discusses Stochastic Diffusion Search (SDS), which is a very powerful and efficient optimization algorithm based on the principles of random walk. The algorithm allows finding optimal solutions in complex multidimensional spaces, while featuring a high speed of convergence and the ability to avoid local extrema.
Alexander Anufrenko: "A danger foreseen is half avoided" (ATC 2010)
Alexander Anufrenko: "A danger foreseen is half avoided" (ATC 2010)

Alexander Anufrenko: "A danger foreseen is half avoided" (ATC 2010)

The risky development of Alexander Anufrenko (Anufrenko321) had been featured among the top three of the Championship for three weeks. Having suffered a catastrophic Stop Loss last week, his Expert Advisor lost about $60,000, but now once again he is approaching the leaders. In this interview the author of this interesting EA is describing the operating principles and characteristics of his application.
Do Traders Need Services From Developers?
Do Traders Need Services From Developers?

Do Traders Need Services From Developers?

Algorithmic trading becomes more popular and needed, which naturally led to a demand for exotic algorithms and unusual tasks. To some extent, such complex applications are available in the Code Base or in the Market. Although traders have simple access to those apps in a couple of clicks, these apps may not satisfy all needs in full. In this case, traders look for developers who can write a desired application in the MQL5 Freelance section and assign an order.
Interview with Andrea Zani (ATC 2011)
Interview with Andrea Zani (ATC 2011)

Interview with Andrea Zani (ATC 2011)

On the eleventh week of the Automated Trading Championship, Andrea Zani (sbraer) got featured very close to the top five of the competition. It is on the sixth place with about 47,000 USD now. Andrea's Expert Advisor AZXY has made only one losing deal, which was at the very beginning of the Championship. Since then, its equity curve has been steadily growing.
preview
Design Patterns in software development and MQL5 (Part I): Creational Patterns

Design Patterns in software development and MQL5 (Part I): Creational Patterns

There are methods that can be used to solve many problems that can be repeated. Once understand how to use these methods it can be very helpful to create your software effectively and apply the concept of DRY ((Do not Repeat Yourself). In this context, the topic of Design Patterns will serve very well because they are patterns that provide solutions to well-described and repeated problems.
preview
DoEasy. Controls (Part 5): Base WinForms object, Panel control, AutoSize parameter

DoEasy. Controls (Part 5): Base WinForms object, Panel control, AutoSize parameter

In the article, I will create the base object of all library WinForms objects and start implementing the AutoSize property of the Panel WinForms object — auto sizing for fitting the object internal content.
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.
preview
Ready-made templates for including indicators to Expert Advisors (Part 1): Oscillators

Ready-made templates for including indicators to Expert Advisors (Part 1): Oscillators

The article considers standard indicators from the oscillator category. We will create ready-to-use templates for their use in EAs - declaring and setting parameters, indicator initialization and deinitialization, as well as receiving data and signals from indicator buffers in EAs.
Automated Choice of Brokerage Company for an Efficient Operation of Expert Advisors
Automated Choice of Brokerage Company for an Efficient Operation of Expert Advisors

Automated Choice of Brokerage Company for an Efficient Operation of Expert Advisors

It is not a secret that for an efficient operation of Expert Advisors we need to find a suitable brokerage company. This article describes a system approach to this search. You will get acquainted with the process of creating a program with dll for working with different terminals.
preview
Population optimization algorithms: Firefly Algorithm (FA)

Population optimization algorithms: Firefly Algorithm (FA)

In this article, I will consider the Firefly Algorithm (FA) optimization method. Thanks to the modification, the algorithm has turned from an outsider into a real rating table leader.
preview
Neural networks made easy (Part 66): Exploration problems in offline learning

Neural networks made easy (Part 66): Exploration problems in offline learning

Models are trained offline using data from a prepared training dataset. While providing certain advantages, its negative side is that information about the environment is greatly compressed to the size of the training dataset. Which, in turn, limits the possibilities of exploration. In this article, we will consider a method that enables the filling of a training dataset with the most diverse data possible.
preview
Developing an MQTT client for MetaTrader 5: a TDD approach — Part 3

Developing an MQTT client for MetaTrader 5: a TDD approach — Part 3

This article is the third part of a series describing our development steps of a native MQL5 client for the MQTT protocol. In this part, we describe in detail how we are using Test-Driven Development to implement the Operational Behavior part of the CONNECT/CONNACK packet exchange. At the end of this step, our client MUST be able to behave appropriately when dealing with any of the possible server outcomes from a connection attempt.
Dimitar Manov: "I fear only extraordinary situations in the Championship" (ATC 2010)
Dimitar Manov: "I fear only extraordinary situations in the Championship" (ATC 2010)

Dimitar Manov: "I fear only extraordinary situations in the Championship" (ATC 2010)

In the recent review by Boris Odintsov the Expert Advisor of the Bulgarian Participant Dimitar Manov appeared among the most stable and reliable EAs. We decided to interview this developer and try to find the secret of his success. In this interview Dimitar has told us what situation would be unfavorable for his robot, why he's not using indicators and whether he is expecting to win the competition.
Filtering by History
Filtering by History

Filtering by History

The article describes the usage of virtual trading as an integral part of trade opening filter.
preview
Population optimization algorithms: Cuckoo Optimization Algorithm (COA)

Population optimization algorithms: Cuckoo Optimization Algorithm (COA)

The next algorithm I will consider is cuckoo search optimization using Levy flights. This is one of the latest optimization algorithms and a new leader in the leaderboard.
preview
Category Theory in MQL5 (Part 20): A detour to Self-Attention and the Transformer

Category Theory in MQL5 (Part 20): A detour to Self-Attention and the Transformer

We digress in our series by pondering at part of the algorithm to chatGPT. Are there any similarities or concepts borrowed from natural transformations? We attempt to answer these and other questions in a fun piece, with our code in a signal class format.
preview
Developing a Replay System (Part 27): Expert Advisor project — C_Mouse class (I)

Developing a Replay System (Part 27): Expert Advisor project — C_Mouse class (I)

In this article we will implement the C_Mouse class. It provides the ability to program at the highest level. However, talking about high-level or low-level programming languages is not about including obscene words or jargon in the code. It's the other way around. When we talk about high-level or low-level programming, we mean how easy or difficult the code is for other programmers to understand.
preview
Population optimization algorithms: Saplings Sowing and Growing up (SSG)

Population optimization algorithms: Saplings Sowing and Growing up (SSG)

Saplings Sowing and Growing up (SSG) algorithm is inspired by one of the most resilient organisms on the planet demonstrating outstanding capability for survival in a wide variety of conditions.
preview
Understand and Efficiently use OpenCL API by Recreating built-in support as DLL on Linux (Part 2): OpenCL Simple DLL implementation

Understand and Efficiently use OpenCL API by Recreating built-in support as DLL on Linux (Part 2): OpenCL Simple DLL implementation

Continued from the part 1 in the series, now we proceed to implement as a simple DLL then test with MetaTrader 5. This will prepare us well before developing a full-fledge OpenCL as DLL support in the following part to come.
preview
Neural networks made easy (Part 35): Intrinsic Curiosity Module

Neural networks made easy (Part 35): Intrinsic Curiosity Module

We continue to study reinforcement learning algorithms. All the algorithms we have considered so far required the creation of a reward policy to enable the agent to evaluate each of its actions at each transition from one system state to another. However, this approach is rather artificial. In practice, there is some time lag between an action and a reward. In this article, we will get acquainted with a model training algorithm which can work with various time delays from the action to the reward.
preview
Experiments with neural networks (Part 4): Templates

Experiments with neural networks (Part 4): Templates

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. Simple explanation.
preview
DoEasy. Controls (Part 24): Hint auxiliary WinForms object

DoEasy. Controls (Part 24): Hint auxiliary WinForms object

In this article, I will revise the logic of specifying the base and main objects for all WinForms library objects, develop a new Hint base object and several of its derived classes to indicate the possible direction of moving the separator.
Interview with Valery Mazurenko (ATC 2011)
Interview with Valery Mazurenko (ATC 2011)

Interview with Valery Mazurenko (ATC 2011)

The task of writing an Expert Advisor trading on multiple currency pairs is complex both in terms of finding suitable strategies and from the technological side. But if the goal is set clear, nothing is impossible then. It was four times already that Vitaly Mazurenko (notused) submitted his multi-currency Expert Advisor. It seems, he has managed to find the right way this time.
preview
Category Theory in MQL5 (Part 18): Naturality Square

Category Theory in MQL5 (Part 18): Naturality Square

This article continues our series into category theory by introducing natural transformations, a key pillar within the subject. We look at the seemingly complex definition, then delve into examples and applications with this series’ ‘bread and butter’; volatility forecasting.
Interview with Berron Parker (ATC 2010)
Interview with Berron Parker (ATC 2010)

Interview with Berron Parker (ATC 2010)

During the first week of the Championship Berron's Expert Advisor has been on the top position. He now tells us about his experience of EA development and difficulties of moving to MQL5. Berron says his EA is set up to work in a trend market, but can be weak in other market conditions. However, he is hopeful that his robot will show good results in this competition.
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.
preview
Category Theory in MQL5 (Part 2)

Category Theory in MQL5 (Part 2)

Category Theory is a diverse and expanding branch of Mathematics which as of yet is relatively uncovered in the MQL5 community. These series of articles look to introduce and examine some of its concepts with the overall goal of establishing an open library that attracts comments and discussion while hopefully furthering the use of this remarkable field in Traders' strategy development.
Interview with Boris Odintsov (ATC 2010)
Interview with Boris Odintsov (ATC 2010)

Interview with Boris Odintsov (ATC 2010)

Boris Odintsov is one of the most impressive participants of the Championship who managed to go beyond $100,000 on the third week of the competition. Boris explains the rapid rise of his expert Advisor as a favorable combination of circumstances. In this interview he tells about what is important in trading, and what market would be unfavorable for his EA.