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
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.
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
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.
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
OpenAI's ChatGPT features within the framework of MQL4 and MQL5 development

OpenAI's ChatGPT features within the framework of MQL4 and MQL5 development

In this article, we will fiddle around ChatGPT from OpenAI in order to understand its capabilities in terms of reducing the time and labor intensity of developing Expert Advisors, indicators and scripts. I will quickly navigate you through this technology and try to show you how to use it correctly for programming in MQL4 and MQL5.
preview
Testing different Moving Average types to see how insightful they are

Testing different Moving Average types to see how insightful they are

We all know the importance of the Moving Average indicator for a lot of traders. There are other Moving average types that can be useful in trading, we will identify these types in this article and make a simple comparison between each one of them and the most popular simple Moving average type to see which one can show the best results.
preview
Category Theory in MQL5 (Part 17): Functors and Monoids

Category Theory in MQL5 (Part 17): Functors and Monoids

This article, the final in our series to tackle functors as a subject, revisits monoids as a category. Monoids which we have already introduced in these series are used here to aid in position sizing, together with multi-layer perceptrons.
preview
Category Theory in MQL5 (Part 16): Functors with Multi-Layer Perceptrons

Category Theory in MQL5 (Part 16): Functors with Multi-Layer Perceptrons

This article, the 16th in our series, continues with a look at Functors and how they can be implemented using artificial neural networks. We depart from our approach so far in the series, that has involved forecasting volatility and try to implement a custom signal class for setting position entry and exit signals.
preview
Improve Your Trading Charts With Interactive GUI's in MQL5 (Part III): Simple Movable Trading GUI

Improve Your Trading Charts With Interactive GUI's in MQL5 (Part III): Simple Movable Trading GUI

Join us in Part III of the "Improve Your Trading Charts With Interactive GUIs in MQL5" series as we explore the integration of interactive GUIs into movable trading dashboards in MQL5. This article builds on the foundations set in Parts I and II, guiding readers to transform static trading dashboards into dynamic, movable ones.
preview
The RSI Deep Three Move Trading Technique

The RSI Deep Three Move Trading Technique

Presenting the RSI Deep Three Move Trading Technique in MetaTrader 5. This article is based on a new series of studies that showcase a few trading techniques based on the RSI, a technical analysis indicator used to measure the strength and momentum of a security, such as a stock, currency, or commodity.
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
Everything you need to learn about the MQL5 program structure

Everything you need to learn about the MQL5 program structure

Any Program in any programming language has a specific structure. In this article, you will learn essential parts of the MQL5 program structure by understanding the programming basics of every part of the MQL5 program structure that can be very helpful when creating our MQL5 trading system or trading tool that can be executable in the MetaTrader 5.
preview
Trading strategy based on the improved Doji candlestick pattern recognition indicator

Trading strategy based on the improved Doji candlestick pattern recognition indicator

The metabar-based indicator detected more candles than the conventional one. Let's check if this provides real benefit in the automated trading.
preview
Category Theory in MQL5 (Part 15) : Functors with Graphs

Category Theory in MQL5 (Part 15) : Functors with Graphs

This article on Category Theory implementation in MQL5, continues the series by looking at Functors but this time as a bridge between Graphs and a set. We revisit calendar data, and despite its limitations in Strategy Tester use, make the case using functors in forecasting volatility with the help of correlation.
preview
Category Theory in MQL5 (Part 14): Functors with Linear-Orders

Category Theory in MQL5 (Part 14): Functors with Linear-Orders

This article which is part of a broader series on Category Theory implementation in MQL5, delves into Functors. We examine how a Linear Order can be mapped to a set, thanks to Functors; by considering two sets of data that one would typically dismiss as having any connection.
preview
Cycle analysis using the Goertzel algorithm

Cycle analysis using the Goertzel algorithm

In this article we present code utilities that implement the goertzel algorithm in Mql5 and explore two ways in which the technique can be used in the analysis of price quotes for possible strategy development.
preview
Developing a Replay System — Market simulation (Part 03): Adjusting the settings (I)

Developing a Replay System — Market simulation (Part 03): Adjusting the settings (I)

Let's start by clarifying the current situation, because we didn't start in the best way. If we don't do it now, we'll be in trouble soon.
preview
Understanding functions in MQL5 with applications

Understanding functions in MQL5 with applications

Functions are critical things in any programming language, it helps developers apply the concept of (DRY) which means do not repeat yourself, and many other benefits. In this article, you will find much more information about functions and how we can create our own functions in MQL5 with simple applications that can be used or called in any system you have to enrich your trading system without complicating things.
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
Developing a Replay System — Market simulation (Part 02): First experiments (II)

Developing a Replay System — Market simulation (Part 02): First experiments (II)

This time, let's try a different approach to achieve the 1 minute goal. However, this task is not as simple as one might think.
preview
Developing a Replay System — Market simulation (Part 01): First experiments (I)

Developing a Replay System — Market simulation (Part 01): First experiments (I)

How about creating a system that would allow us to study the market when it is closed or even to simulate market situations? Here we are going to start a new series of articles in which we will deal with this topic.
preview
Revisiting an Old Trend Trading Strategy: Two Stochastic oscillators, a MA and Fibonacci

Revisiting an Old Trend Trading Strategy: Two Stochastic oscillators, a MA and Fibonacci

Old trading strategies. This article presents one of the strategies used to follow the trend in a purely technical way. The strategy is purely technical and uses a few technical indicators and tools to deliver signals and targets. The components of the strategy are as follows: A 14-period stochastic oscillator. A 5-period stochastic oscillator. A 200-period moving average. A Fibonacci projection tool (for target setting).
preview
Creating Graphical Panels Became Easy in MQL5

Creating Graphical Panels Became Easy in MQL5

In this article, we will provide a simple and easy guide to anyone who needs to create one of the most valuable and helpful tools in trading which is the graphical panel to simplify and ease doing tasks around trading which helps to save time and focus more on your trading process itself without any distractions.
preview
MQL5 — You too can become a master of this language

MQL5 — You too can become a master of this language

This article will be a kind of interview with myself, in which I will tell you how I took my first steps in the MQL5 language. I will show you how you can become a great MQL5 programmer. I will explain the necessary bases for you to achieve this feat. The only prerequisite is a willingness to learn.
preview
Can Heiken-Ashi Combined With Moving Averages Provide Good Signals Together?

Can Heiken-Ashi Combined With Moving Averages Provide Good Signals Together?

Combinations of strategies may offer better opportunities. We can combine indicators or patterns together, or even better, indicators with patterns, so that we get an extra confirmation factor. Moving averages help us confirm and ride the trend. They are the most known technical indicators and this is because of their simplicity and their proven track record of adding value to analyses.
preview
Improve Your Trading Charts With Interactive GUI's in MQL5 (Part II): Movable GUI (II)

Improve Your Trading Charts With Interactive GUI's in MQL5 (Part II): Movable GUI (II)

Unlock the potential of dynamic data representation in your trading strategies and utilities with our in-depth guide to creating movable GUIs in MQL5. Delve into the fundamental principles of object-oriented programming and discover how to design and implement single or multiple movable GUIs on the same chart with ease and efficiency.
preview
Developing an MQTT client for MetaTrader 5: a TDD approach

Developing an MQTT client for MetaTrader 5: a TDD approach

This article reports the first attempts in the development of a native MQTT client for MQL5. MQTT is a Client Server publish/subscribe messaging transport protocol. It is lightweight, open, simple, and designed to be easy to implement. These characteristics make it ideal for use in many situations.
preview
Integrating ML models with the Strategy Tester (Part 3): Managing CSV files (II)

Integrating ML models with the Strategy Tester (Part 3): Managing CSV files (II)

This material provides a complete guide to creating a class in MQL5 for efficient management of CSV files. We will see the implementation of methods for opening, writing, reading, and transforming data. We will also consider how to use them to store and access information. In addition, we will discuss the limitations and the most important aspects of using such a class. This article ca be a valuable resource for those who want to learn how to process CSV files in MQL5.
preview
Category Theory in MQL5 (Part 12): Orders

Category Theory in MQL5 (Part 12): Orders

This article which is part of a series that follows Category Theory implementation of Graphs in MQL5, delves in Orders. We examine how concepts of Order-Theory can support monoid sets in informing trade decisions by considering two major ordering types.
preview
Rebuy algorithm: Multicurrency trading simulation

Rebuy algorithm: Multicurrency trading simulation

In this article, we will create a mathematical model for simulating multicurrency pricing and complete the study of the diversification principle as part of the search for mechanisms to increase the trading efficiency, which I started in the previous article with theoretical calculations.
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.
preview
Simple Mean Reversion Trading Strategy

Simple Mean Reversion Trading Strategy

Mean reversion is a type of contrarian trading where the trader expects the price to return to some form of equilibrium which is generally measured by a mean or another central tendency statistic.
preview
Category Theory in MQL5 (Part 11): Graphs

Category Theory in MQL5 (Part 11): Graphs

This article is a continuation in a series that look at Category Theory implementation in MQL5. In here we examine how Graph-Theory could be integrated with monoids and other data structures when developing a close-out strategy to a trading system.
preview
Creating an EA that works automatically (Part 15): Automation (VII)

Creating an EA that works automatically (Part 15): Automation (VII)

To complete this series of articles on automation, we will continue discussing the topic of the previous article. We will see how everything will fit together, making the EA run like clockwork.
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
Matrices and vectors in MQL5: Activation functions

Matrices and vectors in MQL5: Activation functions

Here we will describe only one of the aspects of machine learning - activation functions. In artificial neural networks, a neuron activation function calculates an output signal value based on the values of an input signal or a set of input signals. We will delve into the inner workings of the process.
preview
Category Theory in MQL5 (Part 10): Monoid Groups

Category Theory in MQL5 (Part 10): Monoid Groups

This article continues the series on category theory implementation in MQL5. Here we look at monoid-groups as a means normalising monoid sets making them more comparable across a wider span of monoid sets and data types..
preview
Creating an EA that works automatically (Part 14): Automation (VI)

Creating an EA that works automatically (Part 14): Automation (VI)

In this article, we will put into practice all the knowledge from this series. We will finally build a 100% automated and functional system. But before that, we still have to learn one last detail.
preview
How to Become a Successful Signal Provider on MQL5.com

How to Become a Successful Signal Provider on MQL5.com

My main goal in this article is to provide you with a simple and accurate account of the steps that will help you become a top signal provider on MQL5.com. Drawing upon my knowledge and experience, I will explain what it takes to become a successful signal provider, including how to find, test, and optimize a good strategy. Additionally, I will provide tips on publishing your signal, writing a compelling description and effectively promoting and managing it.
preview
Multilayer perceptron and backpropagation algorithm (Part 3): Integration with the Strategy Tester - Overview (I).

Multilayer perceptron and backpropagation algorithm (Part 3): Integration with the Strategy Tester - Overview (I).

The multilayer perceptron is an evolution of the simple perceptron which can solve non-linear separable problems. Together with the backpropagation algorithm, this neural network can be effectively trained. In Part 3 of the Multilayer Perceptron and Backpropagation series, we'll see how to integrate this technique into the Strategy Tester. This integration will allow the use of complex data analysis aimed at making better decisions to optimize your trading strategies. In this article, we will discuss the advantages and problems of this technique.