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 a ticker tape panel: Basic version

Creating a ticker tape panel: Basic version

Here I will show how to create screens with price tickers which are usually used to display quotes on the exchange. I will do it by only using MQL5, without using complex external programming.
preview
Population optimization algorithms: Harmony Search (HS)

Population optimization algorithms: Harmony Search (HS)

In the current article, I will study and test the most powerful optimization algorithm - harmonic search (HS) inspired by the process of finding the perfect sound harmony. So what algorithm is now the leader in our rating?
preview
Deep Learning Forecast and ordering with Python and MetaTrader5 python package and ONNX model file

Deep Learning Forecast and ordering with Python and MetaTrader5 python package and ONNX model file

The project involves using Python for deep learning-based forecasting in financial markets. We will explore the intricacies of testing the model's performance using key metrics such as Mean Absolute Error (MAE), Mean Squared Error (MSE), and R-squared (R2) and we will learn how to wrap everything into an executable. We will also make a ONNX model file with its EA.
preview
Data label for time series  mining(Part 1):Make a dataset with trend markers through the EA operation chart

Data label for time series mining(Part 1):Make a dataset with trend markers through the EA operation chart

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!
CCI indicator. Three transformation steps
CCI indicator. Three transformation steps

CCI indicator. Three transformation steps

In this article, I will make additional changes to the CCI affecting the very logic of this indicator. Moreover, we will be able to see it in the main chart window.
preview
Alan Andrews and his methods of time series analysis

Alan Andrews and his methods of time series analysis

Alan Andrews is one of the most famous "educators" of the modern world in the field of trading. His "pitchfork" is included in almost all modern quote analysis programs. But most traders do not use even a fraction of the opportunities that this tool provides. Besides, Andrews' original training course includes a description not only of the pitchfork (although it remains the main tool), but also of some other useful constructions. The article provides an insight into the marvelous chart analysis methods that Andrews taught in his original course. Beware, there will be a lot of images.
preview
Creating an EA that works automatically (Part 08): OnTradeTransaction

Creating an EA that works automatically (Part 08): OnTradeTransaction

In this article, we will see how to use the event handling system to quickly and efficiently process issues related to the order system. With this system the EA will work faster, so that it will not have to constantly search for the required data.
How we developed the MetaTrader Signals service and Social Trading
How we developed the MetaTrader Signals service and Social Trading

How we developed the MetaTrader Signals service and Social Trading

We continue to enhance the Signals service, improve the mechanisms, add new functions and fix flaws. The MetaTrader Signals Service of 2012 and the current MetaTrader Signals Service are like two completely different services. Currently, we are implementing A Virtual Hosting Cloud service which consists of a network of servers to support specific versions of the MetaTrader client terminal.
preview
Multiple indicators on one chart (Part 03): Developing definitions for users

Multiple indicators on one chart (Part 03): Developing definitions for users

Today we will update the functionality of the indicator system for the first time. In the previous article within the "Multiple indicators on one chart" we considered the basic code which allows using more than one indicator in a chart subwindow. But what was presented was just the starting base of a much larger system.
preview
Developing an Expert Advisor from scratch (Part 30): CHART TRADE as an indicator?

Developing an Expert Advisor from scratch (Part 30): CHART TRADE as an indicator?

Today we are going to use Chart Trade again, but this time it will be an on-chart indicator which may or may not be present on the chart.
preview
Multiple indicators on one chart (Part 05): Turning MetaTrader 5 into a RAD system (I)

Multiple indicators on one chart (Part 05): Turning MetaTrader 5 into a RAD system (I)

There are a lot of people who do not know how to program but they are quite creative and have great ideas. However, the lack of programming knowledge prevents them from implementing these ideas. Let's see together how to create a Chart Trade using the MetaTrader 5 platform itself, as if it were an IDE.
preview
DoEasy. Controls (Part 3): Creating bound controls

DoEasy. Controls (Part 3): Creating bound controls

In this article, I will create subordinate controls bound to the base element. The development will be performed using the base control functionality. In addition, I will tinker with the graphical element shadow object a bit since it still suffers from some logic errors when applied to any of the objects capable of having a shadow.
preview
Monte Carlo Permutation Tests in MetaTrader 5

Monte Carlo Permutation Tests in MetaTrader 5

In this article we take a look at how we can conduct permutation tests based on shuffled tick data on any expert advisor using only Metatrader 5.
preview
Category Theory (Part 9): Monoid-Actions

Category Theory (Part 9): Monoid-Actions

This article continues the series on category theory implementation in MQL5. Here we continue monoid-actions as a means of transforming monoids, covered in the previous article, leading to increased applications.
preview
Understanding MQL5 Object-Oriented Programming (OOP)

Understanding MQL5 Object-Oriented Programming (OOP)

As developers, we need to learn how to create and develop software that can be reusable and flexible without duplicated code especially if we have different objects with different behaviors. This can be smoothly done by using object-oriented programming techniques and principles. In this article, we will present the basics of MQL5 Object-Oriented programming to understand how we can use principles and practices of this critical topic in our software.
MQL5 Market Results for Q2 2013
MQL5 Market Results for Q2 2013

MQL5 Market Results for Q2 2013

Successfully operating for 1.5 years, MQL5 Market has become the largest traders' store of trading strategies and technical indicators. It offers around 800 trading applications provided by 350 developers from around the world. Over 100.000 trading programs have already been purchased and downloaded by traders to their MetaTrader 5 terminals.
preview
Developing a trading Expert Advisor from scratch (Part 28): Towards the future (III)

Developing a trading Expert Advisor from scratch (Part 28): Towards the future (III)

There is still one task which our order system is not up to, but we will FINALLY figure it out. The MetaTrader 5 provides a system of tickets which allows creating and correcting order values. The idea is to have an Expert Advisor that would make the same ticket system faster and more efficient.
preview
How to create a custom True Strength Index indicator using MQL5

How to create a custom True Strength Index indicator using MQL5

Here is a new article about how to create a custom indicator. This time we will work with the True Strength Index (TSI) and will create an Expert Advisor based on it.
preview
Understand and Use MQL5 Strategy Tester Effectively

Understand and Use MQL5 Strategy Tester Effectively

There is an essential need for MQL5 programmers or developers to master important and valuable tools. One of these tools is the Strategy Tester, this article is a practical guide to understanding and using the strategy tester of MQL5.
preview
Making a dashboard to display data in indicators and EAs

Making a dashboard to display data in indicators and EAs

In this article, we will create a dashboard class to be used in indicators and EAs. This is an introductory article in a small series of articles with templates for including and using standard indicators in Expert Advisors. I will start by creating a panel similar to the MetaTrader 5 data window.
preview
Experiments with neural networks (Part 5): Normalizing inputs for passing to a neural network

Experiments with neural networks (Part 5): Normalizing inputs for passing to a neural network

Neural networks are an ultimate tool in traders' toolkit. Let's check if this assumption is true. MetaTrader 5 is approached as a self-sufficient medium for using neural networks in trading. A simple explanation is provided.
Timeseries in DoEasy library (part 47): Multi-period multi-symbol standard indicators
Timeseries in DoEasy library (part 47): Multi-period multi-symbol standard indicators

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

In this article, I will start developing the methods of working with standard indicators, which will ultimately allow creating multi-symbol multi-period standard indicators based on library classes. Besides, I will add the "Skipped bars" event to the timeseries classes and eliminate excessive load from the main program code by moving the library preparation functions to CEngine class.
preview
Developing a trading Expert Advisor from scratch (Part 9): A conceptual leap (II)

Developing a trading Expert Advisor from scratch (Part 9): A conceptual leap (II)

In this article, we will place Chart Trade in a floating window. In the previous part, we created a basic system which enables the use of templates within a floating window.
preview
MQL5 Cookbook — Services

MQL5 Cookbook — Services

The article describes the versatile capabilities of services — MQL5 programs that do not require binding graphs. I will also highlight the differences of services from other MQL5 programs and emphasize the nuances of the developer's work with services. As examples, the reader is offered various tasks covering a wide range of functionality that can be implemented as a service.
preview
Parallel Particle Swarm Optimization

Parallel Particle Swarm Optimization

The article describes a method of fast optimization using the particle swarm algorithm. It also presents the method implementation in MQL, which is ready for use both in single-threaded mode inside an Expert Advisor and in a parallel multi-threaded mode as an add-on that runs on local tester agents.
preview
MQL5 Wizard techniques you should know (Part 03): Shannon's Entropy

MQL5 Wizard techniques you should know (Part 03): Shannon's Entropy

Todays trader is a philomath who is almost always looking up new ideas, trying them out, choosing to modify them or discard them; an exploratory process that should cost a fair amount of diligence. These series of articles will proposition that the MQL5 wizard should be a mainstay for traders.
preview
Data Science and Machine Learning (Part 12): Can Self-Training Neural Networks Help You Outsmart the Stock Market?

Data Science and Machine Learning (Part 12): Can Self-Training Neural Networks Help You Outsmart the Stock Market?

Are you tired of constantly trying to predict the stock market? Do you wish you had a crystal ball to help you make more informed investment decisions? Self-trained neural networks might be the solution you've been looking for. In this article, we explore whether these powerful algorithms can help you "ride the wave" and outsmart the stock market. By analyzing vast amounts of data and identifying patterns, self-trained neural networks can make predictions that are often more accurate than human traders. Discover how you can use this cutting-edge technology to maximize your profits and make smarter investment decisions.
Trader's Statistical Cookbook: Hypotheses
Trader's Statistical Cookbook: Hypotheses

Trader's Statistical Cookbook: Hypotheses

This article considers hypothesis - one of the basic ideas of mathematical statistics. Various hypotheses are examined and verified through examples using methods of mathematical statistics. The actual data is generalized using nonparametric methods. The Statistica package and the ported ALGLIB MQL5 numerical analysis library are used for processing data.
Graphics in DoEasy library (Part 93): Preparing functionality for creating composite graphical objects
Graphics in DoEasy library (Part 93): Preparing functionality for creating composite graphical objects

Graphics in DoEasy library (Part 93): Preparing functionality for creating composite graphical objects

In this article, I will start developing the functionality for creating composite graphical objects. The library will support creating composite graphical objects allowing those objects have any hierarchy of connections. I will prepare all the necessary classes for subsequent implementation of such objects.
MQL5 Market Results for Q1 2013
MQL5 Market Results for Q1 2013

MQL5 Market Results for Q1 2013

Since its founding, the store of trading robots and technical indicators MQL5 Market has already attracted more than 250 developers who have published 580 products. The first quarter of 2013 has turned out to be quite successful for some MQL5 Market sellers who have managed to make handsome profit by selling their products.
preview
Neural networks made easy (Part 32): Distributed Q-Learning

Neural networks made easy (Part 32): Distributed Q-Learning

We got acquainted with the Q-learning method in one of the earlier articles within this series. This method averages rewards for each action. Two works were presented in 2017, which show greater success when studying the reward distribution function. Let's consider the possibility of using such technology to solve our problems.
preview
Creating an EA that works automatically (Part 10): Automation (II)

Creating an EA that works automatically (Part 10): Automation (II)

Automation means nothing if you cannot control its schedule. No worker can be efficient working 24 hours a day. However, many believe that an automated system should operate 24 hours a day. But it is always good to have means to set a working time range for the EA. In this article, we will consider how to properly set such a time range.
preview
Neural networks made easy (Part 15): Data clustering using MQL5

Neural networks made easy (Part 15): Data clustering using MQL5

We continue to consider the clustering method. In this article, we will create a new CKmeans class to implement one of the most common k-means clustering methods. During tests, the model managed to identify about 500 patterns.
preview
Learn how to deal with date and time in MQL5

Learn how to deal with date and time in MQL5

A new article about a new important topic which is dealing with date and time. As traders or programmers of trading tools, it is very crucial to understand how to deal with these two aspects date and time very well and effectively. So, I will share some important information about how we can deal with date and time to create effective trading tools smoothly and simply without any complicity as much as I can.
preview
An example of how to ensemble ONNX models in MQL5

An example of how to ensemble ONNX models in MQL5

ONNX (Open Neural Network eXchange) is an open format built to represent neural networks. In this article, we will show how to use two ONNX models in one Expert Advisor simultaneously.
preview
Timeseries in DoEasy library (part 53): Abstract base indicator class

Timeseries in DoEasy library (part 53): Abstract base indicator class

The article considers creation of an abstract indicator which further will be used as the base class to create objects of library’s standard and custom indicators.
MQL5 Market Turns One Year Old
MQL5 Market Turns One Year Old

MQL5 Market Turns One Year Old

One year has passed since the launch of sales in MQL5 Market. It was a year of hard work, which turned the new service into the largest store of trading robots and technical indicators for MetaTrader 5 platform.
Interview with Enbo Lu (ATC 2012)
Interview with Enbo Lu (ATC 2012)

Interview with Enbo Lu (ATC 2012)

"Be sure to participate in the Automated Trading Championships, where you can get a truly invaluable experience!" - this is the motto of contestant Enbo Lu (luenbo) from China. He appeared in the TOP-10 of Automated Trading Championship 2012 last week and is now consistently trying to reach the podium.
preview
Automated grid trading using limit orders on Moscow Exchange (MOEX)

Automated grid trading using limit orders on Moscow Exchange (MOEX)

The article considers the development of an MQL5 Expert Advisor (EA) for MetaTrader 5 aimed at working on MOEX. The EA is to follow a grid strategy while trading on MOEX using MetaTrader 5 terminal. The EA involves closing positions by stop loss and take profit, as well as removing pending orders in case of certain market conditions.
preview
Neural networks made easy (Part 21): Variational autoencoders (VAE)

Neural networks made easy (Part 21): Variational autoencoders (VAE)

In the last article, we got acquainted with the Autoencoder algorithm. Like any other algorithm, it has its advantages and disadvantages. In its original implementation, the autoenctoder is used to separate the objects from the training sample as much as possible. This time we will talk about how to deal with some of its disadvantages.