Articles on manual and algorithmic trading in MetaTrader 5

icon

This category features articles on all aspects of trading - from manual to fully automatic trading, from Expert Advisor ideas to trading robot creation using the MQL5 Wizard. Position management, processing of trade events and money management - these integral parts of trading are covered in theses articles.

Learn how to copy trading signals and how to provide around-the-clock operation of Expert Advisors, how to create a trading robot and how to run MetaTrader on Linux and MacOS, what social trading is and how to order a trading robot.

Add a new article
latest | best
Better Programmer (Part 07): Notes on becoming a successful freelance developer
Better Programmer (Part 07): Notes on becoming a successful freelance developer

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.
preview
Dealing with Time (Part 2): The Functions

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 hour), we simply look ourselves how they time their prices in the weeks of the time changes — but not cumbersome by hand, we let a program do it — why do we have a PC after all.
Combinatorics and probability theory for trading (Part III): The first mathematical model
Combinatorics and probability theory for trading (Part III): The first mathematical model

Combinatorics and probability theory for trading (Part III): The first mathematical model

A logical continuation of the earlier discussed topic would be the development of multifunctional mathematical models for trading tasks. In this article, I will describe the entire process related to the development of the first mathematical model describing fractals, from scratch. This model should become an important building block and be multifunctional and universal. It will build up our theoretical basis for further development of this idea.
preview
Dealing with Time (Part 1): The Basics

Dealing with Time (Part 1): The Basics

Functions and code snippets that simplify and clarify the handling of time, broker offset, and the changes to summer or winter time. Accurate timing may be a crucial element in trading. At the current hour, is the stock exchange in London or New York already open or not yet open, when does the trading time for Forex trading start and end? For a trader who trades manually and live, this is not a big problem.
Combinatorics and probability theory for trading (Part II): Universal fractal
Combinatorics and probability theory for trading (Part II): Universal fractal

Combinatorics and probability theory for trading (Part II): Universal fractal

In this article, we will continue to study fractals and will pay special attention to summarizing all the material. To do this, I will try to bring all earlier developments into a compact form which would be convenient and understandable for practical application in trading.
preview
Bid/Ask spread analysis in MetaTrader 5

Bid/Ask spread analysis in MetaTrader 5

An indicator to report your brokers Bid/Ask spread levels. Now we can use MT5s tick data to analyze what the historic true average Bid/Ask spread actually have recently been. You shouldn't need to look at the current spread because that is available if you show both bid and ask price lines.
preview
Combinatorics and probability theory for trading (Part I): The basics

Combinatorics and probability theory for trading (Part I): The basics

In this series of article, we will try to find a practical application of probability theory to describe trading and pricing processes. In the first article, we will look into the basics of combinatorics and probability, and will analyze the first example of how to apply fractals in the framework of the probability theory.
Swaps (Part I): Locking and Synthetic Positions
Swaps (Part I): Locking and Synthetic Positions

Swaps (Part I): Locking and Synthetic Positions

In this article I will try to expand the classic concept of swap trading methods. I will explain why I have come to the conclusion that this concept deserves special attention and is absolutely recommended for study.
Combination scalping: analyzing trades from the past to increase the performance of future trades
Combination scalping: analyzing trades from the past to increase the performance of future trades

Combination scalping: analyzing trades from the past to increase the performance of future trades

The article provides the description of the technology aimed at increasing the effectiveness of any automated trading system. It provides a brief explanation of the idea, as well as its underlying basics, possibilities and disadvantages.
preview
Machine learning in Grid and Martingale trading systems. Would you bet on it?

Machine learning in Grid and Martingale trading systems. Would you bet on it?

This article describes the machine learning technique applied to grid and martingale trading. Surprisingly, this approach has little to no coverage in the global network. After reading the article, you will be able to create your own trading bots.
Self-adapting algorithm (Part IV): Additional functionality and tests
Self-adapting algorithm (Part IV): Additional functionality and tests

Self-adapting algorithm (Part IV): Additional functionality and tests

I continue filling the algorithm with the minimum necessary functionality and testing the results. The profitability is quite low but the articles demonstrate the model of the fully automated profitable trading on completely different instruments traded on fundamentally different markets.
Self-adapting algorithm (Part III): Abandoning optimization
Self-adapting algorithm (Part III): Abandoning optimization

Self-adapting algorithm (Part III): Abandoning optimization

It is impossible to get a truly stable algorithm if we use optimization based on historical data to select parameters. A stable algorithm should be aware of what parameters are needed when working on any trading instrument at any time. It should not forecast or guess, it should know for sure.
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.
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.
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.
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.
Using spreadsheets to build trading strategies
Using spreadsheets to build trading strategies

Using spreadsheets to build trading strategies

The article describes the basic principles and methods that allow you to analyze any strategy using spreadsheets (Excel, Calc, Google). The obtained results are compared with MetaTrader 5 tester.
Analyzing charts using DeMark Sequential and Murray-Gann levels
Analyzing charts using DeMark Sequential and Murray-Gann levels

Analyzing charts using DeMark Sequential and Murray-Gann levels

Thomas DeMark Sequential is good at showing balance changes in the price movement. This is especially evident if we combine its signals with a level indicator, for example, Murray levels. The article is intended mostly for beginners and those who still cannot find their "Grail". I will also display some features of building levels that I have not seen on other forums. So, the article will probably be useful for advanced traders as well... Suggestions and reasonable criticism are welcome...
preview
Gradient boosting in transductive and active machine learning

Gradient boosting in transductive and active machine learning

In this article, we will consider active machine learning methods utilizing real data, as well discuss their pros and cons. Perhaps you will find these methods useful and will include them in your arsenal of machine learning models. Transduction was introduced by Vladimir Vapnik, who is the co-inventor of the Support-Vector Machine (SVM).
preview
Practical application of neural networks in trading. Python (Part I)

Practical application of neural networks in trading. Python (Part I)

In this article, we will analyze the step-by-step implementation of a trading system based on the programming of deep neural networks in Python. This will be performed using the TensorFlow machine learning library developed by Google. We will also use the Keras library for describing neural networks.
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.
A scientific approach to the development of trading algorithms
A scientific approach to the development of trading algorithms

A scientific approach to the development of trading algorithms

The article considers the methodology for developing trading algorithms, in which a consistent scientific approach is used to analyze possible price patterns and to build trading algorithms based on these patterns. Development ideals are demonstrated using examples.
preview
Custom symbols: Practical basics

Custom symbols: Practical basics

The article is devoted to the programmatic generation of custom symbols which are used to demonstrate some popular methods for displaying quotes. It describes a suggested variant of minimally invasive adaptation of Expert Advisors for trading a real symbol from a derived custom symbol chart. MQL source codes are attached to this article.
What is a trend and is the market structure based on trend or flat?
What is a trend and is the market structure based on trend or flat?

What is a trend and is the market structure based on trend or flat?

Traders often talk about trends and flats but very few of them really understand what a trend/flat really is and even fewer are able to clearly explain these concepts. Discussing these basic terms is often beset by a solid set of prejudices and misconceptions. However, if we want to make profit, we need to understand the mathematical and logical meaning of these concepts. In this article, I will take a closer look at the essence of trend and flat, as well as try to define whether the market structure is based on trend, flat or something else. I will also consider the most optimal strategies for making profit on trend and flat markets.
preview
Gradient Boosting (CatBoost) in the development of trading systems. A naive approach

Gradient Boosting (CatBoost) in the development of trading systems. A naive approach

Training the CatBoost classifier in Python and exporting the model to mql5, as well as parsing the model parameters and a custom strategy tester. The Python language and the MetaTrader 5 library are used for preparing the data and for training the model.
Using cryptography with external applications
Using cryptography with external applications

Using cryptography with external applications

In this article, we consider encryption/decryption of objects in MetaTrader and in external applications. Our purpose is to determine the conditions under which the same results will be obtained with the same initial data.
Quick Manual Trading Toolkit: Working with open positions and pending orders
Quick Manual Trading Toolkit: Working with open positions and pending orders

Quick Manual Trading Toolkit: Working with open positions and pending orders

In this article, we will expand the capabilities of the toolkit: we will add the ability to close trade positions upon specific conditions and will create tables for controlling market and pending orders, with the ability to edit these orders.
Quick Manual Trading Toolkit: Basic Functionality
Quick Manual Trading Toolkit: Basic Functionality

Quick Manual Trading Toolkit: Basic Functionality

Today, many traders switch to automated trading systems which can require additional setup or can be fully automated and ready to use. However, there is a considerable part of traders who prefer trading manually, in the old fashioned way. In this article, we will create toolkit for quick manual trading, using hotkeys, and for performing typical trading actions in one click.
Manual charting and trading toolkit (Part I). Preparation: structure description and helper class
Manual charting and trading toolkit (Part I). Preparation: structure description and helper class

Manual charting and trading toolkit (Part I). Preparation: structure description and helper class

This is the first article in a series, in which I am going to describe a toolkit which enables manual application of chart graphics by utilizing keyboard shortcuts. It is very convenient: you press one key and a trendline appears, you press another key — this will create a Fibonacci fan with the necessary parameters. It will also be possible to switch timeframes, to rearrange layers or to delete all objects from the chart.
Multicurrency monitoring of trading signals (Part 5): Composite signals
Multicurrency monitoring of trading signals (Part 5): Composite signals

Multicurrency monitoring of trading signals (Part 5): Composite signals

In the fifth article related to the creation of a trading signal monitor, we will consider composite signals and will implement the necessary functionality. In earlier versions, we used simple signals, such as RSI, WPR and CCI, and we also introduced the possibility to use custom indicators.
Multicurrency monitoring of trading signals (Part 4): Enhancing functionality and improving the signal search system
Multicurrency monitoring of trading signals (Part 4): Enhancing functionality and improving the signal search system

Multicurrency monitoring of trading signals (Part 4): Enhancing functionality and improving the signal search system

In this part, we expand the trading signal searching and editing system, as well as introduce the possibility to use custom indicators and add program localization. We have previously created a basic system for searching signals, but it was based on a small set of indicators and a simple set of search rules.
Multicurrency monitoring of trading signals (Part 3): Introducing search algorithms
Multicurrency monitoring of trading signals (Part 3): Introducing search algorithms

Multicurrency monitoring of trading signals (Part 3): Introducing search algorithms

In the previous article, we developed the visual part of the application, as well as the basic interaction of GUI elements. This time we are going to add internal logic and the algorithm of trading signal data preparation, as well us the ability to set up signals, to search them and to visualize them in the monitor.
Applying OLAP in trading (part 4): Quantitative and visual analysis of tester reports
Applying OLAP in trading (part 4): Quantitative and visual analysis of tester reports

Applying OLAP in trading (part 4): Quantitative and visual analysis of tester reports

The article offers basic tools for the OLAP analysis of tester reports relating to single passes and optimization results. The tool can work with standard format files (tst and opt), and it also provides a graphical interface. MQL source codes are attached below.
Projects assist in creating profitable trading robots! Or at least, so it seems
Projects assist in creating profitable trading robots! Or at least, so it seems

Projects assist in creating profitable trading robots! Or at least, so it seems

A big program starts with a small file, which then grows in size as you keep adding more functions and objects. Most robot developers utilize include files to handle this problem. However, there is a better solution: start developing any trading application in a project. There are so many reasons to do so.
Multicurrency monitoring of trading signals (Part 2): Implementation of the visual part of the application
Multicurrency monitoring of trading signals (Part 2): Implementation of the visual part of the application

Multicurrency monitoring of trading signals (Part 2): Implementation of the visual part of the application

In the previous article, we created the application framework, which we will use as the basis for all further work. In this part, we will proceed with the development: we will create the visual part of the application and will configure basic interaction of interface elements.
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.
Exploring Seasonal Patterns of Financial Time Series with Boxplot
Exploring Seasonal Patterns of Financial Time Series with Boxplot

Exploring Seasonal Patterns of Financial Time Series with Boxplot

In this article we will view seasonal characteristics of financial time series using Boxplot diagrams. Each separate boxplot (or box-and-whiskey diagram) provides a good visualization of how values are distributed along the dataset. Boxplots should not be confused with the candlestick charts, although they can be visually similar.
Extending Strategy Builder Functionality
Extending Strategy Builder Functionality

Extending Strategy Builder Functionality

In the previous two articles, we discussed the application of Merrill patterns to various data types. An application was developed to test the presented ideas. In this article, we will continue working with the Strategy Builder, to improve its efficiency and to implement new features and capabilities.
Strategy builder based on Merrill patterns
Strategy builder based on Merrill patterns

Strategy builder based on Merrill patterns

In the previous article, we considered application of Merrill patterns to various data, such as to a price value on a currency symbol chart and values of standard MetaTrader 5 indicators: ATR, WPR, CCI, RSI, among others. Now, let us try to create a strategy construction set based on Merrill patterns.
Developing Pivot Mean Oscillator: a novel Indicator for the Cumulative Moving Average
Developing Pivot Mean Oscillator: a novel Indicator for the Cumulative Moving Average

Developing Pivot Mean Oscillator: a novel Indicator for the Cumulative Moving Average

This article presents Pivot Mean Oscillator (PMO), an implementation of the cumulative moving average (CMA) as a trading indicator for the MetaTrader platforms. In particular, we first introduce Pivot Mean (PM) as a normalization index for timeseries that computes the fraction between any data point and the CMA. We then build PMO as the difference between the moving averages applied to two PM signals. Some preliminary experiments carried out on the EURUSD symbol to test the efficacy of the proposed indicator are also reported, leaving ample space for further considerations and improvements.