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
Graphics in DoEasy library (Part 99): Moving an extended graphical object using a single control point

Graphics in DoEasy library (Part 99): Moving an extended graphical object using a single control point

In the previous article, I implemented the ability to move pivot points of an extended graphical object using control forms. Now I am going to implement the ability to move a composite graphical object using a single graphical object control point (form).
Interview with Ruslan Ziyatdinov (ATC 2012)
Interview with Ruslan Ziyatdinov (ATC 2012)

Interview with Ruslan Ziyatdinov (ATC 2012)

The Championship keeps providing us with new discoveries, as well as new interesting Participants and unusual ideas implemented in the competition trading robots. While interviewing Ruslan Ziyatdinov (rusland1962), we learned about his simple approach to trading and found out why it is better to trade less frequently.
preview
ALGLIB numerical analysis library in MQL5

ALGLIB numerical analysis library in MQL5

The article takes a quick look at the ALGLIB 3.19 numerical analysis library, its applications and new algorithms that can improve the efficiency of financial data analysis.
Ten Basic Errors of a Newcomer in Trading
Ten Basic Errors of a Newcomer in Trading

Ten Basic Errors of a Newcomer in Trading

There are ten basic errors of a newcomer intrading: trading at market opening, undue hurry in taking profit, adding of lots in a losing position, closing positions starting with the best one, revenge, the most preferable positions, trading by the principle of 'bought for ever', closing of a profitable strategic position on the first day, closing of a position when alerted to open an opposite position, doubts.
preview
Discrete Hartley transform

Discrete Hartley transform

In this article, we will consider one of the methods of spectral analysis and signal processing - the discrete Hartley transform. It allows filtering signals, analyzing their spectrum and much more. The capabilities of DHT are no less than those of the discrete Fourier transform. However, unlike DFT, DHT uses only real numbers, which makes it more convenient for implementation in practice, and the results of its application are more visual.
preview
Timeseries in DoEasy library (part 50): Multi-period multi-symbol standard indicators with a shift

Timeseries in DoEasy library (part 50): Multi-period multi-symbol standard indicators with a shift

In the article, let’s improve library methods for correct display of multi-symbol multi-period standard indicators, which lines are displayed on the current symbol chart with a shift set in the settings. As well, let’s put things in order in methods of work with standard indicators and remove the redundant code to the library area in the final indicator program.
preview
DoEasy. Controls (Part 26): Finalizing the ToolTip WinForms object and moving on to ProgressBar development

DoEasy. Controls (Part 26): Finalizing the ToolTip WinForms object and moving on to ProgressBar development

In this article, I will complete the development of the ToolTip control and start the development of the ProgressBar WinForms object. While working on objects, I will develop universal functionality for animating controls and their components.
preview
Population optimization algorithms: Monkey algorithm (MA)

Population optimization algorithms: Monkey algorithm (MA)

In this article, I will consider the Monkey Algorithm (MA) optimization algorithm. The ability of these animals to overcome difficult obstacles and get to the most inaccessible tree tops formed the basis of the idea of the MA algorithm.
preview
Experiments with neural networks (Part 7): Passing indicators

Experiments with neural networks (Part 7): Passing indicators

Examples of passing indicators to a perceptron. The article describes general concepts and showcases the simplest ready-made Expert Advisor followed by the results of its optimization and forward test.
Betting Modeling as Means of Developing "Market Intuition"
Betting Modeling as Means of Developing "Market Intuition"

Betting Modeling as Means of Developing "Market Intuition"

The article dwells on the notion of "market intuition" and ways of developing it. The method described in the article is based on the modeling of financial betting in the form of a simple game.
preview
DoEasy. Controls (Part 29): ScrollBar auxiliary control

DoEasy. Controls (Part 29): ScrollBar auxiliary control

In this article, I will start developing the ScrollBar auxiliary control element and its derivative objects — vertical and horizontal scrollbars. A scrollbar is used to scroll the content of the form if it goes beyond the container. Scrollbars are usually located at the bottom and to the right of the form. The horizontal one at the bottom scrolls content left and right, while the vertical one scrolls up and down.
preview
Deep Learning GRU model with Python to ONNX  with EA, and GRU vs LSTM models

Deep Learning GRU model with Python to ONNX with EA, and GRU vs LSTM models

We will guide you through the entire process of DL with python to make a GRU ONNX model, culminating in the creation of an Expert Advisor (EA) designed for trading, and subsequently comparing GRU model with LSTN model.
preview
Graphics in DoEasy library (Part 98): Moving pivot points of extended standard graphical objects

Graphics in DoEasy library (Part 98): Moving pivot points of extended standard graphical objects

In the article, I continue the development of extended standard graphical objects and create the functionality for moving pivot points of composite graphical objects using the control points for managing the coordinates of the graphical object pivot points.
preview
Building Your First Glass-box Model Using Python And MQL5

Building Your First Glass-box Model Using Python And MQL5

Machine learning models are difficult to interpret and understanding why our models deviate from our expectations is critical if we want to gain any value from using such advanced techniques. Without comprehensive insight into the inner workings of our model, we might fail to spot bugs that are corrupting our model's performance, we may waste time over engineering features that aren't predictive and in the long run we risk underutilizing the power of these models. Fortunately, there is a sophisticated and well maintained all in one solution that allows us to see exactly what our model is doing underneath the hood.
preview
Neural networks made easy (Part 53): Reward decomposition

Neural networks made easy (Part 53): Reward decomposition

We have already talked more than once about the importance of correctly selecting the reward function, which we use to stimulate the desired behavior of the Agent by adding rewards or penalties for individual actions. But the question remains open about the decryption of our signals by the Agent. In this article, we will talk about reward decomposition in terms of transmitting individual signals to the trained Agent.
Interview with Alexander Prishchenko (ATC 2012)
Interview with Alexander Prishchenko (ATC 2012)

Interview with Alexander Prishchenko (ATC 2012)

What can be more complicated than a multicurrency trading robot? Surely, it is an automated strategy based on Elliott Wave Principle. Can we imagine something more complicated than that? Yes, we can. It is a multicurrency Expert Advisor using Elliott Waves on each currency pair! Alexander Prishchenko (Crucian) believes that even a newcomer can learn the rules.
preview
Working with ONNX models in float16 and float8 formats

Working with ONNX models in float16 and float8 formats

Data formats used to represent machine learning models play a crucial role in their effectiveness. In recent years, several new types of data have emerged, specifically designed for working with deep learning models. In this article, we will focus on two new data formats that have become widely adopted in modern models.
preview
Developing a Replay System — Market simulation (Part 05): Adding Previews

Developing a Replay System — Market simulation (Part 05): Adding Previews

We have managed to develop a way to implement the market replay system in a realistic and accessible way. Now let's continue our project and add data to improve the replay behavior.
Graphical Interfaces X: Updates for the Rendered table and code optimization (build 10)
Graphical Interfaces X: Updates for the Rendered table and code optimization (build 10)

Graphical Interfaces X: Updates for the Rendered table and code optimization (build 10)

We continue to complement the Rendered table (CCanvasTable) with new features. The table will now have: highlighting of the rows when hovered; ability to add an array of icons for each cell and a method for switching them; ability to set or modify the cell text during the runtime, and more.
preview
Mastering ONNX: The Game-Changer for MQL5 Traders

Mastering ONNX: The Game-Changer for MQL5 Traders

Dive into the world of ONNX, the powerful open-standard format for exchanging machine learning models. Discover how leveraging ONNX can revolutionize algorithmic trading in MQL5, allowing traders to seamlessly integrate cutting-edge AI models and elevate their strategies to new heights. Uncover the secrets to cross-platform compatibility and learn how to unlock the full potential of ONNX in your MQL5 trading endeavors. Elevate your trading game with this comprehensive guide to Mastering ONNX
preview
Regression models of the Scikit-learn Library and their export to ONNX

Regression models of the Scikit-learn Library and their export to ONNX

In this article, we will explore the application of regression models from the Scikit-learn package, attempt to convert them into ONNX format, and use the resultant models within MQL5 programs. Additionally, we will compare the accuracy of the original models with their ONNX versions for both float and double precision. Furthermore, we will examine the ONNX representation of regression models, aiming to provide a better understanding of their internal structure and operational principles.
preview
Neural networks made easy (Part 22): Unsupervised learning of recurrent models

Neural networks made easy (Part 22): Unsupervised learning of recurrent models

We continue to study unsupervised learning algorithms. This time I suggest that we discuss the features of autoencoders when applied to recurrent model training.
preview
Data label for timeseries mining (Part 2):Make datasets with trend markers using Python

Data label for timeseries mining (Part 2):Make datasets with trend markers using Python

This series of articles introduces several time series labeling methods, which can create data that meets most artificial intelligence models, and targeted data labeling according to needs can make the trained artificial intelligence model more in line with the expected design, improve the accuracy of our model, and even help the model make a qualitative leap!
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.
How to Use Crashlogs to Debug Your Own DLLs
How to Use Crashlogs to Debug Your Own DLLs

How to Use Crashlogs to Debug Your Own DLLs

25 to 30% of all crashlogs received from users appear due to errors occurring when functions imported from custom dlls are executed.
preview
Wrapping ONNX models in classes

Wrapping ONNX models in classes

Object-oriented programming enables creation of a more compact code that is easy to read and modify. Here we will have a look at the example for three ONNX models.
preview
Category Theory in MQL5 (Part 3)

Category Theory in MQL5 (Part 3)

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 provides insight while hopefully furthering the use of this remarkable field in Traders' strategy development.
preview
Population optimization algorithms: Artificial Bee Colony (ABC)

Population optimization algorithms: Artificial Bee Colony (ABC)

In this article, we will study the algorithm of an artificial bee colony and supplement our knowledge with new principles of studying functional spaces. In this article, I will showcase my interpretation of the classic version of the algorithm.
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.
preview
Trade transactions. Request and response structures, description and logging

Trade transactions. Request and response structures, description and logging

The article considers handling trade request structures, namely creating a request, its preliminary verification before sending it to the server, the server's response to a trade request and the structure of trade transactions. We will create simple and convenient functions for sending trading orders to the server and, based on everything discussed, create an EA informing of trade transactions.
Interview with Alexander Arashkevich (ATC 2011)
Interview with Alexander Arashkevich (ATC 2011)

Interview with Alexander Arashkevich (ATC 2011)

The Championship fervour has finally subsided and we can take a breath and start rethinking its results again. And we have another winner Alexander Arashkevich (AAA777) from Belarus, who has won a special prize from the major sponsor of Automated Trading Championship 2011 - a 3 day trip to one of the Formula One races of the 2012 season. We could not miss the opportunity to talk with him.
preview
Data Science and Machine Learning(Part 14): Finding Your Way in the Markets with Kohonen Maps

Data Science and Machine Learning(Part 14): Finding Your Way in the Markets with Kohonen Maps

Are you looking for a cutting-edge approach to trading that can help you navigate complex and ever-changing markets? Look no further than Kohonen maps, an innovative form of artificial neural networks that can help you uncover hidden patterns and trends in market data. In this article, we'll explore how Kohonen maps work, and how they can be used to develop smarter, more effective trading strategies. Whether you're a seasoned trader or just starting out, you won't want to miss this exciting new approach to trading.
Interview with Egidijus Bockus (ATC 2012)
Interview with Egidijus Bockus (ATC 2012)

Interview with Egidijus Bockus (ATC 2012)

"I examined many indicators before realizing that they are not necessary for making money on Forex" - our present interviewee Egidijus Bockus (Egidijus) told us boldly. We have all reasons to take his words seriously, as his Expert Advisor occupies the third place with more than $32 000 beginning from the third week of the Automated Trading Championship 2012.
Expert Advisors Based on Popular Trading Systems and Alchemy of Trading Robot Optimization (Part III)
Expert Advisors Based on Popular Trading Systems and Alchemy of Trading Robot Optimization (Part III)

Expert Advisors Based on Popular Trading Systems and Alchemy of Trading Robot Optimization (Part III)

In this article the author continues to analyze implementation algorithms of simplest trading systems and introduces backtesting automation. The article will be useful for beginning traders and EA writers.
preview
Understanding Programming Paradigms (Part 2): An Object-Oriented Approach to Developing a Price Action Expert Advisor

Understanding Programming Paradigms (Part 2): An Object-Oriented Approach to Developing a Price Action Expert Advisor

Learn about the object-oriented programming paradigm and its application in MQL5 code. This second article goes deeper into the specifics of object-oriented programming, offering hands-on experience through a practical example. You'll learn how to convert our earlier developed procedural price action expert advisor using the EMA indicator and candlestick price data to object-oriented code.
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.
Interview with Francisco García García (ATC 2012)
Interview with Francisco García García (ATC 2012)

Interview with Francisco García García (ATC 2012)

Today we interview Francisco García García (chuliweb) from Spain. A week ago his Expert Advisor reached the 8th place, but the unfortunate logic error in programming threw it from the first page of the Championship leaders. As confirmed by statistics, such an error is not uncommon for many participants.
preview
Neural networks made easy (Part 44): Learning skills with dynamics in mind

Neural networks made easy (Part 44): Learning skills with dynamics in mind

In the previous article, we introduced the DIAYN method, which offers the algorithm for learning a variety of skills. The acquired skills can be used for various tasks. But such skills can be quite unpredictable, which can make them difficult to use. In this article, we will look at an algorithm for learning predictable skills.
preview
Data Science and Machine Learning (Part 08): K-Means Clustering in plain MQL5

Data Science and Machine Learning (Part 08): K-Means Clustering in plain MQL5

Data mining is crucial to a data scientist and a trader because very often, the data isn't as straightforward as we think it is. The human eye can not understand the minor underlying pattern and relationships in the dataset, maybe the K-means algorithm can help us with that. Let's find out...
preview
Developing a trading Expert Advisor from scratch (Part 23): New order system (VI)

Developing a trading Expert Advisor from scratch (Part 23): New order system (VI)

We will make the order system more flexible. Here we will consider changes to the code that will make it more flexible, which will allow us to change position stop levels much faster.