MQL5 Programming Articles

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!

latest | best

Testing patterns that arise when trading currency pair baskets. Part III

In this article, we finish testing the patterns that can be detected when trading currency pair baskets. Here we present the results of testing the patterns tracking the movement of pair's currencies

The Channel Breakout pattern

Price trends form price channels that can be observed on financial symbol charts. The breakout of the current channel is one of the strong trend reversal signals. In this article, I suggest a way to

How to reduce trader's risks

Trading in financial markets is associated with a whole range of risks that should be taken into account in the algorithms of trading systems. Reducing such risks is the most important task to make a

Automatic Selection of Promising Signals

The article is devoted to the analysis of trading signals for the MetaTrader 5 platform, which enable the automated execution of trading operations on subscribers' accounts. Also, the article

Risk Evaluation in the Sequence of Deals with One Asset. Continued

The article develops the ideas proposed in the previous part and considers them further. It describes the problems of yield distributions, plotting and studying statistical regularities

Night trading during the Asian session: How to stay profitable

The article deals with the concept of night trading, as well as trading strategies and their implementation in MQL5. We perform tests and make appropriate conclusions

Momentum Pinball trading strategy

In this article, we continue to consider writing the code to trading systems described in a book by Linda B. Raschke and Laurence A. Connors “Street Smarts: High Probability Short-Term Trading

Creating a custom news feed for MetaTrader 5

In this article we look at the possibility of creating a flexible news feed that offers more options in terms of the type of news and also its source. The article will show how a web API can be

The NRTR indicator and trading modules based on NRTR for the MQL5 Wizard

In this article we are going to analyze the NRTR indicator and create a trading system based on this indicator. We are going to develop a module of trading signals that can be used in creating

Testing patterns that arise when trading currency pair baskets. Part II

We continue testing the patterns and trying the methods described in the articles about trading currency pair baskets. Let's consider in practice, whether it is possible to use the patterns of the

Trading DiNapoli levels

The article considers one of the variants for Expert Advisor practical realization to trade DiNapoli levels using MQL5 standard tools. Its performance is tested and conclusions are made

Creating a new trading strategy using a technology of resolving entries into indicators

The article suggests a technology helping everyone to create custom trading strategies by assembling an individual indicator set, as well as to develop custom market entry signals

Resolving entries into indicators

Different situations happen in trader’s life. Often, the history of successful trades allows us to restore a strategy, while looking at a loss history we try to develop and improve it. In both cases

Using the Kalman Filter for price direction prediction

For successful trading, we almost always need indicators that can separate the main price movement from noise fluctuations. In this article, we consider one of the most promising digital filters, the

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

Comparing different types of moving averages in trading

This article deals with seven types of moving averages (MA) and a trading strategy to work with them. We also test and compare various MAs at a single trading strategy and evaluate the efficiency of

Triangular arbitrage

The article deals with the popular trading method - triangular arbitrage. Here we analyze the topic in as much detail as possible, consider the positive and negative aspects of the strategy and

Mini Market Emulator or Manual Strategy Tester

Mini Market Emulator is an indicator designed for partial emulation of work in the terminal. Presumably, it can be used to test "manual" strategies of market analysis and trading

Fuzzy Logic in trading strategies

The article considers an example of applying the fuzzy logic to build a simple trading system, using the Fuzzy library. Variants for improving the system by combining fuzzy logic, genetic algorithms

A New Approach to Interpreting Classic and Hidden Divergence

The article considers the classic method for divergence construction and provides an additional divergence interpretation method. A trading strategy was developed based on this new interpretation

Optimizing a strategy using balance graph and comparing results with "Balance + max Sharpe Ratio" criterion

In this article, we consider yet another custom trading strategy optimization criterion based on the balance graph analysis. The linear regression is calculated using the function from the ALGLIB

Practical evaluation of the adaptive market following method

The main difference of the trading system proposed in the article is the use of mathematical tools for analyzing stock quotes. The system applies digital filtering and spectral estimation of discrete

Implementing a Scalping Market Depth Using the CGraphic Library

In this article, we will create the basic functionality of a scalping Market Depth tool. Also, we will develop a tick chart based on the CGraphic library and integrate it with the order book. Using

Auto search for divergences and convergences

The article considers all kinds of divergence: simple, hidden, extended, triple, quadruple, convergence, as well as divergences of A, B and C classes. A universal indicator for their search and

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

Universal Expert Advisor: CUnIndicator and Use of Pending Orders (Part 9)

The article describes the work with indicators through the universal CUnIndicator class. In addition, new methods of working with pending orders are considered. Please note: from this point on, the

Graphical Interfaces XI: Integrating the Standard Graphics Library (build 16)

A new version of the graphics library for creating scientific charts (the CGraphic class) has been presented recently. This update of the developed library for creating graphical interfaces will

Risk Evaluation in the Sequence of Deals with One Asset

This article describes the use of methods of the theory of probability and mathematical statistics in the analysis of trading systems

TradeObjects: Automation of trading based on MetaTrader graphical objects

The article deals with a simple approach to creating an automated trading system based on the chart linear markup and offers a ready-made Expert Advisor using the standard properties of the MetaTrader

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

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

Deep Neural Networks (Part III). Sample selection and dimensionality reduction

This article is a continuation of the series of articles about deep neural networks. Here we will consider selecting samples (removing noise), reducing the dimensionality of input data and dividing

Using cloud storage services for data exchange between terminals

Cloud technologies are becoming more popular. Nowadays, we can choose between paid and free storage services. Is it possible to use them in trading? This article proposes a technology for exchanging

Graphical Interfaces XI: Text edit boxes and Combo boxes in table cells (build 15)

In this update of the library, the Table control (the CTable class) will be supplemented with new options. The lineup of controls in the table cells is expanded, this time adding text edit boxes and

Creating and testing custom symbols in MetaTrader 5

Creating custom symbols pushes the boundaries in the development of trading systems and financial market analysis. Now traders are able to plot charts and test trading strategies on an unlimited

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

The Flag Pattern

The article provides the analysis of the following patterns: Flag, Pennant, Wedge, Rectangle, Contracting Triangle, Expanding Triangle. In addition to analyzing their similarities and differences, we

Custom Walk Forward optimization in MetaTrader 5

The article deals with the approaches enabling accurate simulation of walk forward optimization using the built-in tester and auxiliary libraries implemented in MQL

Deep Neural Networks (Part I). Preparing Data

This series of articles continues exploring deep neural networks (DNN), which are used in many application areas including trading. Here new dimensions of this theme will be explored along with

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