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
Use MQL5.community channels and group chats
Use MQL5.community channels and group chats

Use MQL5.community channels and group chats

The MQL5.com website brings together traders from all over the world. Users publish articles, share free codes, sell products in the Market, perform Freelance orders and copy trading signals. You can communicate with them on the Forum, in trader chats and in MetaTrader channels.
Graphics in DoEasy library (Part 87): Graphical object collection - managing object property modification on all open charts
Graphics in DoEasy library (Part 87): Graphical object collection - managing object property modification on all open charts

Graphics in DoEasy library (Part 87): Graphical object collection - managing object property modification on all open charts

In this article, I will continue my work on tracking standard graphical object events and create the functionality allowing users to control changes in the properties of graphical objects placed on any charts opened in the terminal.
Graphics in DoEasy library (Part 86): Graphical object collection - managing property modification
Graphics in DoEasy library (Part 86): Graphical object collection - managing property modification

Graphics in DoEasy library (Part 86): Graphical object collection - managing property modification

In this article, I will consider tracking property value modification, as well as removing and renaming graphical objects in the library.
preview
Multilayer perceptron and backpropagation algorithm (Part II): Implementation in Python and integration with MQL5

Multilayer perceptron and backpropagation algorithm (Part II): Implementation in Python and integration with MQL5

There is a Python package available for developing integrations with MQL, which enables a plethora of opportunities such as data exploration, creation and use of machine learning models. The built in Python integration in MQL5 enables the creation of various solutions, from simple linear regression to deep learning models. Let's take a look at how to set up and prepare a development environment and how to use use some of the machine learning libraries.
Better Programmer (Part 07): Notes on becoming a successful freelance developer
Better Programmer (Part 07): Notes on becoming a successful freelance developer

Better Programmer (Part 07): Notes on becoming a successful freelance developer

Do you wish to become a successful Freelance developer on MQL5? If the answer is yes, this article is right for you.
Graphics in DoEasy library (Part 85): Graphical object collection - adding newly created objects
Graphics in DoEasy library (Part 85): Graphical object collection - adding newly created objects

Graphics in DoEasy library (Part 85): Graphical object collection - adding newly created objects

In this article, I will complete the development of the descendant classes of the abstract graphical object class and start implementing the ability to store these objects in the collection class. In particular, I will create the functionality for adding newly created standard graphical objects to the collection class.
Graphics in DoEasy library (Part 84): Descendant classes of the abstract standard graphical object
Graphics in DoEasy library (Part 84): Descendant classes of the abstract standard graphical object

Graphics in DoEasy library (Part 84): Descendant classes of the abstract standard graphical object

In this article, I will consider creation of descendant objects for the terminal abstract standard graphical object. The class object describes the properties that are common for all graphical objects. So, it is simply some kind of a graphical object. To clarify its affiliation with a real graphical object, we need to set the properties inherent in this particular graphical object in the descendant object class.
preview
Programming a Deep Neural Network from Scratch using MQL Language

Programming a Deep Neural Network from Scratch using MQL Language

This article aims to teach the reader how to make a Deep Neural Network from scratch using the MQL4/5 language.
Better Programmer (Part 06): 9 habits that lead to effective coding
Better Programmer (Part 06): 9 habits that lead to effective coding

Better Programmer (Part 06): 9 habits that lead to effective coding

It's not always all about writing the code that leads to effective coding. There are certain habits that I have found in my experience that lead to effective coding. We are going to discuss some of them in detail in this article. This is a must-read article for every programmer who wants to improve their ability to write complex algorithms with less hassle.
Graphics in DoEasy library (Part 83): Class of the abstract standard graphical object
Graphics in DoEasy library (Part 83): Class of the abstract standard graphical object

Graphics in DoEasy library (Part 83): Class of the abstract standard graphical object

In this article, I will create the class of the abstract graphical object. This object is to serve as a basis for creating the class of standard graphical objects. Graphical objects feature multiple properties. Therefore, I will need to do a lot of preparatory work before actually creating the abstract graphical object class. This work includes setting the properties in the library enumerations.
preview
Dealing with Time (Part 2): The Functions

Dealing with Time (Part 2): The Functions

Determing the broker offset and GMT automatically. Instead of asking the support of your broker, from whom you will probably receive an insufficient answer (who would be willing to explain a missing hour), we simply look ourselves how they time their prices in the weeks of the time changes — but not cumbersome by hand, we let a program do it — why do we have a PC after all.
Combinatorics and probability theory for trading (Part III): The first mathematical model
Combinatorics and probability theory for trading (Part III): The first mathematical model

Combinatorics and probability theory for trading (Part III): The first mathematical model

A logical continuation of the earlier discussed topic would be the development of multifunctional mathematical models for trading tasks. In this article, I will describe the entire process related to the development of the first mathematical model describing fractals, from scratch. This model should become an important building block and be multifunctional and universal. It will build up our theoretical basis for further development of this idea.
preview
Dealing with Time (Part 1): The Basics

Dealing with Time (Part 1): The Basics

Functions and code snippets that simplify and clarify the handling of time, broker offset, and the changes to summer or winter time. Accurate timing may be a crucial element in trading. At the current hour, is the stock exchange in London or New York already open or not yet open, when does the trading time for Forex trading start and end? For a trader who trades manually and live, this is not a big problem.
Graphics in DoEasy library (Part 82): Library objects refactoring and collection of graphical objects
Graphics in DoEasy library (Part 82): Library objects refactoring and collection of graphical objects

Graphics in DoEasy library (Part 82): Library objects refactoring and collection of graphical objects

In this article, I will improve all library objects by assigning a unique type to each object and continue the development of the library graphical objects collection class.
Combinatorics and probability theory for trading (Part II): Universal fractal
Combinatorics and probability theory for trading (Part II): Universal fractal

Combinatorics and probability theory for trading (Part II): Universal fractal

In this article, we will continue to study fractals and will pay special attention to summarizing all the material. To do this, I will try to bring all earlier developments into a compact form which would be convenient and understandable for practical application in trading.
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.
Better programmer (Part 05): How to become a faster developer
Better programmer (Part 05): How to become a faster developer

Better programmer (Part 05): How to become a faster developer

Every developer wants to be able to write code faster, and being able to code faster and effective is not some kind of special ability that only a few people are born with. It's a skill that can be learned, that is what I'm trying to teach in this article.
Graphics in DoEasy library (Part 80): "Geometric animation frame" object class
Graphics in DoEasy library (Part 80): "Geometric animation frame" object class

Graphics in DoEasy library (Part 80): "Geometric animation frame" object class

In this article, I will optimize the code of classes from the previous articles and create the geometric animation frame object class allowing us to draw regular polygons with a given number of vertices.
preview
Exploring options for creating multicolored candlesticks

Exploring options for creating multicolored candlesticks

In this article I will address the possibilities of creating customized indicators with candlesticks, pointing out their advantages and disadvantages.
preview
Bid/Ask spread analysis in MetaTrader 5

Bid/Ask spread analysis in MetaTrader 5

An indicator to report your brokers Bid/Ask spread levels. Now we can use MT5s tick data to analyze what the historic true average Bid/Ask spread actually have recently been. You shouldn't need to look at the current spread because that is available if you show both bid and ask price lines.
Graphics in DoEasy library (Part 79): "Animation frame" object class and its descendant objects
Graphics in DoEasy library (Part 79): "Animation frame" object class and its descendant objects

Graphics in DoEasy library (Part 79): "Animation frame" object class and its descendant objects

In this article, I will develop the class of a single animation frame and its descendants. The class is to allow drawing shapes while maintaining and then restoring the background under them.
preview
Combinatorics and probability theory for trading (Part I): The basics

Combinatorics and probability theory for trading (Part I): The basics

In this series of article, we will try to find a practical application of probability theory to describe trading and pricing processes. In the first article, we will look into the basics of combinatorics and probability, and will analyze the first example of how to apply fractals in the framework of the probability theory.
Better Programmer (Part 04): How to become a faster developer
Better Programmer (Part 04): How to become a faster developer

Better Programmer (Part 04): How to become a faster developer

Every developer wants to be able to write code faster, and being able to code faster and effective is not some kind of special ability that only a few people are born with. It's a skill that can be learned by every coder, regardless of years of experience on the keyboard.
Better Programmer (Part 03): Give Up doing these 5 things to become a successful MQL5 Programmer
Better Programmer (Part 03): Give Up doing these 5 things to become a successful MQL5 Programmer

Better Programmer (Part 03): Give Up doing these 5 things to become a successful MQL5 Programmer

This is the must-read article for anyone wanting to improve their programming career. This article series is aimed at making you the best programmer you can possibly be, no matter how experienced you are. The discussed ideas work for MQL5 programming newbies as well as professionals.
Patterns with Examples (Part I): Multiple Top
Patterns with Examples (Part I): Multiple Top

Patterns with Examples (Part I): Multiple Top

This is the first article in a series related to reversal patterns in the framework of algorithmic trading. We will begin with the most interesting pattern family, which originate from the Double Top and Double Bottom patterns.
Better Programmer (Part 02): Stop doing these 5 things to become a successful MQL5 programmer
Better Programmer (Part 02): Stop doing these 5 things to become a successful MQL5 programmer

Better Programmer (Part 02): Stop doing these 5 things to become a successful MQL5 programmer

This is the must read article for anyone wanting to improve their programming career. This article series is aimed at making you the best programmer you can possibly be, no matter how experienced you are. The discussed ideas work for MQL5 programming newbies as well as professionals.
Graphics in DoEasy library (Part 78): Animation principles in the library. Image slicing
Graphics in DoEasy library (Part 78): Animation principles in the library. Image slicing

Graphics in DoEasy library (Part 78): Animation principles in the library. Image slicing

In this article, I will define the animation principles to be used in some parts of the library. I will also develop a class for copying a part of the image and pasting it to a specified form object location while preserving and restoring the part of the form background the image is to be superimposed on.
Better Programmer (Part 01): You must stop doing these 5 things to become a successful MQL5 programmer
Better Programmer (Part 01): You must stop doing these 5 things to become a successful MQL5 programmer

Better Programmer (Part 01): You must stop doing these 5 things to become a successful MQL5 programmer

There are a lot of bad habits that newbies and even advanced programmers are doing that are keeping them from becoming the best they can be to their coding career. We are going to discuss and address them in this article. This article is a must read for everyone who wants to become successful developer in MQL5.
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.
Graphics in DoEasy library (Part 76): Form object and predefined color themes
Graphics in DoEasy library (Part 76): Form object and predefined color themes

Graphics in DoEasy library (Part 76): Form object and predefined color themes

In this article, I will describe the concept of building various library GUI design themes, create the Form object, which is a descendant of the graphical element class object, and prepare data for creating shadows of the library graphical objects, as well as for further development of the functionality.
Graphics in DoEasy library (Part 75): Methods of handling primitives and text in the basic graphical element
Graphics in DoEasy library (Part 75): Methods of handling primitives and text in the basic graphical element

Graphics in DoEasy library (Part 75): Methods of handling primitives and text in the basic graphical element

In this article, I will continue the development of the basic graphical element class of all library graphical objects powered by the CCanvas Standard Library class. I will create the methods for drawing graphical primitives and for displaying a text on a graphical element object.
Graphics in DoEasy library (Part 74): Basic graphical element powered by the CCanvas class
Graphics in DoEasy library (Part 74): Basic graphical element powered by the CCanvas class

Graphics in DoEasy library (Part 74): Basic graphical element powered by the CCanvas class

In this article, I will rework the concept of building graphical objects from the previous article and prepare the base class of all graphical objects of the library powered by the Standard Library CCanvas class.
Graphics in DoEasy library (Part 73): Form object of a graphical element
Graphics in DoEasy library (Part 73): Form object of a graphical element

Graphics in DoEasy library (Part 73): Form object of a graphical element

The article opens up a new large section of the library for working with graphics. In the current article, I will create the mouse status object, the base object of all graphical elements and the class of the form object of the library graphical elements.
preview
Cluster analysis (Part I): Mastering the slope of indicator lines

Cluster analysis (Part I): Mastering the slope of indicator lines

Cluster analysis is one of the most important elements of artificial intelligence. In this article, I attempt applying the cluster analysis of the indicator slope to get threshold values for determining whether a market is flat or following a trend.
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.
Tips from a professional programmer (Part II): Storing and exchanging parameters between an Expert Advisor, scripts and external programs
Tips from a professional programmer (Part II): Storing and exchanging parameters between an Expert Advisor, scripts and external programs

Tips from a professional programmer (Part II): Storing and exchanging parameters between an Expert Advisor, scripts and external programs

These are some tips from a professional programmer about methods, techniques and auxiliary tools which can make programming easier. We will discuss parameters which can be restored after terminal restart (shutdown). All examples are real working code segments from my Cayman project.
Other classes in DoEasy library (Part 71): Chart object collection events
Other classes in DoEasy library (Part 71): Chart object collection events

Other classes in DoEasy library (Part 71): Chart object collection events

In this article, I will create the functionality for tracking some chart object events — adding/removing symbol charts and chart subwindows, as well as adding/removing/changing indicators in chart windows.
Swaps (Part I): Locking and Synthetic Positions
Swaps (Part I): Locking and Synthetic Positions

Swaps (Part I): Locking and Synthetic Positions

In this article I will try to expand the classic concept of swap trading methods. I will explain why I have come to the conclusion that this concept deserves special attention and is absolutely recommended for study.
Other classes in DoEasy library (Part 70): Expanding functionality and auto updating the chart object collection
Other classes in DoEasy library (Part 70): Expanding functionality and auto updating the chart object collection

Other classes in DoEasy library (Part 70): Expanding functionality and auto updating the chart object collection

In this article, I will expand the functionality of chart objects and arrange navigation through charts, creation of screenshots, as well as saving and applying templates to charts. Also, I will implement auto update of the collection of chart objects, their windows and indicators within them.
preview
Tips from a professional programmer (Part I): Code storing, debugging and compiling. Working with projects and logs

Tips from a professional programmer (Part I): Code storing, debugging and compiling. Working with projects and logs

These are some tips from a professional programmer about methods, techniques and auxiliary tools which can make programming easier.