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
Price Forecasting Using Neural Networks
Price Forecasting Using Neural Networks

Price Forecasting Using Neural Networks

Many traders speak about neural networks, but what they are and what they really can is known to few people. This article sheds some light on the world of artificial intelligence. It describes, how to prepare correctly the data for the network. Here you will also find an example of forecasting using means of the program Matlab.
ZUP - Universal ZigZag with Pesavento Patterns. Part 2
ZUP - Universal ZigZag with Pesavento Patterns. Part 2

ZUP - Universal ZigZag with Pesavento Patterns. Part 2

ZUP - Universal ZigZag with Pesavento Patterns. Part 2 - Description of Embedded Tools
Strings: Table of ASCII Symbols and Its Use
Strings: Table of ASCII Symbols and Its Use

Strings: Table of ASCII Symbols and Its Use

In this article we will analyze the table of ASCII symbols and the ways it can be used. We will also deal with some new functions, the principle of operation of which is based on the peculiarities of the ASCII table, and then we will create a new library, which will include these functions. They are quite popular in other programming languages, but they are not included into the list of built-in functions. Besides, we will examine in details the basics of working with strings. So, I think you will certainly learn something new about this useful type of data.
Testing Visualization: Account State Charts
Testing Visualization: Account State Charts

Testing Visualization: Account State Charts

Enjoy the process of testing with charts, displaying the balance - now all the necessary information is always in view!
Non-standard Automated Trading
Non-standard Automated Trading

Non-standard Automated Trading

Successful and comfortable trading using MT4 platform without detailed market analysis - is it possible? Can such trading be implemented in practice? I suppose, yes. Especially in terms of the automated trading!
Tester in the Terminal MetaTrader 4: It Should Be Known
Tester in the Terminal MetaTrader 4: It Should Be Known

Tester in the Terminal MetaTrader 4: It Should Be Known

The elaborate interface of the terminal MetaTrader 4 is a forefront, but beside this the terminal includes a deep-laid tester of strategies. And while the worth of MetaTrader 4 as a trading terminal is obvious, the quality of the tester's strategy testing can be assessed only in practice. This article shows the advantages and conveniences of testing in MetaTrader 4.
Interaction between MetaTrader 4 and Matlab via CSV Files
Interaction between MetaTrader 4 and Matlab via CSV Files

Interaction between MetaTrader 4 and Matlab via CSV Files

Step-by-step instructions of how to organize data arrays exchange between MetaTrader 4 and Matlab via CSV files.
Sending Trading Signals in a Universal Expert Advisor
Sending Trading Signals in a Universal Expert Advisor

Sending Trading Signals in a Universal Expert Advisor

The article describes different ways of sending trading signals from a signal program unit of a universal Expert Advisor into the positions and orders controlling unit. It dwells on serial and parallel interfaces.
Theoretical Basis of Building Cluster Indicators for FOREX
Theoretical Basis of Building Cluster Indicators for FOREX

Theoretical Basis of Building Cluster Indicators for FOREX

Cluster indicators are sets of indicators that divide currency pairs into separate currencies. Indicators allow to trace the relative currency fluctuation, determine the potential of formating new currency trends, receive trade signals and follow medium-term and long-term positons.
Tricolor Indicators and Some Opportunities for Maximal Simplification of Writing Indicators
Tricolor Indicators and Some Opportunities for Maximal Simplification of Writing Indicators

Tricolor Indicators and Some Opportunities for Maximal Simplification of Writing Indicators

In this article the author dwells on some means of increasing indicators' informational value for visual trading. The author analyzes the realization of tricolor indicators, indicators, for building which data from other timeframes is used, and continues to dwell on the library of indicators, described in the article "Effective Averaging Algorithms with Minimal Lag: Use in Indicators"
Forex Trading ABC
Forex Trading ABC

Forex Trading ABC

Working on financial markets represents, first of all, trade operations. We all, starting from the very childhood, have an intuitive idea of what is to buy and to sell. But Forex trading is still something special. This article deals with the ideas necessary to explain some terms. We will also consider the MQL 4 functions that correspond with those terms.
Sending Trade Signal Via RSS Feed
Sending Trade Signal Via RSS Feed

Sending Trade Signal Via RSS Feed

This is my idea how to send your trade signal as RSS FEEDS , a famous way to communicate with your community's members right now.
The Basic of Coding A Hedge Expert Advisor
The Basic of Coding A Hedge Expert Advisor

The Basic of Coding A Hedge Expert Advisor

An example of hedge Expert Advisor is just presented in this article. The author will choose its very own favorite hedge pair that is EURJPY & GBPJPY. It always moves the same way, easier to set the hedging order type.
ZUP - Universal ZigZag with Pesavento Patterns. Part 1
ZUP - Universal ZigZag with Pesavento Patterns. Part 1

ZUP - Universal ZigZag with Pesavento Patterns. Part 1

The article gives a short description of ideas underlying indicator ZUP - Universal ZigZag with Pesavento Patterns. The article also describes indicators of ZigZag embedded in ZUP.
MQL4 Language for Newbies. Difficult Questions in Simple Phrases.
MQL4 Language for Newbies. Difficult Questions in Simple Phrases.

MQL4 Language for Newbies. Difficult Questions in Simple Phrases.

This is the second article from the series "MQL4 Language for Newbies". Now we will examine more complex and advanced constructions of the language, learn new options and see, how they can be applied in everyday practice. You will get acquainted with a new cycle type 'while', new condition type 'switch', operators 'break' and 'continue'. Besides you will learn to write your own functions and work with multidimensional arrays. And for a dessert I have prepared an explanation about a preprocessor.
Running MetaTrader 4 Client Terminal on Linux-Desktop
Running MetaTrader 4 Client Terminal on Linux-Desktop

Running MetaTrader 4 Client Terminal on Linux-Desktop

Description of a step-by-step Linux-desktop setup using a non-emulator wine for running MetaTrader 4 Client Terminal on it.
MQL4 Language for Newbies. Introduction
MQL4 Language for Newbies. Introduction

MQL4 Language for Newbies. Introduction

This sequence of articles is intended for traders, who know nothing about programming, but have a desire to learn MQL4 language as quick as possible with minimal time and effort inputs. If you are afraid of such phrases as "object orientation" or "three dimensional arrays", this article is what you need. The lessons are designed for the maximally quick result. Moreover, the information is delivered in a comprehensible manner. We shall not go too deep into the theory, but you will gain the practical benefit already from the first lesson.
How to Develop a Reliable and Safe Trade Robot in MQL 4
How to Develop a Reliable and Safe Trade Robot in MQL 4

How to Develop a Reliable and Safe Trade Robot in MQL 4

The article deals with the most common errors that occur in developing and using of an Expert Advisor. An exemplary safe automated trading system is described, as well.
Modelling Requotes in Tester and Expert Advisor Stability Analysis
Modelling Requotes in Tester and Expert Advisor Stability Analysis

Modelling Requotes in Tester and Expert Advisor Stability Analysis

Requote is a scourge for many Expert Advisors, especially for those that have rather sensitive conditions of entering/exiting a trade. In the article, a way to check up the EA for the requotes stability is offered.
Ten "Errors" of a Newcomer in Trading?
Ten "Errors" of a Newcomer in Trading?

Ten "Errors" of a Newcomer in Trading?

The article substantiates approach to building a trading system as a sequence of opening and closing the interrelated orders regarding the existing conditions - prices and the current values of each order's profit/loss, not only and not so much the conventional "alerts". We are giving an exemplary realization of such an elementary trading system.
Alternative Log File with the Use of HTML and CSS
Alternative Log File with the Use of HTML and CSS

Alternative Log File with the Use of HTML and CSS

In this article we will describe the process of writing a simple but a very powerful library for making the html files, will learn to adjust their displaying and will see how they can be easily implemented and used in your expert or the script.
Simultaneous Displaying of the Signals of Several Indicators from the Four Timeframes
Simultaneous Displaying of the Signals of Several Indicators from the Four Timeframes

Simultaneous Displaying of the Signals of Several Indicators from the Four Timeframes

While manual trading you have to keep an eye on the values of several indicators. It is a little bit different from mechanical trading. If you have two or three indicators and you have chosen a one timeframe for trading, it is not a complicated task. But what will you do if you have five or six indicators and your trading strategy requires considering the signals on the several timeframes?
Sound Alerts in Indicators
Sound Alerts in Indicators

Sound Alerts in Indicators

How to create "voice" indicators for daily usage.
Displaying of Support/Resistance Levels
Displaying of Support/Resistance Levels

Displaying of Support/Resistance Levels

The article deals with detecting and indicating Support/Resistance Levels in the MetaTrader 4 program. The convenient and universal indicator is based on a simple algorithm. The article also tackles such a useful topic as creation of a simple indicator that can display results from different timeframes in one workspace.
A Method of Drawing the Support/Resistance Levels
A Method of Drawing the Support/Resistance Levels

A Method of Drawing the Support/Resistance Levels

This article describes the process of creating a simple script for detecting the support/resistance levels. It is written for beginners, so you can find the detailed explanation of every stage of the process. However, though the script is very simple, the article will be also useful for advanced traders and the users of the MetaTrader 4 platform. It contains the examples of the data export into the tabular format, the import of the table to Microsoft Excel and plotting the charts for the further detailed analysis.
Genetic Algorithms vs. Simple Search in the MetaTrader 4 Optimizer
Genetic Algorithms vs. Simple Search in the MetaTrader 4 Optimizer

Genetic Algorithms vs. Simple Search in the MetaTrader 4 Optimizer

The article compares the time and results of Expert Advisors' optimization using genetic algorithms and those obtained by simple search.
Pivot Points Helping to Define Market Trends
Pivot Points Helping to Define Market Trends

Pivot Points Helping to Define Market Trends

Pivot point is a line in the price chart that shows the further trend of a currency pair. If the price is above this line, it tends to grow. If the price is below this line, accordingly, it tends to fall.
Expert System 'Commentator'. Practical Use of Embedded Indicators in an MQL4 Program
Expert System 'Commentator'. Practical Use of Embedded Indicators in an MQL4 Program

Expert System 'Commentator'. Practical Use of Embedded Indicators in an MQL4 Program

The article describes the use of technical indicators in programming on MQL4.
Events in МetaТrader 4
Events in МetaТrader 4

Events in МetaТrader 4

The article deals with programmed tracking of events in the МetaТrader 4 Client Terminal, such as opening/closing/modifying orders, and is targeted at a user who has basic skills in working with the terminal and in programming in MQL 4.
Synchronization of Expert Advisors, Scripts and Indicators
Synchronization of Expert Advisors, Scripts and Indicators

Synchronization of Expert Advisors, Scripts and Indicators

The article considers the necessity and general principles of developing a bundled program that would contain both an Expert Advisor, a script and an indicator.
Poll: Traders’ Estimate of the Mobile Terminal
Poll: Traders’ Estimate of the Mobile Terminal

Poll: Traders’ Estimate of the Mobile Terminal

Unfortunately, there are no clear projections available at this moment about the future of the mobile trading. However, there are a lot of speculations surrounding this matter. In our attempt to resolve this ambiguity we decided to conduct a survey among traders to find out their opinion about our mobile terminals. Through the efforts of this survey, we have managed to established a clear picture of what our clients currently think about the product as well as their requests and wishes in future developments of our mobile terminals.
MQL4  as a Trader's Tool, or The Advanced Technical Analysis
MQL4  as a Trader's Tool, or The Advanced Technical Analysis

MQL4 as a Trader's Tool, or The Advanced Technical Analysis

Trading is, first of all, a calculus of probabilities. The proverb about idleness being an engine for progress reveals us the reason why all those indicators and trading systems have been developed. It comes that the major of newcomers in trading study "ready-made" trading theories. But, as luck would have it, there are some more undiscovered market secrets, and tools used in analyzing of price movements exist, basically, as those unrealized technical indicators or math and stat packages. Thanks awfully to Bill Williams for his contribution to the market movements theory. Though, perhaps, it's too early to rest on oars.
Effective Averaging Algorithms with Minimal Lag: Use in Indicators
Effective Averaging Algorithms with Minimal Lag: Use in Indicators

Effective Averaging Algorithms with Minimal Lag: Use in Indicators

The article describes custom averaging functions of higher quality developed by the author: JJMASeries(), JurXSeries(), JLiteSeries(), ParMASeries(), LRMASeries(), T3Series(). The article also deals with application of the above functions in indicators. The author introduces a rich indicators library based on the use of these functions.
What Is a Martingale?
What Is a Martingale?

What Is a Martingale?

A short description of various illusions that come up when people trade using martingale betting strategies or misuse spiking and the like approaches.
Testing Visualization: Manual Trading
Testing Visualization: Manual Trading

Testing Visualization: Manual Trading

Testing manual strategies on history. Check how your trading algorithm works turning a deaf ear to programming niceties!
Testing Visualization: Functionality Enhancement
Testing Visualization: Functionality Enhancement

Testing Visualization: Functionality Enhancement

The article describes software that can make strategy testing highly similar to the real trading.
Testing Visualization: Trade History
Testing Visualization: Trade History

Testing Visualization: Trade History

The article describes the possibilities of convenient viewing the trade history when visualizing tests. Starting from build 196, MetaTrader 4 Client Terminal offers testing visualization function. It allows controlling the Expert Advisors' testing on a brand new level. Now, the trading programmer can watch every action of his or her Expert Advisor checking its operation on history!
Beginners' Mistakes when Working with MetaTrader 4 Client Terminal
Beginners' Mistakes when Working with MetaTrader 4 Client Terminal

Beginners' Mistakes when Working with MetaTrader 4 Client Terminal

Err is human. Everybody makes mistakes: more or less frequently, through ignorance or inadvertently. You ask and we answer your questions about: terminal time, test results, Print in journal, symbols, history for Tester, history import, leverage, traffic, hints, scaling, wrong calculations, Invalid account, Empty News, Price changed, Not Enough Money, Market Is Closed.
Graphic Expert Advisor: AutoGraf
Graphic Expert Advisor: AutoGraf

Graphic Expert Advisor: AutoGraf

The article shows the workability of graphics in creation of a convenient interface to manage trading.
Trading Tactics on Forex
Trading Tactics on Forex

Trading Tactics on Forex

The article will help a beginning trader to develop trading tactics on FOREX.