Articles on data analysis and statistics in MQL5

icon

Articles on mathematical models and laws of probability are interesting for many traders. Mathematics is the basis of technical indicators, and statistics is required to analyze trading results and develop strategies.

Read about the fuzzy logic, digital filters, market profile, Kohonen maps, neural gas and many other tools that can be used for trading.

Add a new article
latest | best
Trading account monitoring is an indispensable trader's tool
Trading account monitoring is an indispensable trader's tool

Trading account monitoring is an indispensable trader's tool

Trading account monitoring provides a detailed report on all completed deals. All trading statistics are collected automatically and provided to you as easy-to-understand diagrams and graphs.
MQL5: Analysis and Processing of Commodity Futures Trading Commission (CFTC) Reports in MetaTrader 5
MQL5: Analysis and Processing of Commodity Futures Trading Commission (CFTC) Reports in MetaTrader 5

MQL5: Analysis and Processing of Commodity Futures Trading Commission (CFTC) Reports in MetaTrader 5

In this article, we will develop a tool for CFTC report analysis. We will solve the following problem: to develop an indicator, that allows using the CFTC report data directly from the data files provided by Commission without an intermediate processing and conversion. Further, it can be used for the different purposes: to plot the data as an indicator, to proceed with the data in the other indicators, in the scripts for the automated analysis, in the Expert Advisors for the use in the trading strategies.
Using Self-Organizing Feature Maps (Kohonen Maps) in MetaTrader 5
Using Self-Organizing Feature Maps (Kohonen Maps) in MetaTrader 5

Using Self-Organizing Feature Maps (Kohonen Maps) in MetaTrader 5

One of the most interesting aspects of Self-Organizing Feature Maps (Kohonen maps) is that they learn to classify data without supervision. In its basic form it produces a similarity map of input data (clustering). The SOM maps can be used for classification and visualizing of high-dimensional data. In this article we will consider several simple applications of Kohonen maps.
preview
Statistical Distributions in MQL5 - taking the best of R and making it faster

Statistical Distributions in MQL5 - taking the best of R and making it faster

The functions for working with the basic statistical distributions implemented in the R language are considered. Those include the Cauchy, Weibull, normal, log-normal, logistic, exponential, uniform, gamma distributions, the central and noncentral beta, chi-squared, Fisher's F-distribution, Student's t-distribution, as well as the discrete binomial and negative binomial distributions, geometric, hypergeometric and Poisson distributions. There are functions for calculating theoretical moments of distributions, which allow to evaluate the degree of conformity of the real distribution to the modeled one.
MetaTrader 5 and Python integration: receiving and sending data
MetaTrader 5 and Python integration: receiving and sending data

MetaTrader 5 and Python integration: receiving and sending data

Comprehensive data processing requires extensive tools and is often beyond the sandbox of one single application. Specialized programming languages are used for processing and analyzing data, statistics and machine learning. One of the leading programming languages for data processing is Python. The article provides a description of how to connect MetaTrader 5 and Python using sockets, as well as how to receive quotes via the terminal API.
Analyzing Candlestick Patterns
Analyzing Candlestick Patterns

Analyzing Candlestick Patterns

Construction of Japanese candlestick chart and analysis of candlestick patterns constitute an amazing area of technical analysis. The advantage of candlesticks is that they represent data in such a manner that you can track the dynamics inside the data. In this article we analyze candlestick types, classification of candlestick patterns and present an indicator that can determine candlestick patterns.
Forecasting market movements using the Bayesian classification and indicators based on Singular Spectrum Analysis
Forecasting market movements using the Bayesian classification and indicators based on Singular Spectrum Analysis

Forecasting market movements using the Bayesian classification and indicators based on Singular Spectrum Analysis

The article considers the ideology and methodology of building a recommendatory system for time-efficient trading by combining the capabilities of forecasting with the singular spectrum analysis (SSA) and important machine learning method on the basis of Bayes' Theorem.
Third Generation Neural Networks: Deep Networks
Third Generation Neural Networks: Deep Networks

Third Generation Neural Networks: Deep Networks

This article is dedicated to a new and perspective direction in machine learning - deep learning or, to be precise, deep neural networks. This is a brief review of second generation neural networks, the architecture of their connections and main types, methods and rules of learning and their main disadvantages followed by the history of the third generation neural network development, their main types, peculiarities and training methods. Conducted are practical experiments on building and training a deep neural network initiated by the weights of a stacked autoencoder with real data. All the stages from selecting input data to metric derivation are discussed in detail. The last part of the article contains a software implementation of a deep neural network in an Expert Advisor with a built-in indicator based on MQL4/R.
The Price Histogram (Market Profile) and its implementation in MQL5
The Price Histogram (Market Profile) and its implementation in MQL5

The Price Histogram (Market Profile) and its implementation in MQL5

The Market Profile was developed by trully brilliant thinker Peter Steidlmayer. He suggested to use the alternative representation of information about "horizontal" and "vertical" market movements that leads to completely different set of models. He assumed that there is an underlying pulse of the market or a fundamental pattern called the cycle of equilibrium and disequilibrium. In this article I will consider Price Histogram — a simplified model of Market Profile, and will describe its implementation in MQL5.
How to reduce trader's risks
How to reduce trader's risks

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 profit when trading.
Introduction to the Empirical Mode Decomposition Method
Introduction to the Empirical Mode Decomposition Method

Introduction to the Empirical Mode Decomposition Method

This article serves to familiarize the reader with the empirical mode decomposition (EMD) method. It is the fundamental part of the Hilbert–Huang transform and is intended for analyzing data from nonstationary and nonlinear processes. This article also features a possible software implementation of this method along with a brief consideration of its peculiarities and gives some simple examples of its use.
preview
How to make $1,000,000 off algorithmic trading? Use MQL5.com services!

How to make $1,000,000 off algorithmic trading? Use MQL5.com services!

All traders visit the market with the goal of earning their first million dollars. How to do that without excessive risk and start-up budget? MQL5 services provide such opportunity for developers and traders from around the world.
A New Approach to Interpreting Classic and Hidden Divergence
A New Approach to Interpreting Classic and Hidden Divergence

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 method. This strategy is also described in the article.
preview
Neural Networks Made Easy

Neural Networks Made Easy

Artificial intelligence is often associated with something fantastically complex and incomprehensible. At the same time, artificial intelligence is increasingly mentioned in everyday life. News about achievements related to the use of neural networks often appear in different media. The purpose of this article is to show that anyone can easily create a neural network and use the AI achievements in trading.
An Introduction to Fuzzy Logic
An Introduction to Fuzzy Logic

An Introduction to Fuzzy Logic

Fuzzy logic expands our boundaries of mathematical logic and set theory. This article reveals the basic principles of fuzzy logic as well as describes two fuzzy inference systems using Mamdani-type and Sugeno-type models. The examples provided will describe implementation of fuzzy models based on these two systems using the FuzzyNet library for MQL5.
Self-optimization of EA: Evolutionary and genetic algorithms
Self-optimization of EA: Evolutionary and genetic algorithms

Self-optimization of EA: Evolutionary and genetic algorithms

This article covers the main principles set fourth in evolutionary algorithms, their variety and features. We will conduct an experiment with a simple Expert Advisor used as an example to show how our trading system benefits from optimization. We will consider software programs that implement genetic, evolutionary and other types of optimization, and provide examples of application when optimizing a predictor set and parameters of the trading system.
Comparing different types of moving averages in trading
Comparing different types of moving averages in trading

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 each moving average compared to others.
Night trading during the Asian session: How to stay profitable
Night trading during the Asian session: How to stay profitable

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.
100 best optimization passes (part 1). Developing optimization analyzer
100 best optimization passes (part 1). Developing optimization analyzer

100 best optimization passes (part 1). Developing optimization analyzer

The article dwells on the development of an application for selecting the best optimization passes using several possible options. The application is able to sort out the optimization results by a variety of factors. Optimization passes are always written to a database, therefore you can always select new robot parameters without re-optimization. Besides, you are able to see all optimization passes on a single chart, calculate parametric VaR ratios and build the graph of the normal distribution of passes and trading results of a certain ratio set. Besides, the graphs of some calculated ratios are built dynamically beginning with the optimization start (or from a selected date to another selected date).
The Easy Way to Evaluate a Signal: Trading Activity, Drawdown/Load and MFE/MAE Distribution Charts
The Easy Way to Evaluate a Signal: Trading Activity, Drawdown/Load and MFE/MAE Distribution Charts

The Easy Way to Evaluate a Signal: Trading Activity, Drawdown/Load and MFE/MAE Distribution Charts

Subscribers often search for an appropriate signal by analyzing the total growth on the signal provider's account, which is not a bad idea. However, it is also important to analyze potential risks of a particular trading strategy. In this article we will show a simple and efficient way to evaluate a Trading Signal based on its performance values.
preview
SQLite: Native handling of SQL databases in MQL5

SQLite: Native handling of SQL databases in MQL5

The development of trading strategies is associated with handling large amounts of data. Now, you are able to work with databases using SQL queries based on SQLite directly in MQL5. An important feature of this engine is that the entire database is placed in a single file located on a user's PC.
Limitless Opportunities with MetaTrader 5 and MQL5
Limitless Opportunities with MetaTrader 5 and MQL5

Limitless Opportunities with MetaTrader 5 and MQL5

In this article, I would like to give an example of what a trader's program can be like as well as what results can be achieved in 9 months, having started to learn MQL5 from scratch. This example will also show how multi-functional and informative such a program can be for a trader while taking minimum space on the price chart. And we will be able to see just how colorful, bright and intuitively clear to the user trade information panels can get. As well as many other features...
Money Management by Vince. Implementation as a module for MQL5 Wizard
Money Management by Vince. Implementation as a module for MQL5 Wizard

Money Management by Vince. Implementation as a module for MQL5 Wizard

The article is based on 'The Mathematics of Money Management' by Ralph Vince. It provides the description of empirical and parametric methods used for finding the optimal size of a trading lot. Also the article features implementation of trading modules for the MQL5 Wizard based on these methods.
Creating a Multi-Currency Multi-System Expert Advisor
Creating a Multi-Currency Multi-System Expert Advisor

Creating a Multi-Currency Multi-System Expert Advisor

The article introduces a structure for an Expert Advisor that trades multiple symbols and uses several trading systems simultaneously. If you already identified the optimal input parameters for all your EAs and got good backtesting results for each of them separately, ask yourself what results you would get if testing all EAs simultaneously, with all your strategies put together.
Library for easy and quick development of MetaTrader programs (part XXII): Trading classes - Base trading class, verification of limitations
Library for easy and quick development of MetaTrader programs (part XXII): Trading classes - Base trading class, verification of limitations

Library for easy and quick development of MetaTrader programs (part XXII): Trading classes - Base trading class, verification of limitations

In this article, we will start the development of the library base trading class and add the initial verification of permissions to conduct trading operations to its first version. Besides, we will slightly expand the features and content of the base trading class.
Library for easy and quick development of MetaTrader programs (part XXX): Pending trading requests - managing request objects
Library for easy and quick development of MetaTrader programs (part XXX): Pending trading requests - managing request objects

Library for easy and quick development of MetaTrader programs (part XXX): Pending trading requests - managing request objects

In the previous article, we have created the classes of pending request objects corresponding to the general concept of library objects. This time, we are going to deal with the class allowing the management of pending request objects.
Timeseries in DoEasy library (part 43): Classes of indicator buffer objects
Timeseries in DoEasy library (part 43): Classes of indicator buffer objects

Timeseries in DoEasy library (part 43): Classes of indicator buffer objects

The article considers the development of indicator buffer object classes as descendants of the abstract buffer object simplifying declaration and working with indicator buffers, while creating custom indicator programs based on DoEasy library.
Applying The Fisher Transform and Inverse Fisher Transform to Markets Analysis in MetaTrader 5
Applying The Fisher Transform and Inverse Fisher Transform to Markets Analysis in MetaTrader 5

Applying The Fisher Transform and Inverse Fisher Transform to Markets Analysis in MetaTrader 5

We now know that probability density function (PDF) of a market cycle does not remind a Gaussian but rather a PDF of a sine wave and most of the indicators assume that the market cycle PDF is Gaussian we need a way to "correct" that. The solution is to use Fisher Transform. The Fisher transform changes PDF of any waveform to approximately Gaussian. This article describes the mathematics behind the Fisher Transform and the Inverse Fisher Transform and their application to trading. A proprietary trading signal module based on the Inverse Fisher Transform is presented and evaluated.
preview
How to create 3D graphics using DirectX in MetaTrader 5

How to create 3D graphics using DirectX in MetaTrader 5

3D graphics provide excellent means for analyzing huge amounts of data as they enable the visualization of hidden patterns. These tasks can be solved directly in MQL5, while DireсtX functions allow creating three-dimensional object. Thus, it is even possible to create programs of any complexity, even 3D games for MetaTrader 5. Start learning 3D graphics by drawing simple three-dimensional shapes.
Time Series Forecasting Using Exponential Smoothing
Time Series Forecasting Using Exponential Smoothing

Time Series Forecasting Using Exponential Smoothing

The article familiarizes the reader with exponential smoothing models used for short-term forecasting of time series. In addition, it touches upon the issues related to optimization and estimation of the forecast results and provides a few examples of scripts and indicators. This article will be useful as a first acquaintance with principles of forecasting on the basis of exponential smoothing models.
Evaluation of Trade Systems - the Effectiveness of Entering, Exiting and Trades in General
Evaluation of Trade Systems - the Effectiveness of Entering, Exiting and Trades in General

Evaluation of Trade Systems - the Effectiveness of Entering, Exiting and Trades in General

There are a lot of measures that allow determining the effectiveness and profitability of a trade system. However, traders are always ready to put any system to a new crash test. The article tells how the statistics based on measures of effectiveness can be used for the MetaTrader 5 platform. It includes the class for transformation of the interpretation of statistics by deals to the one that doesn't contradict the description given in the "Statistika dlya traderov" ("Statistics for Traders") book by S.V. Bulashev. It also includes an example of custom function for optimization.
Forecasting Time Series (Part 1): Empirical Mode Decomposition (EMD) Method
Forecasting Time Series (Part 1): Empirical Mode Decomposition (EMD) Method

Forecasting Time Series (Part 1): Empirical Mode Decomposition (EMD) Method

This article deals with the theory and practical use of the algorithm for forecasting time series, based on the empirical decomposition mode. It proposes the MQL implementation of this method and presents test indicators and Expert Advisors.
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.
Library for easy and quick development of MetaTrader programs (part XXVIII): Closure, removal and modification of pending trading requests
Library for easy and quick development of MetaTrader programs (part XXVIII): Closure, removal and modification of pending trading requests

Library for easy and quick development of MetaTrader programs (part XXVIII): Closure, removal and modification of pending trading requests

This is the third article about the concept of pending requests. We are going to complete the tests of pending trading requests by creating the methods for closing positions, removing pending orders and modifying position and pending order parameters.
Creating Custom Criteria of Optimization of Expert Advisors
Creating Custom Criteria of Optimization of Expert Advisors

Creating Custom Criteria of Optimization of Expert Advisors

The MetaTrader 5 Client Terminal offers a wide range of opportunities for optimization of Expert Advisor parameters. In addition to the optimization criteria included in the strategy tester, developers are given the opportunity of creating their own criteria. This leads to an almost limitless number of possibilities of testing and optimizing of Expert Advisors. The article describes practical ways of creating such criteria - both complex and simple ones.
Calculating the Hurst exponent
Calculating the Hurst exponent

Calculating the Hurst exponent

The article thoroughly explains the idea behind the Hurst exponent, as well as the meaning of its values and the calculation algorithm. A number of financial market segments are analyzed and the method of working with MetaTrader 5 products implementing the fractal analysis is described.
Library for easy and quick development of MetaTrader programs (part XXXIV): Pending trading requests - removing and modifying orders and positions under certain conditions
Library for easy and quick development of MetaTrader programs (part XXXIV): Pending trading requests - removing and modifying orders and positions under certain conditions

Library for easy and quick development of MetaTrader programs (part XXXIV): Pending trading requests - removing and modifying orders and positions under certain conditions

In this article, we will complete the description of the pending request trading concept and create the functionality for removing pending orders, as well as modifying orders and positions under certain conditions. Thus, we are going to have the entire functionality enabling us to develop simple custom strategies, or rather EA behavior logic activated upon user-defined conditions.
Developing a self-adapting algorithm (Part II): Improving efficiency
Developing a self-adapting algorithm (Part II): Improving efficiency

Developing a self-adapting algorithm (Part II): Improving efficiency

In this article, I will continue the development of the topic by improving the flexibility of the previously created algorithm. The algorithm became more stable with an increase in the number of candles in the analysis window or with an increase in the threshold percentage of the overweight of falling or growing candles. I had to make a compromise and set a larger sample size for analysis or a larger percentage of the prevailing candle excess.
Basic math behind Forex trading
Basic math behind Forex trading

Basic math behind Forex trading

The article aims to describe the main features of Forex trading as simply and quickly as possible, as well as share some basic ideas with beginners. It also attempts to answer the most tantalizing questions in the trading community along with showcasing the development of a simple indicator.
DiNapoli trading system
DiNapoli trading system

DiNapoli trading system

The article describes the Fibo levels-based trading system developed by Joe DiNapoli. The idea behind the system and the main concepts are explained, as well as a simple indicator is provided as an example for more clarity.