Articles on trading system automation in MQL5

icon

Read articles on the trading systems with a wide variety of ideas at the core. Learn how to use statistical methods and patterns on candlestick charts, how to filter signals and where to use semaphore indicators.

The MQL5 Wizard will help you create robots without programming to quickly check your trading ideas. Use the Wizard to learn about genetic algorithms.

Add a new article
latest | best
Library for easy and quick development of MetaTrader programs (part XXVII): Working with trading requests - placing pending orders
Library for easy and quick development of MetaTrader programs (part XXVII): Working with trading requests - placing pending orders

Library for easy and quick development of MetaTrader programs (part XXVII): Working with trading requests - placing pending orders

In this article, we will continue the development of trading requests, implement placing pending orders and eliminate detected shortcomings of the trading class operation.
Library for easy and quick development of MetaTrader programs (part XXVI): Working with pending trading requests - first implementation (opening positions)
Library for easy and quick development of MetaTrader programs (part XXVI): Working with pending trading requests - first implementation (opening positions)

Library for easy and quick development of MetaTrader programs (part XXVI): Working with pending trading requests - first implementation (opening positions)

In this article, we are going to store some data in the value of the orders and positions magic number and start the implementation of pending requests. To check the concept, let's create the first test pending request for opening market positions when receiving a server error requiring waiting and sending a repeated request.
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.
Library for easy and quick development of MetaTrader programs (part XXV): Handling errors returned by the trade server
Library for easy and quick development of MetaTrader programs (part XXV): Handling errors returned by the trade server

Library for easy and quick development of MetaTrader programs (part XXV): Handling errors returned by the trade server

After we send a trading order to the server, we need to check the error codes or the absence of errors. In this article, we will consider handling errors returned by the trade server and prepare for creating pending trading requests.
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.
Library for easy and quick development of MetaTrader programs (part XXIV): Base trading class - auto correction of invalid parameters
Library for easy and quick development of MetaTrader programs (part XXIV): Base trading class - auto correction of invalid parameters

Library for easy and quick development of MetaTrader programs (part XXIV): Base trading class - auto correction of invalid parameters

In this article, we will have a look at the handler of invalid trading order parameters and improve the trading event class. Now all trading events (both single ones and the ones occurred simultaneously within one tick) will be defined in programs correctly.
Library for easy and quick development of MetaTrader programs (part XXIII): Base trading class - verification of valid parameters
Library for easy and quick development of MetaTrader programs (part XXIII): Base trading class - verification of valid parameters

Library for easy and quick development of MetaTrader programs (part XXIII): Base trading class - verification of valid parameters

In the article, we continue the development of the trading class by implementing the control over incorrect trading order parameter values and voicing trading events.
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 XXI): Trading classes - Base cross-platform trading object
Library for easy and quick development of MetaTrader programs (part XXI): Trading classes - Base cross-platform trading object

Library for easy and quick development of MetaTrader programs (part XXI): Trading classes - Base cross-platform trading object

In this article, we will start the development of the new library section - trading classes. Besides, we will consider the development of a unified base trading object for MetaTrader 5 and MetaTrader 4 platforms. When sending a request to the server, such a trading object implies that verified and correct trading request parameters are passed to it.
Library for easy and quick development of MetaTrader programs (part XX): Creating and storing program resources
Library for easy and quick development of MetaTrader programs (part XX): Creating and storing program resources

Library for easy and quick development of MetaTrader programs (part XX): Creating and storing program resources

The article deals with storing data in the program's source code and creating audio and graphical files out of them. When developing an application, we often need audio and images. The MQL language features several methods of using such data.
Library for easy and quick development of MetaTrader programs (part XIX): Class of library messages
Library for easy and quick development of MetaTrader programs (part XIX): Class of library messages

Library for easy and quick development of MetaTrader programs (part XIX): Class of library messages

In this article, we will consider the class of displaying text messages. Currently, we have a sufficient number of different text messages. It is time to re-arrange the methods of their storage, display and translation of Russian or English messages to other languages. Besides, it would be good to introduce convenient ways of adding new languages to the library and quickly switching between them.
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.
Library for easy and quick development of MetaTrader programs (part XVII): Interactivity of library objects
Library for easy and quick development of MetaTrader programs (part XVII): Interactivity of library objects

Library for easy and quick development of MetaTrader programs (part XVII): Interactivity of library objects

In this article, we are going to finish the development of the base object of all library objects, so that any library object based on it is able to interact with a user. For example, users will be able to set the maximum acceptable size of a spread for opening a position and a price level, upon reaching which an event from a symbol object is sent to the program with the spread or price level-based signal.
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.
Library for easy and quick development of MetaTrader programs (part XVI): Symbol collection events
Library for easy and quick development of MetaTrader programs (part XVI): Symbol collection events

Library for easy and quick development of MetaTrader programs (part XVI): Symbol collection events

In this article, we will create a new base class of all library objects adding the event functionality to all its descendants and develop the class for tracking symbol collection events based on the new base class. We will also change account and account event classes for developing the new base object functionality.
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%.
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.
Parsing HTML with curl
Parsing HTML with curl

Parsing HTML with curl

The article provides the description of a simple HTML code parsing library using third-party components. In particular, it covers the possibilities of accessing data which cannot be retrieved using GET and POST requests. We will select a website with not too large pages and will try to obtain interesting data from this site.
Library for easy and quick development of MetaTrader programs (part XV): Collection of symbol objects
Library for easy and quick development of MetaTrader programs (part XV): Collection of symbol objects

Library for easy and quick development of MetaTrader programs (part XV): Collection of symbol objects

In this article, we will consider creation of a symbol collection based on the abstract symbol object developed in the previous article. The abstract symbol descendants are to clarify a symbol data and define the availability of the basic symbol object properties in a program. Such symbol objects are to be distinguished by their affiliation with groups.
A New Approach to Interpreting Classic and Hidden Divergence. Part II
A New Approach to Interpreting Classic and Hidden Divergence. Part II

A New Approach to Interpreting Classic and Hidden Divergence. Part II

The article provides a critical examination of regular divergence and efficiency of various indicators. In addition, it contains filtering options for an increased analysis accuracy and features description of non-standard solutions. As a result, we will create a new tool for solving the technical task.
Merrill patterns
Merrill patterns

Merrill patterns

In this article, we will have a look at Merrill patterns' model and try to evaluate their current relevance. To do this, we will develop a tool to test the patterns and apply the model to various data types such as Close, High and Low prices, as well as oscillators.
Library for easy and quick development of MetaTrader programs (part XIV): Symbol object
Library for easy and quick development of MetaTrader programs (part XIV): Symbol object

Library for easy and quick development of MetaTrader programs (part XIV): Symbol object

In this article, we will create the class of a symbol object that is to be the basic object for creating the symbol collection. The class will allow us to obtain data on the necessary symbols for their further analysis and comparison.
Library for easy and quick development of MetaTrader programs (part XIII): Account object events
Library for easy and quick development of MetaTrader programs (part XIII): Account object events

Library for easy and quick development of MetaTrader programs (part XIII): Account object events

The article considers working with account events for tracking important changes in account properties affecting the automated trading. We have already implemented some functionality for tracking account events in the previous article when developing the account object collection.
Library for easy and quick development of MetaTrader programs (part XII): Account object class and collection of account objects
Library for easy and quick development of MetaTrader programs (part XII): Account object class and collection of account objects

Library for easy and quick development of MetaTrader programs (part XII): Account object class and collection of account objects

In the previous article, we defined position closure events for MQL4 in the library and got rid of the unused order properties. Here we will consider the creation of the Account object, develop the collection of account objects and prepare the functionality for tracking account events.
Library for easy and quick development of MetaTrader programs (part XI). Compatibility with MQL4 - Position closure events
Library for easy and quick development of MetaTrader programs (part XI). Compatibility with MQL4 - Position closure events

Library for easy and quick development of MetaTrader programs (part XI). Compatibility with MQL4 - Position closure events

We continue the development of a large cross-platform library simplifying the development of programs for MetaTrader 5 and MetaTrader 4 platforms. In the tenth part, we resumed our work on the library compatibility with MQL4 and defined the events of opening positions and activating pending orders. In this article, we will define the events of closing positions and get rid of the unused order properties.
Developing a cross-platform grider EA (part III): Correction-based grid with martingale
Developing a cross-platform grider EA (part III): Correction-based grid with martingale

Developing a cross-platform grider EA (part III): Correction-based grid with martingale

In this article, we will make an attempt to develop the best possible grid-based EA. As usual, this will be a cross-platform EA capable of working both with MetaTrader 4 and MetaTrader 5. The first EA was good enough, except that it could not make a profit over a long period of time. The second EA could work at intervals of more than several years. Unfortunately, it was unable to yield more than 50% of profit per year with a maximum drawdown of less than 50%.
Library for easy and quick development of MetaTrader programs (part X): Compatibility with MQL4 - Events of opening a position and activating pending orders
Library for easy and quick development of MetaTrader programs (part X): Compatibility with MQL4 - Events of opening a position and activating pending orders

Library for easy and quick development of MetaTrader programs (part X): Compatibility with MQL4 - Events of opening a position and activating pending orders

In the previous articles, we started creating a large cross-platform library simplifying the development of programs for MetaTrader 5 and MetaTrader 4 platforms. In the ninth part, we started improving the library classes for working with MQL4. Here we will continue improving the library to ensure its full compatibility with MQL4.
Library for easy and quick development of MetaTrader programs (part IX): Compatibility with MQL4 - Preparing data
Library for easy and quick development of MetaTrader programs (part IX): Compatibility with MQL4 - Preparing data

Library for easy and quick development of MetaTrader programs (part IX): Compatibility with MQL4 - Preparing data

In the previous articles, we started creating a large cross-platform library simplifying the development of programs for MetaTrader 5 and MetaTrader 4 platforms. In the eighth part, we implemented the class for tracking order and position modification events. Here, we will improve the library by making it fully compatible with MQL4.
Developing a cross-platform grider EA (part II): Range-based grid in trend direction
Developing a cross-platform grider EA (part II): Range-based grid in trend direction

Developing a cross-platform grider EA (part II): Range-based grid in trend direction

In this article, we will develop a grider EA for trading in a trend direction within a range. Thus, the EA is to be suited mostly for Forex and commodity markets. According to the tests, our grider showed profit since 2018. Unfortunately, this is not true for the period of 2014-2018.
Library for easy and quick development of MetaTrader programs (part VIII): Order and position modification events
Library for easy and quick development of MetaTrader programs (part VIII): Order and position modification events

Library for easy and quick development of MetaTrader programs (part VIII): Order and position modification events

In the previous articles, we started creating a large cross-platform library simplifying the development of programs for MetaTrader 5 and MetaTrader 4 platforms. In the seventh part, we added tracking StopLimit orders activation and prepared the functionality for tracking other events involving orders and positions. In this article, we will develop the class for tracking order and position modification events.
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.
Library for easy and quick development of MetaTrader programs (part VII): StopLimit order activation events, preparing the functionality for order and position modification events
Library for easy and quick development of MetaTrader programs (part VII): StopLimit order activation events, preparing the functionality for order and position modification events

Library for easy and quick development of MetaTrader programs (part VII): StopLimit order activation events, preparing the functionality for order and position modification events

In the previous articles, we started creating a large cross-platform library simplifying the development of programs for MetaTrader 5 and MetaTrader 4 platforms. In the sixth part, we trained the library to work with positions on netting accounts. Here we will implement tracking StopLimit orders activation and prepare the functionality to track order and position modification events.
Library for easy and quick development of MetaTrader programs (part VI): Netting account events
Library for easy and quick development of MetaTrader programs (part VI): Netting account events

Library for easy and quick development of MetaTrader programs (part VI): Netting account events

In the previous articles, we started creating a large cross-platform library simplifying the development of programs for MetaTrader 5 and MetaTrader 4 platforms. In the fifth part of the article series, we created trading event classes and the event collection, from which the events are sent to the base object of the Engine library and the control program chart. In this part, we will let the library to work on netting accounts.
Library for easy and quick development of MetaTrader programs (part V): Classes and collection of trading events, sending events to the program
Library for easy and quick development of MetaTrader programs (part V): Classes and collection of trading events, sending events to the program

Library for easy and quick development of MetaTrader programs (part V): Classes and collection of trading events, sending events to the program

In the previous articles, we started creating a large cross-platform library simplifying the development of programs for MetaTrader 5 and MetaTrader 4 platforms. In the fourth part, we tested tracking trading events on the account. In this article, we will develop trading event classes and place them to the event collections. From there, they will be sent to the base object of the Engine library and the control program chart.
Library for easy and quick development of MetaTrader programs (part IV): Trading events
Library for easy and quick development of MetaTrader programs (part IV): Trading events

Library for easy and quick development of MetaTrader programs (part IV): Trading events

In the previous articles, we started creating a large cross-platform library simplifying the development of programs for MetaTrader 5 and MetaTrader 4 platforms. We already have collections of historical orders and deals, market orders and positions, as well as the class for convenient selection and sorting of orders. In this part, we will continue the development of the base object and teach the Engine Library to track trading events on the account.
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.
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.
A DLL for MQL5 in 10 Minutes (Part II): Creating with Visual Studio 2017
A DLL for MQL5 in 10 Minutes (Part II): Creating with Visual Studio 2017

A DLL for MQL5 in 10 Minutes (Part II): Creating with Visual Studio 2017

The original basic article has not lost its relevance and thus if you are interested in this topic, be sure to read the first article. However much time has passed since then, so the current Visual Studio 2017 features an updated interface. The MetaTrader 5 platform has also acquired new features. The article provides a description of dll project development stages, as well as DLL setup and interaction with MetaTrader 5 tools.
Library for easy and quick development of MetaTrader programs (part III). Collection of market orders and positions, search and sorting
Library for easy and quick development of MetaTrader programs (part III). Collection of market orders and positions, search and sorting

Library for easy and quick development of MetaTrader programs (part III). Collection of market orders and positions, search and sorting

In the first part, we started creating a large cross-platform library simplifying the development of programs for MetaTrader 5 and MetaTrader 4 platforms. Further on, we implemented the collection of history orders and deals. Our next step is creating a class for a convenient selection and sorting of orders, deals and positions in collection lists. We are going to implement the base library object called Engine and add collection of market orders and positions to the library.
Library for easy and quick development of MetaTrader programs (part II). Collection of historical orders and deals
Library for easy and quick development of MetaTrader programs (part II). Collection of historical orders and deals

Library for easy and quick development of MetaTrader programs (part II). Collection of historical orders and deals

In the first part, we started creating a large cross-platform library simplifying the development of programs for MetaTrader 5 and MetaTrader 4 platforms. We created the COrder abstract object which is a base object for storing data on history orders and deals, as well as on market orders and positions. Now we will develop all the necessary objects for storing account history data in collections.