Articles with MQL5 programming examples


Access a huge collection of articles with code examples showing how to create indicators and trading robots for the MetaTrader platform in the MQL5 language. Source codes are attached to the articles, so you can open them in MetaEditor and run them to see how the applications work.

These articles will be useful both for those who have just started exploring automated trading and for professional traders with programming experience. They feature not only examples, but also contain new ideas.

Add a new article
latest | best

Graphics in DoEasy library (Part 100): Making improvements in handling extended standard graphical objects

In the current article, I will eliminate obvious flaws in simultaneous handling of extended (and standard) graphical objects and form objects on canvas, as well as fix errors detected during the test

Data Science and Machine Learning part 03: Matrix Regressions

This time our models are being made by matrices, which allows flexibility while it allows us to make powerful models that can handle not only five independent variables but also many variables as long

Graphics in DoEasy library (Part 99): Moving an extended graphical object using a single control point

In the previous article, I implemented the ability to move pivot points of an extended graphical object using control forms. Now I am going to implement the ability to move a composite graphical

Graphics in DoEasy library (Part 98): Moving pivot points of extended standard graphical objects

In the article, I continue the development of extended standard graphical objects and create the functionality for moving pivot points of composite graphical objects using the control points for

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

Multiple indicators on one chart (Part 02): First experiments

In the previous article "Multiple indicators on one chart" I presented the concept and the basics of how to use multiple indicators on one chart. In this article, I will provide the source code and

What you can do with Moving Averages

The article considers several methods of applying the Moving Average indicator. Each method involving a curve analysis is accompanied by indicators visualizing the idea. In most cases, the ideas shown

Making charts more interesting: Adding a background

Many workstations contain some representative image which shows something about the user. These images make the working environment more beautiful and exciting. Let's see how to make the charts more

Graphics in DoEasy library (Part 97): Independent handling of form object movement

In this article, I will consider the implementation of the independent dragging of any form objects using a mouse. Besides, I will complement the library by error messages and new deal properties

Using the CCanvas class in MQL applications

The article considers the use of the CCanvas class in MQL applications. The theory is accompanied by detailed explanations and examples for thorough understanding of CCanvas basics

Multiple indicators on one chart (Part 01): Understanding the concepts

Today we will learn how to add multiple indicators running simultaneously on one chart, but without occupying a separate area on it. Many traders feel more confident if they monitor multiple

Graphics in DoEasy library (Part 96): Graphics in form objects and handling mouse events

In this article, I will start creating the functionality for handling mouse events in form objects, as well as add new properties and their tracking to a symbol object. Besides, I will improve the

Graphics in DoEasy library (Part 95): Composite graphical object controls

In this article, I will consider the toolkit for managing composite graphical objects - controls for managing an extended standard graphical object. Today, I will slightly digress from relocating a

Graphics in DoEasy library (Part 94): Moving and deleting composite graphical objects

In this article, I will start the development of various composite graphical object events. We will also partially consider moving and deleting a composite graphical object. In fact, here I am going

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

Graphics in DoEasy library (Part 92): Standard graphical object memory class. Object property change history

In the article, I will create the class of the standard graphical object memory allowing the object to save its states when its properties are modified. In turn, this allows retracting to the previous

Graphics in DoEasy library (Part 91): Standard graphical object events. Object name change history

In this article, I will refine the basic functionality for providing control over graphical object events from a library-based program. I will start from implementing the functionality for storing the

Graphics in DoEasy library (Part 90): Standard graphical object events. Basic functionality

In this article, I will implement the basic functionality for tracking standard graphical object events. I will start from a double click event on a graphical object

Graphics in DoEasy library (Part 89): Programming standard graphical objects. Basic functionality

Currently, the library is able to track standard graphical objects on the client terminal chart, including their removal and modification of some of their parameters. At the moment, it lacks the

WebSockets for MetaTrader 5 — Using the Windows API

In this article, we will use the WinHttp.dll to create a WebSocket client for MetaTrader 5 programs. The client will ultimately be implemented as a class and also tested against the

Manual charting and trading toolkit (Part III). Optimization and new tools

In this article, we will further develop the idea of drawing graphical objects on charts using keyboard shortcuts. New tools have been added to the library, including a straight line plotted through

MQL5 Cookbook – Economic Calendar

The article highlights the programming features of the Economic Calendar and considers creating a class for a simplified access to the calendar properties and receiving event values. Developing an

An attempt at developing an EA constructor

In this article, I offer my set of trading functions in the form of a ready-made EA. This method allows getting multiple trading strategies by simply adding indicators and changing inputs

Graphics in DoEasy library (Part 88): Graphical object collection — two-dimensional dynamic array for storing dynamically changing object properties

In this article, I will create a dynamic multidimensional array class with the ability to change the amount of data in any dimension. Based on the created class, I will create a two-dimensional

Using AutoIt With MQL5

Short description. In this article we will explore scripting the MetraTrader 5 terminal by integrating MQL5 with AutoIt. In it we will cover how to automate various tasks by manipulating the

Fix PriceAction Stoploss or Fixed RSI (Smart StopLoss)

Stop-loss is a major tool when it comes to money management in trading. Effective use of stop-loss, take profit and lot size can make a trader more consistent in trading and overall more profitable

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

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

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

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

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

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

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

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

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

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

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

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

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

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