Articles on the MQL5 programming and use of trading robots

icon

Expert Advisors created for the MetaTrader platform perform a variety of functions implemented by their developers. Trading robots can track financial symbols 24 hours a day, copy deals, create and send reports, analyze news and even provide specific custom graphical interface.

The articles describe programming techniques, mathematical ideas for data processing, tips on creating and ordering of trading robots.

Add a new article
latest | best
Simple Trading Systems Using Semaphore Indicators
Simple Trading Systems Using Semaphore Indicators

Simple Trading Systems Using Semaphore Indicators

If we thoroughly examine any complex trading system, we will see that it is based on a set of simple trading signals. Therefore, there is no need for novice developers to start writing complex algorithms immediately. This article provides an example of a trading system that uses semaphore indicators to perform deals.
Deep Neural Networks (Part IV). Creating, training and testing a model of neural network
Deep Neural Networks (Part IV). Creating, training and testing a model of neural network

Deep Neural Networks (Part IV). Creating, training and testing a model of neural network

This article considers new capabilities of the darch package (v.0.12.0). It contains a description of training of a deep neural networks with different data types, different structure and training sequence. Training results are included.
Creating MQL5 Expert Advisors in minutes using EA Tree: Part One
Creating MQL5 Expert Advisors in minutes using EA Tree: Part One

Creating MQL5 Expert Advisors in minutes using EA Tree: Part One

EA Tree is the first drag and drop MetaTrader MQL5 Expert Advisor builder. You can create complex MQL5 using a very easy to use graphical user interface. In EA Tree, Expert Advisors are created by connecting boxes together. Boxes may contain MQL5 functions, technical indicators, custom indicators, or values. Using the "tree of boxes", EA Tree generates the MQL5 code of the Expert Advisor.
Change Expert Advisor Parameters From the User Panel "On the Fly"
Change Expert Advisor Parameters From the User Panel "On the Fly"

Change Expert Advisor Parameters From the User Panel "On the Fly"

This article provides a small example demonstrating the implementation of an Expert Advisor whose parameters can be controlled from the user panel. When changing the parameters "on the fly", the Expert Advisor writes the values obtained from the info panel to a file to further read them from the file and display accordingly on the panel. This article may be relevant to those who trade manually or in semi-automatic mode.
Exploring Trading Strategy Classes of the Standard Library - Customizing Strategies
Exploring Trading Strategy Classes of the Standard Library - Customizing Strategies

Exploring Trading Strategy Classes of the Standard Library - Customizing Strategies

In this article we are going to show how to explore the Standard Library of Trading Strategy Classes and how to add Custom Strategies and Filters/Signals using the Patterns-and-Models logic of the MQL5 Wizard. In the end you will be able easily add your own strategies using MetaTrader 5 standard indicators, and MQL5 Wizard will create a clean and powerful code and fully functional Expert Advisor.
Deep Neural Networks (Part VII). Ensemble of neural networks: stacking
Deep Neural Networks (Part VII). Ensemble of neural networks: stacking

Deep Neural Networks (Part VII). Ensemble of neural networks: stacking

We continue to build ensembles. This time, the bagging ensemble created earlier will be supplemented with a trainable combiner — a deep neural network. One neural network combines the 7 best ensemble outputs after pruning. The second one takes all 500 outputs of the ensemble as input, prunes and combines them. The neural networks will be built using the keras/TensorFlow package for Python. The features of the package will be briefly considered. Testing will be performed and the classification quality of bagging and stacking ensembles will be compared.
MQL5 Cookbook - Trading signals of moving channels
MQL5 Cookbook - Trading signals of moving channels

MQL5 Cookbook - Trading signals of moving channels

The article describes the process of developing and implementing a class for sending signals based on the moving channels. Each of the signal version is followed by a trading strategy with testing results. Classes of the Standard Library are used for creating derived classes.
MQL5 Wizard: New Version
MQL5 Wizard: New Version

MQL5 Wizard: New Version

The article contains descriptions of the new features available in the updated MQL5 Wizard. The modified architecture of signals allow creating trading robots based on the combination of various market patterns. The example contained in the article explains the procedure of interactive creation of an Expert Advisor.
Building an Automatic News Trader
Building an Automatic News Trader

Building an Automatic News Trader

This is the continuation of Another MQL5 OOP class article which showed you how to build a simple OO EA from scratch and gave you some tips on object-oriented programming. Today I am showing you the technical basics needed to develop an EA able to trade the news. My goal is to keep on giving you ideas about OOP and also cover a new topic in this series of articles, working with the file system.
Cross-Platform Expert Advisor: Money Management
Cross-Platform Expert Advisor: Money Management

Cross-Platform Expert Advisor: Money Management

This article discusses the implementation of money management method for a cross-platform expert advisor. The money management classes are responsible for the calculation of the lot size to be used for the next trade to be entered by the expert advisor.
MQL5 Cookbook - Pivot trading signals
MQL5 Cookbook - Pivot trading signals

MQL5 Cookbook - Pivot trading signals

The article describes the development and implementation of a class for sending signals based on pivots — reversal levels. This class is used to form a strategy applying the Standard Library. Improving the pivot strategy by adding filters is considered.
Martingale as the basis for a long-term trading strategy
Martingale as the basis for a long-term trading strategy

Martingale as the basis for a long-term trading strategy

In this article we will consider in detail the martingale system. We will review whether this system can be applied in trading and how to use it in order to minimize risks. The main disadvantage of this simple system is the probability of losing the entire deposit. This fact must be taken into account, if you decide to trade using the martingale technique.
Trading signals module using the system by Bill Williams
Trading signals module using the system by Bill Williams

Trading signals module using the system by Bill Williams

The article describes the rules of the trading system by Bill Williams, the procedure of application for a developed MQL5 module to search and mark patterns of this system on the chart, automated trading with found patterns, and also presents the results of testing on various trading instruments.
Developing a cross-platform grider EA
Developing a cross-platform grider EA

Developing a cross-platform grider EA

In this article, we will learn how to create Expert Advisors (EAs) working both in MetaTrader 4 and MetaTrader 5. To do this, we are going to develop an EA constructing order grids. Griders are EAs that place several limit orders above the current price and the same number of limit orders below it simultaneously.
Developing a self-adapting algorithm (Part I): Finding a basic pattern
Developing a self-adapting algorithm (Part I): Finding a basic pattern

Developing a self-adapting algorithm (Part I): Finding a basic pattern

In the upcoming series of articles, I will demonstrate the development of self-adapting algorithms considering most market factors, as well as show how to systematize these situations, describe them in logic and take them into account in your trading activity. I will start with a very simple algorithm that will gradually acquire theory and evolve into a very complex project.
Developing a trading Expert Advisor from scratch
Developing a trading Expert Advisor from scratch

Developing a trading Expert Advisor from scratch

In this article, we will discuss how to develop a trading robot with minimum programming. Of course, MetaTrader 5 provides a high level of control over trading positions. However, using only the manual ability to place orders can be quite difficult and risky for less experienced users.
Order Strategies. Multi-Purpose Expert Advisor
Order Strategies. Multi-Purpose Expert Advisor

Order Strategies. Multi-Purpose Expert Advisor

This article centers around strategies that actively use pending orders, a metalanguage that can be created to formally describe such strategies and the use of a multi-purpose Expert Advisor whose operation is based on those descriptions
Learn how to design a trading system by MACD
Learn how to design a trading system by MACD

Learn how to design a trading system by MACD

In this article, we will learn a new tool from our series: we will learn how to design a trading system based on one of the most popular technical indicators Moving Average Convergence Divergence (MACD).
Forecasting Time Series (Part 2): Least-Square Support-Vector Machine (LS-SVM)
Forecasting Time Series (Part 2): Least-Square Support-Vector Machine (LS-SVM)

Forecasting Time Series (Part 2): Least-Square Support-Vector Machine (LS-SVM)

This article deals with the theory and practical application of the algorithm for forecasting time series, based on support-vector method. It also proposes its implementation in MQL and provides test indicators and Expert Advisors. This technology has not been implemented in MQL yet. But first, we have to get to know math for it.
Econometric approach to finding market patterns: Autocorrelation, Heat Maps and Scatter Plots
Econometric approach to finding market patterns: Autocorrelation, Heat Maps and Scatter Plots

Econometric approach to finding market patterns: Autocorrelation, Heat Maps and Scatter Plots

The article presents an extended study of seasonal characteristics: autocorrelation heat maps and scatter plots. The purpose of the article is to show that "market memory" is of seasonal nature, which is expressed through maximized correlation of increments of arbitrary order.
EA remote control methods
EA remote control methods

EA remote control methods

The main advantage of trading robots lies in the ability to work 24 hours a day on a remote VPS server. But sometimes it is necessary to intervene in their work, while there may be no direct access to the server. Is it possible to manage EAs remotely? The article proposes one of the options for controlling EAs via external commands.
Controlled optimization: Simulated annealing
Controlled optimization: Simulated annealing

Controlled optimization: Simulated annealing

The Strategy Tester in the MetaTrader 5 trading platform provides only two optimization options: complete search of parameters and genetic algorithm. This article proposes a new method for optimizing trading strategies — Simulated annealing. The method's algorithm, its implementation and integration into any Expert Advisor are considered. The developed algorithm is tested on the Moving Average EA.
Money-Making Algorithms Employing Trailing Stop
Money-Making Algorithms Employing Trailing Stop

Money-Making Algorithms Employing Trailing Stop

This article's objective is to study profitability of algorithms with different entries into trades and exits using trailing stop. Entry types to be used are random entry and reverse entry. Stop orders to be used are trailing stop and trailing take. The article demonstrates money-making algorithms with a profitability of about 30% per annum.
Processing of trade events in Expert Advisor using the OnTrade() function
Processing of trade events in Expert Advisor using the OnTrade() function

Processing of trade events in Expert Advisor using the OnTrade() function

MQL5 gave a mass of innovations, including work with events of various types (timer events, trade events, custom events, etc.). Ability to handle events allows you to create completely new type of programs for automatic and semi-automatic trading. In this article we will consider trade events and write some code for the OnTrade() function, that will process the Trade event.
How to copy signals using an EA by your rules?
How to copy signals using an EA by your rules?

How to copy signals using an EA by your rules?

When you subscribe to signals, such situation may occur: your trade account has a leverage of 1:100, the provider has a leverage of 1:500 and trades using the minimal lot, and your trade balances are virtually equal — but the copy ratio will comprise only 10% to 15%. This article describes how to increase the copy rate in such cases.
A Virtual Order Manager to track orders within the position-centric MetaTrader 5 environment
A Virtual Order Manager to track orders within the position-centric MetaTrader 5 environment

A Virtual Order Manager to track orders within the position-centric MetaTrader 5 environment

This class library can be added to an MetaTrader 5 Expert Advisor to enable it to be written with an order-centric approach broadly similar to MetaTrader 4, in comparison to the position-based approach of MetaTrader 5. It does this by keeping track of virtual orders at the MetaTrader 5 client terminal, while maintaining a protective broker stop for each position for disaster protection.
The Implementation of a Multi-currency Mode in MetaTrader 5
The Implementation of a Multi-currency Mode in MetaTrader 5

The Implementation of a Multi-currency Mode in MetaTrader 5

For a long time multi-currency analysis and multi-currency trading has been of interest to people. The opportunity to implement a full fledged multi-currency regime became possible only with the public release of MetaTrader 5 and the MQL5 programming language. In this article we propose a way to analyze and process all incoming ticks for several symbols. As an illustration, let's consider a multi-currency RSI indicator of the USDx dollar index.
Applying Monte Carlo method in reinforcement learning
Applying Monte Carlo method in reinforcement learning

Applying Monte Carlo method in reinforcement learning

In the article, we will apply Reinforcement learning to develop self-learning Expert Advisors. In the previous article, we considered the Random Decision Forest algorithm and wrote a simple self-learning EA based on Reinforcement learning. The main advantages of such an approach (trading algorithm development simplicity and high "training" speed) were outlined. Reinforcement learning (RL) is easily incorporated into any trading EA and speeds up its optimization.
Cross-Platform Expert Advisor: Signals
Cross-Platform Expert Advisor: Signals

Cross-Platform Expert Advisor: Signals

This article discusses the CSignal and CSignals classes which will be used in cross-platform expert advisors. It examines the differences between MQL4 and MQL5 on how particular data needed for evaluation of trade signals are accessed to ensure that the code written will be compatible with both compilers.
preview
Learn how to design a trading system by Fibonacci

Learn how to design a trading system by Fibonacci

In this article, we will continue our series of creating a trading system based on the most popular technical indicator. Here is a new technical tool which is the Fibonacci and we will learn how to design a trading system based on this technical indicator.
Learn how to design different Moving Average systems
Learn how to design different Moving Average systems

Learn how to design different Moving Average systems

There are many strategies that can be used to filter generated signals based on any strategy, even by using the moving average itself which is the subject of this article. So, the objective of this article is to share with you some of Moving Average Strategies and how to design an algorithmic trading system.
Multiple Regression Analysis. Strategy Generator and Tester in One
Multiple Regression Analysis. Strategy Generator and Tester in One

Multiple Regression Analysis. Strategy Generator and Tester in One

The article gives a description of ways of use of the multiple regression analysis for development of trading systems. It demonstrates the use of the regression analysis for strategy search automation. A regression equation generated and integrated in an EA without requiring high proficiency in programming is given as an example.
Developing a cross-platform grid EA (Last part): Diversification as a way to increase profitability
Developing a cross-platform grid EA (Last part): Diversification as a way to increase profitability

Developing a cross-platform grid EA (Last part): Diversification as a way to increase profitability

In previous articles within this series, we tried various methods for creating a more or less profitable grid Expert Advisor. Now we will try to increase the EA profitability through diversification. Our ultimate goal is to reach 100% profit per year with the maximum balance drawdown no more than 20%.
How to Develop an Expert Advisor using UML Tools
How to Develop an Expert Advisor using UML Tools

How to Develop an Expert Advisor using UML Tools

This article discusses creation of Expert Advisors using the UML graphical language, which is used for visual modeling of object-oriented software systems. The main advantage of this approach is the visualization of the modeling process. The article contains an example that shows modeling of the structure and properties of an Expert Advisor using the Software Ideas Modeler.
Advanced EA constructor for MetaTrader - botbrains.app
Advanced EA constructor for MetaTrader - botbrains.app

Advanced EA constructor for MetaTrader - botbrains.app

In this article, we demonstrate features of botbrains.app - a no-code platform for trading robots development. To create a trading robot you don't need to write any code - just drag and drop the necessary blocks onto the scheme, set their parameters, and establish connections between them.
Gap - a profitable strategy or 50/50?
Gap - a profitable strategy or 50/50?

Gap - a profitable strategy or 50/50?

The article dwells on gaps — significant differences between a close price of a previous timeframe and an open price of the next one, as well as on forecasting a daily bar direction. Applying the GetOpenFileName function by the system DLL is considered as well.
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.
Library for easy and quick development of MetaTrader programs (part XVIII): Interactivity of account and any other library objects
Library for easy and quick development of MetaTrader programs (part XVIII): Interactivity of account and any other library objects

Library for easy and quick development of MetaTrader programs (part XVIII): Interactivity of account and any other library objects

The article arranges the work of an account object on a new base object of all library objects, improves the CBaseObj base object and tests setting tracked parameters, as well as receiving events for any library objects.
Cross-Platform Expert Advisor: Time Filters
Cross-Platform Expert Advisor: Time Filters

Cross-Platform Expert Advisor: Time Filters

This article discusses the implementation of various methods of time filtering a cross-platform expert advisor. The time filter classes are responsible for checking whether or not a given time falls under a certain time configuration setting.
MQL5 Wizard: Placing Orders, Stop-Losses and Take Profits on Calculated Prices. Standard Library Extension
MQL5 Wizard: Placing Orders, Stop-Losses and Take Profits on Calculated Prices. Standard Library Extension

MQL5 Wizard: Placing Orders, Stop-Losses and Take Profits on Calculated Prices. Standard Library Extension

This article describes the MQL5 Standard Library extension, which allows to create Expert Advisors, place orders, Stop Losses and Take Profits using the MQL5 Wizard by the prices received from included modules. This approach does not apply any additional restrictions on the number of modules and does not cause conflicts in their joint work.