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
Matrix Utils, Extending the Matrices and Vector Standard Library Functionality

Matrix Utils, Extending the Matrices and Vector Standard Library Functionality

Matrix serves as the foundation of machine learning algorithms and computers in general because of their ability to effectively handle large mathematical operations, The Standard library has everything one needs but let's see how we can extend it by introducing several functions in the utils file, that are not yet available in the library
preview
Developing a Replay System — Market simulation (Part 17): Ticks and more ticks (I)

Developing a Replay System — Market simulation (Part 17): Ticks and more ticks (I)

Here we will see how to implement something really interesting, but at the same time very difficult due to certain points that can be very confusing. The worst thing that can happen is that some traders who consider themselves professionals do not know anything about the importance of these concepts in the capital market. Well, although we focus here on programming, understanding some of the issues involved in market trading is paramount to what we are going to implement.
preview
DoEasy. Controls (Part 21): SplitContainer control. Panel separator

DoEasy. Controls (Part 21): SplitContainer control. Panel separator

In this article, I will create the class of an auxiliary panel separator object for the SplitContainer control.
Terminal Service Client. How to Make Pocket PC a Big Brother's Friend
Terminal Service Client. How to Make Pocket PC a Big Brother's Friend

Terminal Service Client. How to Make Pocket PC a Big Brother's Friend

The article describes the way of connecting to the remote PC with installed MT4 Client Terminal via a PDA.
preview
Category Theory in MQL5 (Part 22): A different look at Moving Averages

Category Theory in MQL5 (Part 22): A different look at Moving Averages

In this article we attempt to simplify our illustration of concepts covered in these series by dwelling on just one indicator, the most common and probably the easiest to understand. The moving average. In doing so we consider significance and possible applications of vertical natural transformations.
preview
Neural networks made easy (Part 45): Training state exploration skills

Neural networks made easy (Part 45): Training state exploration skills

Training useful skills without an explicit reward function is one of the main challenges in hierarchical reinforcement learning. Previously, we already got acquainted with two algorithms for solving this problem. But the question of the completeness of environmental research remains open. This article demonstrates a different approach to skill training, the use of which directly depends on the current state of the system.
preview
Neural networks made easy (Part 51): Behavior-Guided Actor-Critic (BAC)

Neural networks made easy (Part 51): Behavior-Guided Actor-Critic (BAC)

The last two articles considered the Soft Actor-Critic algorithm, which incorporates entropy regularization into the reward function. This approach balances environmental exploration and model exploitation, but it is only applicable to stochastic models. The current article proposes an alternative approach that is applicable to both stochastic and deterministic models.
preview
Quantization in machine learning (Part 1): Theory, sample code, analysis of implementation in CatBoost

Quantization in machine learning (Part 1): Theory, sample code, analysis of implementation in CatBoost

The article considers the theoretical application of quantization in the construction of tree models and showcases the implemented quantization methods in CatBoost. No complex mathematical equations are used.
preview
Elastic net regression using coordinate descent in MQL5

Elastic net regression using coordinate descent in MQL5

In this article we explore the practical implementation of elastic net regression to minimize overfitting and at the same time automatically separate useful predictors from those that have little prognostic power.
Ten "Errors" of a Newcomer in Trading?
Ten "Errors" of a Newcomer in Trading?

Ten "Errors" of a Newcomer in Trading?

The article substantiates approach to building a trading system as a sequence of opening and closing the interrelated orders regarding the existing conditions - prices and the current values of each order's profit/loss, not only and not so much the conventional "alerts". We are giving an exemplary realization of such an elementary trading system.
Technical Analysis: Make the Impossible Possible!
Technical Analysis: Make the Impossible Possible!

Technical Analysis: Make the Impossible Possible!

The article answers the question: Why can the impossible become possible where much suggests otherwise? Technical analysis reasoning.
preview
Category Theory in MQL5 (Part 13): Calendar Events with Database Schemas

Category Theory in MQL5 (Part 13): Calendar Events with Database Schemas

This article, that follows Category Theory implementation of Orders in MQL5, considers how database schemas can be incorporated for classification in MQL5. We take an introductory look at how database schema concepts could be married with category theory when identifying trade relevant text(string) information. Calendar events are the focus.
preview
Introduction to MQL5 (Part 4): Mastering Structures, Classes, and Time Functions

Introduction to MQL5 (Part 4): Mastering Structures, Classes, and Time Functions

Unlock the secrets of MQL5 programming in our latest article! Delve into the essentials of structures, classes, and time functions, empowering your coding journey. Whether you're a beginner or an experienced developer, our guide simplifies complex concepts, providing valuable insights for mastering MQL5. Elevate your programming skills and stay ahead in the world of algorithmic trading!
preview
Integrating ML models with the Strategy Tester (Conclusion): Implementing a regression model for price prediction

Integrating ML models with the Strategy Tester (Conclusion): Implementing a regression model for price prediction

This article describes the implementation of a regression model based on a decision tree. The model should predict prices of financial assets. We have already prepared the data, trained and evaluated the model, as well as adjusted and optimized it. However, it is important to note that this model is intended for study purposes only and should not be used in real trading.
Trading Using Linux
Trading Using Linux

Trading Using Linux

The article describes how to use indicators to watch the situation on financial markets online.
preview
Seasonality Filtering and time period for Deep Learning ONNX models with python for EA

Seasonality Filtering and time period for Deep Learning ONNX models with python for EA

Can we benefit from seasonality when creating models for Deep Learning with python? Does filtering data for the ONNX models help to get better results? What time period should we use? We will cover all of this over this article.
preview
Developing a Replay System — Market simulation (Part 08): Locking the indicator

Developing a Replay System — Market simulation (Part 08): Locking the indicator

In this article, we will look at how to lock the indicator while simply using the MQL5 language, and we will do it in a very interesting and amazing way.
preview
MQL5 Wizard Techniques you should know (Part 08): Perceptrons

MQL5 Wizard Techniques you should know (Part 08): Perceptrons

Perceptrons, single hidden layer networks, can be a good segue for anyone familiar with basic automated trading and is looking to dip into neural networks. We take a step by step look at how this could be realized in a signal class assembly that is part of the MQL5 Wizard classes for expert advisors.
preview
Modified Grid-Hedge EA in MQL5 (Part II): Making a Simple Grid EA

Modified Grid-Hedge EA in MQL5 (Part II): Making a Simple Grid EA

In this article, we explored the classic grid strategy, detailing its automation using an Expert Advisor in MQL5 and analyzing initial backtest results. We highlighted the strategy's need for high holding capacity and outlined plans for optimizing key parameters like distance, takeProfit, and lot sizes in future installments. The series aims to enhance trading strategy efficiency and adaptability to different market conditions.
Developing a Replay System — Market simulation (Part 10): Using only real data for Replay
Developing a Replay System — Market simulation (Part 10): Using only real data for Replay

Developing a Replay System — Market simulation (Part 10): Using only real data for Replay

Here we will look at how we can use more reliable data (traded ticks) in the replay system without worrying about whether it is adjusted or not.
Modelling Requotes in Tester and Expert Advisor Stability Analysis
Modelling Requotes in Tester and Expert Advisor Stability Analysis

Modelling Requotes in Tester and Expert Advisor Stability Analysis

Requote is a scourge for many Expert Advisors, especially for those that have rather sensitive conditions of entering/exiting a trade. In the article, a way to check up the EA for the requotes stability is offered.
preview
DoEasy. Controls (Part 17): Cropping invisible object parts, auxiliary arrow buttons WinForms objects

DoEasy. Controls (Part 17): Cropping invisible object parts, auxiliary arrow buttons WinForms objects

In this article, I will create the functionality for hiding object sections located beyond their containers. Besides, I will create auxiliary arrow button objects to be used as part of other WinForms objects.
preview
Market Reactions and Trading Strategies in Response to Dividend Announcements: Evaluating the Efficient Market Hypothesis in Stock Trading

Market Reactions and Trading Strategies in Response to Dividend Announcements: Evaluating the Efficient Market Hypothesis in Stock Trading

In this article, we will analyse the impact of dividend announcements on stock market returns and see how investors can earn more returns than those offered by the market when they expect a company to announce dividends. In doing so, we will also check the validity of the Efficient Market Hypothesis in the context of the Indian Stock Market.
preview
Population optimization algorithms: Nelder–Mead, or simplex search (NM) method

Population optimization algorithms: Nelder–Mead, or simplex search (NM) method

The article presents a complete exploration of the Nelder-Mead method, explaining how the simplex (function parameter space) is modified and rearranged at each iteration to achieve an optimal solution, and describes how the method can be improved.
preview
Introduction to MQL5 (Part 3): Mastering the Core Elements of MQL5

Introduction to MQL5 (Part 3): Mastering the Core Elements of MQL5

Explore the fundamentals of MQL5 programming in this beginner-friendly article, where we demystify arrays, custom functions, preprocessors, and event handling, all explained with clarity making every line of code accessible. Join us in unlocking the power of MQL5 with a unique approach that ensures understanding at every step. This article sets the foundation for mastering MQL5, emphasizing the explanation of each line of code, and providing a distinct and enriching learning experience.
preview
Developing an MQL5 RL agent with RestAPI integration (Part 2): MQL5 functions for HTTP interaction with the tic-tac-toe game REST API

Developing an MQL5 RL agent with RestAPI integration (Part 2): MQL5 functions for HTTP interaction with the tic-tac-toe game REST API

In this article we will talk about how MQL5 can interact with Python and FastAPI, using HTTP calls in MQL5 to interact with the tic-tac-toe game in Python. The article discusses the creation of an API using FastAPI for this integration and provides a test script in MQL5, highlighting the versatility of MQL5, the simplicity of Python, and the effectiveness of FastAPI in connecting different technologies to create innovative solutions.
preview
Classification models in the Scikit-Learn library and their export to ONNX

Classification models in the Scikit-Learn library and their export to ONNX

In this article, we will explore the application of all classification models available in the Scikit-Learn library to solve the classification task of Fisher's Iris dataset. We will attempt to convert these models into ONNX format and utilize the resulting models in MQL5 programs. Additionally, we will compare the accuracy of the original models with their ONNX versions on the full Iris dataset.
All about Automated Trading Championship: Statistical Reports
All about Automated Trading Championship: Statistical Reports

All about Automated Trading Championship: Statistical Reports

Creating a profitable and stable trading system is always related to statistical data processing. In this article, we pout together statistical reports of the Automated Trading Championships 2006-2007. It may well be that the information they provide will help you find new trading ideas or correct the existing ones. Analyze the data and save your time.
preview
Benefiting from Forex market seasonality

Benefiting from Forex market seasonality

We are all familiar with the concept of seasonality, for example, we are all accustomed to rising prices for fresh vegetables in winter or rising fuel prices during severe frosts, but few people know that similar patterns exist in the Forex market.
preview
Developing a Replay System — Market simulation (Part 09): Custom events

Developing a Replay System — Market simulation (Part 09): Custom events

Here we'll see how custom events are triggered and how the indicator reports the state of the replay/simulation service.
preview
Neural networks made easy (Part 46): Goal-conditioned reinforcement learning (GCRL)

Neural networks made easy (Part 46): Goal-conditioned reinforcement learning (GCRL)

In this article, we will have a look at yet another reinforcement learning approach. It is called goal-conditioned reinforcement learning (GCRL). In this approach, an agent is trained to achieve different goals in specific scenarios.
View of Technical Analysis in the Context of Automatic Control Systems (ACS), or "Reverse View"
View of Technical Analysis in the Context of Automatic Control Systems (ACS), or "Reverse View"

View of Technical Analysis in the Context of Automatic Control Systems (ACS), or "Reverse View"

The article demonstrates an alternative view of technical analysis, which is based on the principles of both the modern automatic control theory and technical analysis itself. It is an introductory article representing the theory with some practical applications of it.
preview
How to build and optimize a volatility-based trading system (Chaikin Volatility - CHV)

How to build and optimize a volatility-based trading system (Chaikin Volatility - CHV)

In this article, we will provide another volatility-based indicator named Chaikin Volatility. We will understand how to build a custom indicator after identifying how it can be used and constructed. We will share some simple strategies that can be used and then test them to understand which one can be better.
preview
Estimate future performance with confidence intervals

Estimate future performance with confidence intervals

In this article we delve into the application of boostrapping techniques as a means to estimate the future performance of an automated strategy.
preview
MQL5 Wizard Techniques you should know (Part 13): DBSCAN for Expert Signal Class

MQL5 Wizard Techniques you should know (Part 13): DBSCAN for Expert Signal Class

Density Based Spatial Clustering for Applications with Noise is an unsupervised form of grouping data that hardly requires any input parameters, save for just 2, which when compared to other approaches like k-means, is a boon. We delve into how this could be constructive for testing and eventually trading with Wizard assembled Expert Advisers
Superposition and Interference of Financial Securities
Superposition and Interference of Financial Securities

Superposition and Interference of Financial Securities

The more factors influence the behavior of a currency pair, the more difficult it is to evaluate its behavior and make up future forecasts. Therefore, if we managed to extract components of a currency pair, values of a national currency that change with the time, we could considerably delimit the freedom of national currency movement as compared to the currency pair with this currency, as well as the number of factors influencing its behavior. As a result we would increase the accuracy of its behavior estimation and future forecasting. How can we do that?
preview
Developing a Replay System — Market simulation (Part 13): Birth of the SIMULATOR (III)

Developing a Replay System — Market simulation (Part 13): Birth of the SIMULATOR (III)

Here we will simplify a few elements related to the work in the next article. I'll also explain how you can visualize what the simulator generates in terms of randomness.
preview
Quantitative analysis in MQL5: Implementing a promising algorithm

Quantitative analysis in MQL5: Implementing a promising algorithm

We will analyze the question of what quantitative analysis is and how it is used by major players. We will create one of the quantitative analysis algorithms in the MQL5 language.
preview
Neural networks made easy (Part 42): Model procrastination, reasons and solutions

Neural networks made easy (Part 42): Model procrastination, reasons and solutions

In the context of reinforcement learning, model procrastination can be caused by several reasons. The article considers some of the possible causes of model procrastination and methods for overcoming them.
preview
DoEasy. Controls (Part 31): Scrolling the contents of the ScrollBar control

DoEasy. Controls (Part 31): Scrolling the contents of the ScrollBar control

In this article, I will implement the functionality of scrolling the contents of the container using the buttons of the horizontal scrollbar.