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
Learn how to design a trading system by Accelerator Oscillator

Learn how to design a trading system by Accelerator Oscillator

A new article from our series about how to create simple trading systems by the most popular technical indicators. We will learn about a new one which is the Accelerator Oscillator indicator and we will learn how to design a trading system using it.
Creating Information Boards Using Standard Library Classes and Google Chart API
Creating Information Boards Using Standard Library Classes and Google Chart API

Creating Information Boards Using Standard Library Classes and Google Chart API

The MQL5 programming language primarily targets the creation of automated trading systems and complex instruments of technical analyses. But aside from this, it allows us to create interesting information systems for tracking market situations, and provides a return connection with the trader. The article describes the MQL5 Standard Library components, and shows examples of their use in practice for reaching these objectives. It also demonstrates an example of using Google Chart API for the creation of charts.
How to Quickly Create an Expert Advisor for Automated Trading Championship 2010
How to Quickly Create an Expert Advisor for Automated Trading Championship 2010

How to Quickly Create an Expert Advisor for Automated Trading Championship 2010

In order to develop an expert to participate in Automated Trading Championship 2010, let's use a template of ready expert advisor. Even novice MQL5 programmer will be capable of this task, because for your strategies the basic classes, functions, templates are already developed. It's enough to write a minimal amount of code to implement your trading idea.
Optimization. A Few Simple Ideas
Optimization. A Few Simple Ideas

Optimization. A Few Simple Ideas

The optimization process can require significant resources of your computer or even of the MQL5 Cloud Network test agents. This article comprises some simple ideas that I use for work facilitation and improvement of the MetaTrader 5 Strategy Tester. I got these ideas from the documentation, forum and articles.
preview
Creating an EA that works automatically (Part 11): Automation (III)

Creating an EA that works automatically (Part 11): Automation (III)

An automated system will not be successful without proper security. However, security will not be ensured without a good understanding of certain things. In this article, we will explore why achieving maximum security in automated systems is such a challenge.
Graphics in DoEasy library (Part 77): Shadow object class
Graphics in DoEasy library (Part 77): Shadow object class

Graphics in DoEasy library (Part 77): Shadow object class

In this article, I will create a separate class for the shadow object, which is a descendant of the graphical element object, as well as add the ability to fill the object background with a gradient fill.
Other classes in DoEasy library (Part 72): Tracking and recording chart object parameters in the collection
Other classes in DoEasy library (Part 72): Tracking and recording chart object parameters in the collection

Other classes in DoEasy library (Part 72): Tracking and recording chart object parameters in the collection

In this article, I will complete working with chart object classes and their collection. I will also implement auto tracking of changes in chart properties and their windows, as well as saving new parameters to the object properties. Such a revision allows the future implementation of an event functionality for the entire chart collection.
Using Pseudo-Templates as Alternative to C++ Templates
Using Pseudo-Templates as Alternative to C++ Templates

Using Pseudo-Templates as Alternative to C++ Templates

The article describes a way of programming without using templates but keeping the style of programming iherenet to them. It tells about implementation of templates using custom methods and has a ready-made script attached for creating a code on the basis of specified templates.
Programming EA's Modes Using Object-Oriented Approach
Programming EA's Modes Using Object-Oriented Approach

Programming EA's Modes Using Object-Oriented Approach

This article explains the idea of multi-mode trading robot programming in MQL5. Every mode is implemented with the object-oriented approach. Instances of both mode classes hierarchy and classes for testing are provided. Multi-mode programming of trading robots is supposed to take into account all peculiarities of every operational mode of an EA written in MQL5. Functions and enumeration are created for identifying the mode.
Custom Graphical Controls. Part 2. Control Library
Custom Graphical Controls. Part 2. Control Library

Custom Graphical Controls. Part 2. Control Library

The second article of the "Custom Graphical Controls" series introduces a control library for handling the main problems arising in interaction between a program (Expert Advisor, script, indicator) and a user. The library contains a great number of classes (CInputBox, CSpinInputBox, CCheckBox, CRadioGroup, CVSсrollBar, CHSсrollBar, CList, CListMS, CComBox, CHMenu, CVMenu, CHProgress, CDialer, CDialerInputBox, CTable) and examples of their use.
preview
Learn how to design a trading system by Standard Deviation

Learn how to design a trading system by Standard Deviation

Here is a new article in our series about how to design a trading system by the most popular technical indicators in MetaTrader 5 trading platform. In this new article, we will learn how to design a trading system by Standard Deviation indicator.
preview
Learn how to design a trading system by Williams PR

Learn how to design a trading system by Williams PR

A new article in our series about learning how to design a trading system by the most popular technical indicators by MQL5 to be used in the MetaTrader 5. In this article, we will learn how to design a trading system by the Williams' %R indicator.
Timeseries in DoEasy library (part 45): Multi-period indicator buffers
Timeseries in DoEasy library (part 45): Multi-period indicator buffers

Timeseries in DoEasy library (part 45): Multi-period indicator buffers

In this article, I will start the improvement of the indicator buffer objects and collection class for working in multi-period and multi-symbol modes. I am going to consider the operation of buffer objects for receiving and displaying data from any timeframe on the current symbol chart.
Studying the CCanvas Class. Anti-aliasing and Shadows
Studying the CCanvas Class. Anti-aliasing and Shadows

Studying the CCanvas Class. Anti-aliasing and Shadows

An anti-aliasing algorithm of the CCanvas class is the base for all constructions where anti-aliasing is being used. The article contains information about how this algorithm operates, and provides relevant examples of visualization. It also covers drawing shades of graphic objects and has a detailed algorithm developed for drawing shades on canvas. The numerical analysis library ALGLIB is used for calculations.
Indicator for Spindles Charting
Indicator for Spindles Charting

Indicator for Spindles Charting

The article regards spindle chart plotting and its usage in trading strategies and experts. First let's discuss the chart's appearance, plotting and connection with japanese candlestick chart. Next we analyze the indicator's implementation in the source code in the MQL5 language. Let's test the expert based on indicator and formulate the trading strategy.
MVC design pattern and its application (Part 2): Diagram of interaction between the three components
MVC design pattern and its application (Part 2): Diagram of interaction between the three components

MVC design pattern and its application (Part 2): Diagram of interaction between the three components

This article is a continuation and completion of the topic discussed in the previous article: the MVC pattern in MQL programs. In this article, we will consider a diagram of possible interaction between the three components of the pattern.
Trademinator 3: Rise of the Trading Machines
Trademinator 3: Rise of the Trading Machines

Trademinator 3: Rise of the Trading Machines

In the article "Dr. Tradelove..." we created an Expert Advisor, which independently optimizes parameters of a pre-selected trading system. Moreover, we decided to create an Expert Advisor that can not only optimize parameters of one trading system underlying the EA, but also select the best one of several trading systems. Let's see what can come of it...
Creating Documentation Based on MQL5 Source Code
Creating Documentation Based on MQL5 Source Code

Creating Documentation Based on MQL5 Source Code

This article considers creation of documentation for MQL5 code starting with the automated markup of required tags. It also provides the description of how to use the Doxygen software, how to properly configure it and how to receive results in different formats, including html, HtmlHelp and PDF.
Building a Spectrum Analyzer
Building a Spectrum Analyzer

Building a Spectrum Analyzer

This article is intended to get its readers acquainted with a possible variant of using graphical objects of the MQL5 language. It analyses an indicator, which implements a panel of managing a simple spectrum analyzer using the graphical objects. The article is meant for readers acquianted with basics of MQL5.
Price series discretization, random component and noise
Price series discretization, random component and noise

Price series discretization, random component and noise

We usually analyze the market using candlesticks or bars that slice the price series into regular intervals. Doesn't such discretization method distort the real structure of market movements? Discretization of an audio signal at regular intervals is an acceptable solution because an audio signal is a function that changes over time. The signal itself is an amplitude which depends on time. This signal property is fundamental.
preview
Creating an EA that works automatically (Part 12): Automation (IV)

Creating an EA that works automatically (Part 12): Automation (IV)

If you think automated systems are simple, then you probably don't fully understand what it takes to create them. In this article, we will talk about the problem that kills a lot of Expert Advisors. The indiscriminate triggering of orders is a possible solution to this problem.
preview
Multiple indicators on one chart (Part 06): Turning MetaTrader 5 into a RAD system (II)

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

In my previous article, I showed you how to create a Chart Trade using MetaTrader 5 objects and thus to turn the platform into a RAD system. The system works very well, and for sure many of the readers might have thought about creating a library, which would allow having extended functionality in the proposed system. Based on this, it would be possible to develop a more intuitive Expert Advisor with a nicer and easier to use interface.
preview
Neural networks made easy (Part 5): Multithreaded calculations in OpenCL

Neural networks made easy (Part 5): Multithreaded calculations in OpenCL

We have earlier discussed some types of neural network implementations. In the considered networks, the same operations are repeated for each neuron. A logical further step is to utilize multithreaded computing capabilities provided by modern technology in an effort to speed up the neural network learning process. One of the possible implementations is described in this article.
Graphics in DoEasy library (Part 81): Integrating graphics into library objects
Graphics in DoEasy library (Part 81): Integrating graphics into library objects

Graphics in DoEasy library (Part 81): Integrating graphics into library objects

It is time to start the integration of the already created objects into the previously created library objects. This will ultimately endow each library object with its own graphical object allowing users to interact with the program.
preview
Learn how to design a trading system by Parabolic SAR

Learn how to design a trading system by Parabolic SAR

In this article, we will continue our series about how to design a trading system using the most popular indicators. In this article, we will learn about the Parabolic SAR indicator in detail and how we can design a trading system to be used in MetaTrader 5 using some simple strategies.
Graphical Interfaces VIII: the File Navigator Control (Chapter 3)
Graphical Interfaces VIII: the File Navigator Control (Chapter 3)

Graphical Interfaces VIII: the File Navigator Control (Chapter 3)

In the previous chapters of the eighth part of the series, our library has been reinforced by several classes for developing mouse pointers, calendars and tree views. The current article deals with the file navigator control that can also be used as part of an MQL application graphical interface.
Handling ZIP Archives in Pure MQL5
Handling ZIP Archives in Pure MQL5

Handling ZIP Archives in Pure MQL5

The MQL5 language keeps evolving, and its new features for working with data are constantly being added. Due to innovation it has recently become possible to operate with ZIP archives using regular MQL5 tools without getting third party DLL libraries involved. This article focuses on how this is done and provides the CZip class, which is a universal tool for reading, creating and modifying ZIP archives, as an example.
Growing Neural Gas: Implementation in MQL5
Growing Neural Gas: Implementation in MQL5

Growing Neural Gas: Implementation in MQL5

The article shows an example of how to develop an MQL5-program implementing the adaptive algorithm of clustering called Growing neural gas (GNG). The article is intended for the users who have studied the language documentation and have certain programming skills and basic knowledge in the area of neuroinformatics.
Graphical Interfaces XI: Refactoring the Library code (build 14.1)
Graphical Interfaces XI: Refactoring the Library code (build 14.1)

Graphical Interfaces XI: Refactoring the Library code (build 14.1)

As the library grows, its code must be optimized again in order to reduce its size. The version of the library described in this article has become even more object-oriented. This made the code easier to learn. A detailed description of the latest changes will allow the readers to develop the library independently based on their own needs.
preview
How to use ONNX models in MQL5

How to use ONNX models in MQL5

ONNX (Open Neural Network Exchange) is an open format built to represent machine learning models. In this article, we will consider how to create a CNN-LSTM model to forecast financial timeseries. We will also show how to use the created ONNX model in an MQL5 Expert Advisor.
preview
Multiple indicators on one chart (Part 04): Advancing to an Expert Advisor

Multiple indicators on one chart (Part 04): Advancing to an Expert Advisor

In my previous articles, I have explained how to create an indicator with multiple subwindows, which becomes interesting when using custom indicators. This time we will see how to add multiple windows to an Expert Advisor.
preview
Developing a trading Expert Advisor from scratch (Part 18): New order system (I)

Developing a trading Expert Advisor from scratch (Part 18): New order system (I)

This is the first part of the new order system. Since we started documenting this EA in our articles, it has undergone various changes and improvements while maintaining the same on-chart order system model.
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.
Statistical Estimations
Statistical Estimations

Statistical Estimations

Estimation of statistical parameters of a sequence is very important, since most of mathematical models and methods are based on different assumptions. For example, normality of distribution law or dispersion value, or other parameters. Thus, when analyzing and forecasting of time series we need a simple and convenient tool that allows quickly and clearly estimating the main statistical parameters. The article shortly describes the simplest statistical parameters of a random sequence and several methods of its visual analysis. It offers the implementation of these methods in MQL5 and the methods of visualization of the result of calculations using the Gnuplot application.
preview
DoEasy. Controls (Part 1): First steps

DoEasy. Controls (Part 1): First steps

This article starts an extensive topic of creating controls in Windows Forms style using MQL5. My first object of interest is creating the panel class. It is already becoming difficult to manage things without controls. Therefore, I will create all possible controls in Windows Forms style.
Using Discriminant Analysis to Develop Trading Systems
Using Discriminant Analysis to Develop Trading Systems

Using Discriminant Analysis to Develop Trading Systems

When developing a trading system, there usually arises a problem of selecting the best combination of indicators and their signals. Discriminant analysis is one of the methods to find such combinations. The article gives an example of developing an EA for market data collection and illustrates the use of the discriminant analysis for building prognostic models for the FOREX market in Statistica software.
preview
Learn how to design a trading system by Bull's Power

Learn how to design a trading system by Bull's Power

Welcome to a new article in our series about learning how to design a trading system by the most popular technical indicator as we will learn in this article about a new technical indicator and how we can design a trading system by it and this indicator is the Bull's Power indicator.
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.
Graphical Interfaces VIII: The Tree View Control (Chapter 2)
Graphical Interfaces VIII: The Tree View Control (Chapter 2)

Graphical Interfaces VIII: The Tree View Control (Chapter 2)

The previous chapter of part VIII on graphical interfaces has focused on the elements of static and drop-down calendar. The second chapter will be dedicated to an equally complex element — a tree view, that is included in every complete library used for creating graphical interfaces. A tree view implemented in this article contains multiple flexible settings and modes, thus allowing to adjust this element of control to your needs.
preview
Developing a trading Expert Advisor from scratch (Part 31): Towards the future (IV)

Developing a trading Expert Advisor from scratch (Part 31): Towards the future (IV)

We continue to remove separate parts from our EA. This is the last article within this series. And the last thing to be removed is the sound system. This can be a bit confusing if you haven't followed these article series.