MQL4 and MQL5 Programming Articles

icon

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!

Add a new article
latest | best
MQL5 Cookbook: Multi-Currency Expert Advisor - Simple, Neat and Quick Approach
MQL5 Cookbook: Multi-Currency Expert Advisor - Simple, Neat and Quick Approach

MQL5 Cookbook: Multi-Currency Expert Advisor - Simple, Neat and Quick Approach

This article will describe an implementation of a simple approach suitable for a multi-currency Expert Advisor. This means that you will be able to set up the Expert Advisor for testing/trading under identical conditions but with different parameters for each symbol. As an example, we will create a pattern for two symbols but in such a way so as to be able to add additional symbols, if necessary, by making small changes to the code.
Three Aspects of Manual Trading Automation. Part 1: Trading
Three Aspects of Manual Trading Automation. Part 1: Trading

Three Aspects of Manual Trading Automation. Part 1: Trading

This article is the first in a series of articles on manual trading automation in the МetaТrader 4 trading platform. Each of the articles will be devoted to one of the following aspects: automation of manual trading, current state of trade display automation and automation of reports on trade results. In this article, I will present an interesting approach to creating EA's controlled manually by a trader.
The Random Sandbox
The Random Sandbox

The Random Sandbox

The article includes an interactive "sandbox" as an Excel file which simulates randomized Expert Advisor backtest data. Readers can use this to help explore and more deeply understand the EA performance metrics offered by default with MetaTrader. The text of the article is designed to guide the user through this experience.
MQL5 Cookbook: Developing a Framework for a Trading System Based on the Triple Screen Strategy
MQL5 Cookbook: Developing a Framework for a Trading System Based on the Triple Screen Strategy

MQL5 Cookbook: Developing a Framework for a Trading System Based on the Triple Screen Strategy

In this article, we will develop a framework for a trading system based on the Triple Screen strategy in MQL5. The Expert Advisor will not be developed from scratch. Instead, we will simply modify the program from the previous article "MQL5 Cookbook: Using Indicators to Set Trading Conditions in Expert Advisors" which already substantially serves our purpose. So the article will also demonstrate how you can easily modify patterns of ready-made programs.
MQL5 Cookbook: Using Indicators to Set Trading Conditions in Expert Advisors
MQL5 Cookbook: Using Indicators to Set Trading Conditions in Expert Advisors

MQL5 Cookbook: Using Indicators to Set Trading Conditions in Expert Advisors

In this article, we will continue to modify the Expert Advisor we have been working on throughout the preceding articles of the MQL5 Cookbook series. This time, the Expert Advisor will be enhanced with indicators whose values will be used to check position opening conditions. To spice it up, we will create a drop-down list in the external parameters to be able to select one out of three trading indicators.
Indicator for Point and Figure Charting
Indicator for Point and Figure Charting

Indicator for Point and Figure Charting

There are lots of chart types that provide information on the current market situation. Many of them, such as Point and Figure chart, are the legacy of the remote past. The article describes an example of Point and Figure charting using a real time indicator.
The ZigZag Indicator: Fresh Approach and New Solutions
The ZigZag Indicator: Fresh Approach and New Solutions

The ZigZag Indicator: Fresh Approach and New Solutions

The article examines the possibility of creating an advanced ZigZag indicator. The idea of identifying nodes is based on the use of the Envelopes indicator. We assume that we can find a certain combination of input parameters for a series of Envelopes, whereby all ZigZag nodes lie within the confines of the Envelopes bands. Consequently, we can try to predict the coordinates of the new node.
MQL5 Cookbook: The History of Deals And Function Library for Getting Position Properties
MQL5 Cookbook: The History of Deals And Function Library for Getting Position Properties

MQL5 Cookbook: The History of Deals And Function Library for Getting Position Properties

It is time to briefly summarize the information provided in the previous articles on position properties. In this article, we will create a few additional functions to get the properties that can only be obtained after accessing the history of deals. We will also get familiar with data structures that will allow us to access position and symbol properties in a more convenient way.
MQL5 Programming Basics: Time
MQL5 Programming Basics: Time

MQL5 Programming Basics: Time

The article focuses on standard MQL5 functions for working with time, as well as programming techniques and practically useful functions for working with time that are required when creating Expert Advisors and indicators. Particular attention is paid to the general theory of time measurement. This article should be of interest primarily to novice MQL5 programmers.
Debugging MQL5 Programs
Debugging MQL5 Programs

Debugging MQL5 Programs

This article is intended primarily for the programmers who have already learned the language but have not fully mastered the program development yet. It reveals some debugging techniques and presents a combined experience of the author and many other programmers.
MQL5 Cookbook: How to Avoid Errors When Setting/Modifying Trade Levels
MQL5 Cookbook: How to Avoid Errors When Setting/Modifying Trade Levels

MQL5 Cookbook: How to Avoid Errors When Setting/Modifying Trade Levels

In continuation of our work on the Expert Advisor from the previous article of the series called "MQL5 Cookbook: Analyzing Position Properties in the MetaTrader 5 Strategy Tester", we will enhance it with a whole lot of useful functions, as well as improve and optimize the existing ones. The Expert Advisor will this time have external parameters that can be optimized in the MetaTrader 5 Strategy Tester and will in some ways resemble a simple trading system.
MQL5 Programming Basics: Strings
MQL5 Programming Basics: Strings

MQL5 Programming Basics: Strings

The article covers everything you can do with strings in MQL5. It should be of interest primarily to novice MQL5 programmers, while experienced developers will have a good opportunity to summarize and systematize their knowledge.
MQL5 Cloud Network: Are You Still Calculating?
MQL5 Cloud Network: Are You Still Calculating?

MQL5 Cloud Network: Are You Still Calculating?

It will soon be a year and a half since the MQL5 Cloud Network has been launched. This leading edge event ushered in a new era of algorithmic trading - now with a couple of clicks, traders can have hundreds and thousands of computing cores at their disposal for the optimization of their trading strategies.
MQL5 Market Results for Q1 2013
MQL5 Market Results for Q1 2013

MQL5 Market Results for Q1 2013

Since its founding, the store of trading robots and technical indicators MQL5 Market has already attracted more than 250 developers who have published 580 products. The first quarter of 2013 has turned out to be quite successful for some MQL5 Market sellers who have managed to make handsome profit by selling their products.
MQL5 Cookbook: Analyzing Position Properties in the MetaTrader 5 Strategy Tester
MQL5 Cookbook: Analyzing Position Properties in the MetaTrader 5 Strategy Tester

MQL5 Cookbook: Analyzing Position Properties in the MetaTrader 5 Strategy Tester

We will present a modified version of the Expert Advisor from the previous article "MQL5 Cookbook: Position Properties on the Custom Info Panel". Some of the issues we will address include getting data from bars, checking for new bar events on the current symbol, including a trade class of the Standard Library to a file, creating a function to search for trading signals and a function for executing trading operations, as well as determining trade events in the OnTrade() function.
Jeremy Scott - Successful MQL5 Market Seller
Jeremy Scott - Successful MQL5 Market Seller

Jeremy Scott - Successful MQL5 Market Seller

Jeremy Scott who is better known under Johnnypasado nickname at MQL5.community became famous offering products in our MQL5 Market service. Jeremy has already made several thousands of dollars in the Market and that is not the limit. We decided to take a closer look at the future millionaire and receive some pieces of advice for MQL5 Market sellers.
MQL5 Cookbook: Position Properties on the Custom Info Panel
MQL5 Cookbook: Position Properties on the Custom Info Panel

MQL5 Cookbook: Position Properties on the Custom Info Panel

This time we will create a simple Expert Advisor that will get position properties on the current symbol and display them on the custom info panel during manual trading. The info panel will be created using graphical objects and displayed information will be refreshed at every tick. This is going to be much more convenient than all the time having to manually run the script described in the previous article of the series called "MQL5 Cookbook: Getting Position Properties".
MQL5 Programming Basics: Arrays
MQL5 Programming Basics: Arrays

MQL5 Programming Basics: Arrays

Arrays are an integral part of almost any programming language along with variables and functions. The article should be of interest primarily to novice MQL5 programmers, while experienced programmers will have a good opportunity to summarize and systematize their knowledge.
MQL5 Cookbook: Getting Position Properties
MQL5 Cookbook: Getting Position Properties

MQL5 Cookbook: Getting Position Properties

In this article, we will create a script that gets all position properties and displays them to the user in a dialog box. Upon running the script, you will be able to select out of two modes available in the drop-down list in the external parameters: to either view position properties only on the current symbol or to view position properties on all symbols.
MQL5 Cookbook: Using Different Print Modes
MQL5 Cookbook: Using Different Print Modes

MQL5 Cookbook: Using Different Print Modes

This is the first article of the MQL5 Cookbook series. I will start with simple examples to allow those who are taking their first steps in programming to gradually become familiar with the new language. I remember my first efforts at designing and programming trading systems which I may say was quite difficult, given the fact that it was the first programming language in my life. However, it turned out to be easier than I thought and it only took me a few months before I could develop a fairly complex program.
Calculation of Integral Characteristics of Indicator Emissions
Calculation of Integral Characteristics of Indicator Emissions

Calculation of Integral Characteristics of Indicator Emissions

Indicator emissions are a little-studied area of market research. Primarily, this is due to the difficulty of analysis that is caused by the processing of very large arrays of time-varying data. Existing graphical analysis is too resource intensive and has therefore triggered the development of a parsimonious algorithm that uses time series of emissions. This article demonstrates how visual (intuitive image) analysis can be replaced with the study of integral characteristics of emissions. It can be of interest to both traders and developers of automated trading systems.
MetaTrader 4 Expert Advisor exchanges information with the outside world
MetaTrader 4 Expert Advisor exchanges information with the outside world

MetaTrader 4 Expert Advisor exchanges information with the outside world

A simple, universal and reliable solution of information exchange between МetaТrader 4 Expert Advisor and the outside world. Suppliers and consumers of the information can be located on different computers, the connection is performed through the global IP addresses.
Change Expert Advisor Parameters From the User Panel "On the Fly"
Change Expert Advisor Parameters From the User Panel "On the Fly"

Change Expert Advisor Parameters From the User Panel "On the Fly"

This article provides a small example demonstrating the implementation of an Expert Advisor whose parameters can be controlled from the user panel. When changing the parameters "on the fly", the Expert Advisor writes the values obtained from the info panel to a file to further read them from the file and display accordingly on the panel. This article may be relevant to those who trade manually or in semi-automatic mode.
Fast Testing of Trading Ideas on the Chart
Fast Testing of Trading Ideas on the Chart

Fast Testing of Trading Ideas on the Chart

The article describes the method of fast visual testing of trading ideas. The method is based on the combination of a price chart, a signal indicator and a balance calculation indicator. I would like to share my method of searching for trading ideas, as well as the method I use for fast testing of these ideas.
MQL5 Market Turns One Year Old
MQL5 Market Turns One Year Old

MQL5 Market Turns One Year Old

One year has passed since the launch of sales in MQL5 Market. It was a year of hard work, which turned the new service into the largest store of trading robots and technical indicators for MetaTrader 5 platform.
MetaTrader 4 and MetaTrader 5 Trading Signals Widgets
MetaTrader 4 and MetaTrader 5 Trading Signals Widgets

MetaTrader 4 and MetaTrader 5 Trading Signals Widgets

Recently MetaTrader 4 and MetaTrader 5 user received an opportunity to become a Signals Provider and earn additional profit. Now, you can display your trading success on your web site, blog or social network page using the new widgets. The benefits of using widgets are obvious: they increase the Signals Providers' popularity, establish their reputation as successful traders, as well as attract new Subscribers. All traders placing widgets on other web sites can enjoy these benefits.
Order Strategies. Multi-Purpose Expert Advisor
Order Strategies. Multi-Purpose Expert Advisor

Order Strategies. Multi-Purpose Expert Advisor

This article centers around strategies that actively use pending orders, a metalanguage that can be created to formally describe such strategies and the use of a multi-purpose Expert Advisor whose operation is based on those descriptions
Neural Networks: From Theory to Practice
Neural Networks: From Theory to Practice

Neural Networks: From Theory to Practice

Nowadays, every trader must have heard of neural networks and knows how cool it is to use them. The majority believes that those who can deal with neural networks are some kind of superhuman. In this article, I will try to explain to you the neural network architecture, describe its applications and show examples of practical use.
MetaTrader 5 on Linux
MetaTrader 5 on Linux

MetaTrader 5 on Linux

In this article, we demonstrate an easy way to install MetaTrader 5 on popular Linux versions — Ubuntu and Debian. These systems are widely used on server hardware as well as on traders’ personal computers.
MetaTrader 5 on Mac OS
MetaTrader 5 on Mac OS

MetaTrader 5 on Mac OS

Apple products have become very popular. MetaQuotes Software Corp. attentively follows the progress of the IT industry and has already released the special mobile applications for iOS-based devices - MetaTrader 4 for iPhone and MetaTrader 5 for iPhone. There are many topics on MQL5.community forum, where people are seeking a solution for running MetaTrader 5 under Mac OS operating system. In this article, you will find out how to work with MetaTrader 5 via the Apple's popular operating system.
General information on Trading Signals for MetaTrader 4 and MetaTrader 5
General information on Trading Signals for MetaTrader 4 and MetaTrader 5

General information on Trading Signals for MetaTrader 4 and MetaTrader 5

MetaTrader 4 / MetaTrader 5 Trading Signals is a service allowing traders to copy trading operations of a Signals Provider. Our goal was to develop the new massively used service protecting Subscribers and relieving them of unnecessary costs.
Interview with Alexey Masterov (ATC 2012)
Interview with Alexey Masterov (ATC 2012)

Interview with Alexey Masterov (ATC 2012)

We do our best to introduce all the leading Championship Participants to our audience in reasonable time. To achieve that, we closely monitor the most promising contestants in our TOP-10 and arrange interviews with them. However, the sharp rise of Alexey Masterov (reinhard) up to the third place has become a real surprise!
How to Prepare MetaTrader 5 Quotes for Other Applications
How to Prepare MetaTrader 5 Quotes for Other Applications

How to Prepare MetaTrader 5 Quotes for Other Applications

The article describes the examples of creating directories, copying data, filing, working with the symbols in Market Watch or the common list, as well as the examples of handling errors, etc. All these elements can eventually be gathered in a single script for filing the data in a user-defined format.
Interview with Sergey Pankratyev (ATC 2012)
Interview with Sergey Pankratyev (ATC 2012)

Interview with Sergey Pankratyev (ATC 2012)

The Championship is coming to an end leaving us with vivid impressions of many unusual trading strategies. However, the trading robot of Sergey Pankratyev (s75) is showing really peculiar things - it is trading all 12 currency pairs opening only long positions. It is not an error but just a response to some certain market conditions.
Interview with Enbo Lu (ATC 2012)
Interview with Enbo Lu (ATC 2012)

Interview with Enbo Lu (ATC 2012)

"Be sure to participate in the Automated Trading Championships, where you can get a truly invaluable experience!" - this is the motto of contestant Enbo Lu (luenbo) from China. He appeared in the TOP-10 of Automated Trading Championship 2012 last week and is now consistently trying to reach the podium.
Interview with Sergey Abramov (ATC 2012)
Interview with Sergey Abramov (ATC 2012)

Interview with Sergey Abramov (ATC 2012)

The trading robot of Sergey Abramov (26405) is staying in TOP-10 since the second week. However, it caused much anxiety for its developer. As it turned out, the robot contains a small error in position close block. The robot has been developed almost exclusively on the basis of the past years' results.
Interview with Ruslan Ziyatdinov (ATC 2012)
Interview with Ruslan Ziyatdinov (ATC 2012)

Interview with Ruslan Ziyatdinov (ATC 2012)

The Championship keeps providing us with new discoveries, as well as new interesting Participants and unusual ideas implemented in the competition trading robots. While interviewing Ruslan Ziyatdinov (rusland1962), we learned about his simple approach to trading and found out why it is better to trade less frequently.
Interview with Alexandr Artapov (ATC 2012)
Interview with Alexandr Artapov (ATC 2012)

Interview with Alexandr Artapov (ATC 2012)

It was during the second week of the Championship when the Expert Advisor of Alexandr Artapov (artall) found itself on the third position trading EURUSD and EURJPY. Then it briefly left TOP-10 to appear again after one month of struggle for survival. As it turned out, this trading robot is still having something up its sleeve.
Interview with Mariusz Zarnowski (ATC 2012)
Interview with Mariusz Zarnowski (ATC 2012)

Interview with Mariusz Zarnowski (ATC 2012)

As December 28 is approaching, the list of leaders of the Automated Trading Championship 2012 is becoming clearer. With only two weeks to go until the end of the Championship, Mariusz Zarnowski (zrn) from Poland stands a good chance to be in the top three. His EA has already demonstrated how it can triple the initial deposit in just a couple of weeks.
Machine Learning: How Support Vector Machines can be used in Trading
Machine Learning: How Support Vector Machines can be used in Trading

Machine Learning: How Support Vector Machines can be used in Trading

Support Vector Machines have long been used in fields such as bioinformatics and applied mathematics to assess complex data sets and extract useful patterns that can be used to classify data. This article looks at what a support vector machine is, how they work and why they can be so useful in extracting complex patterns. We then investigate how they can be applied to the market and potentially used to advise on trades. Using the Support Vector Machine Learning Tool, the article provides worked examples that allow readers to experiment with their own trading.