Articles on MetaTrader 5 integration using MQL5

icon

Traders meet interesting challenges which often require an innovative approach. This category features articles that offer the most unexpected solutions for evaluating, analyzing and processing price data and trading results. The articles describe various integration solutions, including connection of databases and ICQ, use of OpenCL and social networks, use of Delphi and C#.

Read on to learn how to use specialized mathematical and neural packages, and much more. Become an author and share unique ideas with the MQL5.community members.

Add a new article
latest | best
Regular expressions for traders
Regular expressions for traders

Regular expressions for traders

A regular expression is a special language for handling texts by applying a specified rule, also called a regex or regexp for short. In this article, we are going to show how to handle a trade report with the RegularExpressions library for MQL5, and will also demonstrate the optimization results after using it.
Extracting structured data from HTML pages using CSS selectors
Extracting structured data from HTML pages using CSS selectors

Extracting structured data from HTML pages using CSS selectors

The article provides a description of a universal method for analyzing and converting data from HTML documents based on CSS selectors. Trading reports, tester reports, your favorite economic calendars, public signals, account monitoring and additional online quote sources will become available straight from MQL.
Applying network functions, or MySQL without DLL: Part II - Program for monitoring changes in signal properties
Applying network functions, or MySQL without DLL: Part II - Program for monitoring changes in signal properties

Applying network functions, or MySQL without DLL: Part II - Program for monitoring changes in signal properties

In the previous part, we considered the implementation of the MySQL connector. In this article, we will consider its application by implementing the service for collecting signal properties and the program for viewing their changes over time. The implemented example has practical sense if users need to observe changes in properties that are not displayed on the signal's web page.
Studying candlestick analysis techniques (part IV): Updates and additions to Pattern Analyzer
Studying candlestick analysis techniques (part IV): Updates and additions to Pattern Analyzer

Studying candlestick analysis techniques (part IV): Updates and additions to Pattern Analyzer

The article presents a new version of the Pattern Analyzer application. This version provides bug fixes and new features, as well as the revised user interface. Comments and suggestions from previous article were taken into account when developing the new version. The resulting application is described in this article.
Deep Neural Networks (Part VI). Ensemble of neural network classifiers: bagging
Deep Neural Networks (Part VI). Ensemble of neural network classifiers: bagging

Deep Neural Networks (Part VI). Ensemble of neural network classifiers: bagging

The article discusses the methods for building and training ensembles of neural networks with bagging structure. It also determines the peculiarities of hyperparameter optimization for individual neural network classifiers that make up the ensemble. The quality of the optimized neural network obtained in the previous article of the series is compared with the quality of the created ensemble of neural networks. Possibilities of further improving the quality of the ensemble's classification are considered.
Cross-Platform Expert Advisor: Orders
Cross-Platform Expert Advisor: Orders

Cross-Platform Expert Advisor: Orders

MetaTrader 4 and MetaTrader 5 uses different conventions in processing trade requests. This article discusses the possibility of using a class object that can be used to represent the trades processed by the server, in order for a cross-platform expert advisor to further work on them, regardless of the version of the trading platform and mode being used.
Universal Expert Advisor: Pending Orders and Hedging Support (Part 5)
Universal Expert Advisor: Pending Orders and Hedging Support (Part 5)

Universal Expert Advisor: Pending Orders and Hedging Support (Part 5)

This article provides further description of the CStrategy trading engine. By popular demand of users, we have added pending order support functions to the trading engine. Also, the latest version of the MetaTrader 5 now supports accounts with the hedging option. The same support has been added to CStrategy. The article provides a detailed description of algorithms for the use of pending orders, as well as of CStrategy operation principles on accounts with the hedging option enabled.
Cross-Platform Expert Advisor: Order Manager
Cross-Platform Expert Advisor: Order Manager

Cross-Platform Expert Advisor: Order Manager

This article discusses the creation of an order manager for a cross-platform expert advisor. The order manager is responsible for the entry and exit of orders or positions entered by the expert, as well as for keeping an independent record of such trades that is usable for both versions.
Finding Errors and Logging
Finding Errors and Logging

Finding Errors and Logging

MetaEditor 5 has the debugging feature. But when you write your MQL5 programs, you often want to display not the individual values, but all messages that appear during testing and online work. When the log file contents have large size, it is obvious to automate quick and easy retrieval of required message. In this article we will consider ways of finding errors in MQL5 programs and methods of logging. Also we will simplify logging into files and will get to know a simple program LogMon for comfortable viewing of logs.
Using OpenCL to test candlestick patterns
Using OpenCL to test candlestick patterns

Using OpenCL to test candlestick patterns

The article describes the algorithm for implementing the OpenCL candlestick patterns tester in the "1 minute OHLC" mode. We will also compare its speed with the built-in strategy tester launched in the fast and slow optimization modes.
R-squared as an estimation of quality of the strategy balance curve
R-squared as an estimation of quality of the strategy balance curve

R-squared as an estimation of quality of the strategy balance curve

This article describes the construction of the custom optimization criterion R-squared. This criterion can be used to estimate the quality of a strategy's balance curve and to select the most smoothly growing and stable strategies. The work discusses the principles of its construction and statistical methods used in estimation of properties and quality of this metric.
Using WinInet in MQL5.  Part 2:  POST Requests and Files
Using WinInet in MQL5.  Part 2:  POST Requests and Files

Using WinInet in MQL5. Part 2: POST Requests and Files

In this article, we continue studying the principles of working with Internet using HTTP requests and exchange of information with server. It describes new functions of the CMqlNet class, methods of sending information from forms and sending of files using POST requests as well as authorization on websites under your login using Cookies.
Using MATLAB 2018 computational capabilities in MetaTrader 5
Using MATLAB 2018 computational capabilities in MetaTrader 5

Using MATLAB 2018 computational capabilities in MetaTrader 5

After the upgrade of the MATLAB package in 2015, it is necessary to consider a modern way of creating DLL libraries. The article uses a sample predictive indicator to illustrate the peculiarities of linking MetaTrader 5 and MATLAB using modern 64-bit versions of the platforms, which are utilized nowadays. With the entire sequence of connecting MATLAB considered, MQL5 developers will be able to create applications with advanced computational capabilities much faster, avoiding «pitfalls».
Evaluating the ability of Fractal index and Hurst exponent to predict financial time series
Evaluating the ability of Fractal index and Hurst exponent to predict financial time series

Evaluating the ability of Fractal index and Hurst exponent to predict financial time series

Studies related to search for the fractal behavior of financial data suggest that behind the seemingly chaotic behavior of economic time series there are hidden stable mechanisms of participants' collective behavior. These mechanisms can lead to the emergence of price dynamics on the exchange, which can define and describe specific properties of price series. When applied to trading, one could benefit from the indicators which can efficiently and reliably estimate the fractal parameters in the scale and time frame, which are relevant in practice.
preview
WebSockets for MetaTrader 5 — Using the Windows API

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 Deriv.com WebSocket API.
Ready-made Expert Advisors from the MQL5 Wizard work in MetaTrader 4
Ready-made Expert Advisors from the MQL5 Wizard work in MetaTrader 4

Ready-made Expert Advisors from the MQL5 Wizard work in MetaTrader 4

The article offers a simple emulator of the MetaTrader 5 trading environment for MetaTrader 4. The emulator implements migration and adjustment of trade classes of the Standard Library. As a result, Expert Advisors generated in the MetaTrader 5 Wizard can be compiled and executed in MetaTrader 4 without changes.
Charts and diagrams in HTML
Charts and diagrams in HTML

Charts and diagrams in HTML

Today it is difficult to find a computer that does not have an installed web-browser. For a long time browsers have been evolving and improving. This article discusses the simple and safe way to create of charts and diagrams, based on the the information, obtained from MetaTrader 5 client terminal for displaying them in the browser.
Developing graphical interfaces based on .Net Framework and C# (part 2): Additional graphical elements
Developing graphical interfaces based on .Net Framework and C# (part 2): Additional graphical elements

Developing graphical interfaces based on .Net Framework and C# (part 2): Additional graphical elements

The article is a follow-up of the previous publication "Developing graphical interfaces for Expert Advisors and indicators based on .Net Framework and C#". It introduces new graphical elements for creating graphical interfaces.
preview
Practical application of neural networks in trading (Part 2). Computer vision

Practical application of neural networks in trading (Part 2). Computer vision

The use of computer vision allows training neural networks on the visual representation of the price chart and indicators. This method enables wider operations with the whole complex of technical indicators, since there is no need to feed them digitally into the neural network.
MQL5 Cookbook - Creating a ring buffer for fast calculation of indicators in a sliding window
MQL5 Cookbook - Creating a ring buffer for fast calculation of indicators in a sliding window

MQL5 Cookbook - Creating a ring buffer for fast calculation of indicators in a sliding window

The ring buffer is the simplest and the most efficient way to arrange data when performing calculations in a sliding window. The article describes the algorithm and shows how it simplifies calculations in a sliding window and makes them more efficient.
MQL5-RPC. Remote Procedure Calls from MQL5: Web Service Access and XML-RPC ATC Analyzer for Fun and Profit
MQL5-RPC. Remote Procedure Calls from MQL5: Web Service Access and XML-RPC ATC Analyzer for Fun and Profit

MQL5-RPC. Remote Procedure Calls from MQL5: Web Service Access and XML-RPC ATC Analyzer for Fun and Profit

This article describes MQL5-RPC framework that enables Remote Procedure Calls from MQL5. It starts with XML-RPC basics, MQL5 implementation and follows with two real usage examples. First example is using external web service and the second one is a client to simple XML-RPC ATC 2011 Analyzer service. If you are interested on how to implement and analyze different statistics from ATC 2011 in real time, this article is just for you.
Cross-Platform Expert Advisor: Custom Stops, Breakeven and Trailing
Cross-Platform Expert Advisor: Custom Stops, Breakeven and Trailing

Cross-Platform Expert Advisor: Custom Stops, Breakeven and Trailing

This article discusses how custom stop levels can be set up in a cross-platform expert advisor. It also discusses a closely-related method by which the evolution of a stop level over time can be defined.
preview
Using AutoIt With MQL5

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 terminals' user interface and also present a class that uses the AutoItX library.
Cross-Platform Expert Advisor: Introduction
Cross-Platform Expert Advisor: Introduction

Cross-Platform Expert Advisor: Introduction

This article details a method by which cross-platform expert advisors can be developed faster and easier. The proposed method consolidates the features shared by both versions into a single class, and splits the implementation on derived classes for incompatible features.
Universal Expert Advisor: the Event Model and Trading Strategy Prototype (Part 2)
Universal Expert Advisor: the Event Model and Trading Strategy Prototype (Part 2)

Universal Expert Advisor: the Event Model and Trading Strategy Prototype (Part 2)

This article continues the series of publications on a universal Expert Advisor model. This part describes in detail the original event model based on centralized data processing, and considers the structure of the CStrategy base class of the engine.
Simulink: a Guide for the Developers of Expert Advisors
Simulink: a Guide for the Developers of Expert Advisors

Simulink: a Guide for the Developers of Expert Advisors

I am not a professional programmer. And thus, the principle of "going from the simple to the complex" is of primary importance to me when I am working on trading system development. What exactly is simple for me? First of all, it is the visualization of the process of creating the system, and the logic of its work. Also, it is a minimum of handwritten code. In this article, I will attempt to create and test the trading system, based on a Matlab package, and then write an Expert Advisor for MetaTrader 5. The historical data from MetaTrader 5 will be used for the testing process.
preview
Finding seasonal patterns in the forex market using the CatBoost algorithm

Finding seasonal patterns in the forex market using the CatBoost algorithm

The article considers the creation of machine learning models with time filters and discusses the effectiveness of this approach. The human factor can be eliminated now by simply instructing the model to trade at a certain hour of a certain day of the week. Pattern search can be provided by a separate algorithm.
Cross-Platform Expert Advisor: The CExpertAdvisor and CExpertAdvisors Classes
Cross-Platform Expert Advisor: The CExpertAdvisor and CExpertAdvisors Classes

Cross-Platform Expert Advisor: The CExpertAdvisor and CExpertAdvisors Classes

This article deals primarily with the classes CExpertAdvisor and CExpertAdvisors, which serve as the container for all the other components described in this article-series regarding cross-platform expert advisors.
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.
Neural Networks Cheap and Cheerful - Link NeuroPro with MetaTrader 5
Neural Networks Cheap and Cheerful - Link NeuroPro with MetaTrader 5

Neural Networks Cheap and Cheerful - Link NeuroPro with MetaTrader 5

If specific neural network programs for trading seem expensive and complex or, on the contrary, too simple, try NeuroPro. It is free and contains the optimal set of functionalities for amateurs. This article will tell you how to use it in conjunction with MetaTrader 5.
MQL as a Markup Tool for the Graphical Interface of MQL Programs. Part 2
MQL as a Markup Tool for the Graphical Interface of MQL Programs. Part 2

MQL as a Markup Tool for the Graphical Interface of MQL Programs. Part 2

This paper continues checking the new conception to describe the window interface of MQL programs, using the structures of MQL. Automatically creating GUI based on the MQL markup provides additional functionality for caching and dynamically generating the elements and controlling the styles and new schemes for processing the events. Attached is an enhanced version of the standard library of controls.
Deep Neural Networks (Part II). Working out and selecting predictors
Deep Neural Networks (Part II). Working out and selecting predictors

Deep Neural Networks (Part II). Working out and selecting predictors

The second article of the series about deep neural networks will consider the transformation and choice of predictors during the process of preparing data for training a model.
preview
CatBoost machine learning algorithm from Yandex with no Python or R knowledge required

CatBoost machine learning algorithm from Yandex with no Python or R knowledge required

The article provides the code and the description of the main stages of the machine learning process using a specific example. To obtain the model, you do not need Python or R knowledge. Furthermore, basic MQL5 knowledge is enough — this is exactly my level. Therefore, I hope that the article will serve as a good tutorial for a broad audience, assisting those interested in evaluating machine learning capabilities and in implementing them in their programs.
Universal Expert Advisor: Trading in a Group and Managing a Portfolio of Strategies (Part 4)
Universal Expert Advisor: Trading in a Group and Managing a Portfolio of Strategies (Part 4)

Universal Expert Advisor: Trading in a Group and Managing a Portfolio of Strategies (Part 4)

In the last part of the series of articles about the CStrategy trading engine, we will consider simultaneous operation of multiple trading algorithms, will learn to load strategies from XML files, and will present a simple panel for selecting Expert Advisors from a single executable module, and managing their trading modes.
Using Layouts and Containers for GUI Controls: The CBox Class
Using Layouts and Containers for GUI Controls: The CBox Class

Using Layouts and Containers for GUI Controls: The CBox Class

This article presents an alternative method of GUI creation based on layouts and containers, using one layout manager — the CBox class. The CBox class is an auxiliary control that acts as a container for essential controls in a GUI panel. It can make designing graphical panels easier, and in some cases, reduce coding time.
Bi-Directional Trading and Hedging of Positions in MetaTrader 5 Using the HedgeTerminal API, Part 2
Bi-Directional Trading and Hedging of Positions in MetaTrader 5 Using the HedgeTerminal API, Part 2

Bi-Directional Trading and Hedging of Positions in MetaTrader 5 Using the HedgeTerminal API, Part 2

This article describes a new approach to hedging of positions and draws the line in the debates between users of MetaTrader 4 and MetaTrader 5 about this matter. It is a continuation of the first part: "Bi-Directional Trading and Hedging of Positions in MetaTrader 5 Using the HedgeTerminal Panel, Part 1". In the second part, we discuss integration of custom Expert Advisors with HedgeTerminalAPI, which is a special visualization library designed for bi-directional trading in a comfortable software environment providing tools for convenient position management.
Cross-Platform Expert Advisor: Reuse of Components from the MQL5 Standard Library
Cross-Platform Expert Advisor: Reuse of Components from the MQL5 Standard Library

Cross-Platform Expert Advisor: Reuse of Components from the MQL5 Standard Library

There exists some components in the MQL5 Standard Library that may prove to be useful in the MQL4 version of cross-platform expert advisors. This article deals with a method of making certain components of the MQL5 Standard Library compatible with the MQL4 compiler.
Getting Rid of Self-Made DLLs
Getting Rid of Self-Made DLLs

Getting Rid of Self-Made DLLs

If MQL5 language functional is not enough for fulfilling tasks, an MQL5 programmer has to use additional tools. He\she has to pass to another programming language and create an intermediate DLL. MQL5 has the possibility to present various data types and transfer them to API but, unfortunately, MQL5 cannot solve the issue concerning data extraction from the accepted pointer. In this article we will dot all the "i"s and show simple mechanisms of exchanging and working with complex data types.
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.
Cross-Platform Expert Advisor: Stops
Cross-Platform Expert Advisor: Stops

Cross-Platform Expert Advisor: Stops

This article discusses an implementation of stop levels in an expert advisor in order to make it compatible with the two platforms MetaTrader 4 and MetaTrader 5.