MQL4 Programming Articles

icon

Here you can find articles on MQL4 - programming language of trading strategies. Most of them are written by traders and active members of MQL5.community. For more convenience, all articles are grouped into several categories - Experts, Indicators, Trading Systems, etc.

Watch out for new articles and discuss them on the Forum!

Add a new article
latest | best
What about Hedging Daily?
What about Hedging Daily?

What about Hedging Daily?

A trading strategy using hedging system created for trading the intra-day style of GBPJPY / EURJPY and for daily trading.
Comparative Analysis of 30 Indicators and Oscillators
Comparative Analysis of 30 Indicators and Oscillators

Comparative Analysis of 30 Indicators and Oscillators

The article describes an Expert Advisor that allows conducting the comparative analysis of 30 indicators and oscillators aiming at the formation of an effective package of indexes for trading.
One-Minute Data Modelling Quality Rating
One-Minute Data Modelling Quality Rating

One-Minute Data Modelling Quality Rating

One-Minute Data Modelling Quality Rating
Using MetaTrader 4 for a Time Based Pattern Analysis
Using MetaTrader 4 for a Time Based Pattern Analysis

Using MetaTrader 4 for a Time Based Pattern Analysis

Time based pattern analysis can be used in the currency market to determine a better time to enter a trade or time in which trading should be avoided at all. Here we use MetaTrader 4 to analyze history market data and produce optimization results that can be useful for application in mechanical trading systems.
Channels. Advanced Models. Wolfe Waves
Channels. Advanced Models. Wolfe Waves

Channels. Advanced Models. Wolfe Waves

The article describes rules of marking patterns of Wolfe Waves. You will find here details of constructing and rules of accurate marking, which help to find correct formations of waves quickly and correctly.
Trader's Kit: Decorating Indicators
Trader's Kit: Decorating Indicators

Trader's Kit: Decorating Indicators

In this article you will find main tasks when decorating indicators, their solution and automation.
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!
Using Skype to Send Messages from an Expert Advisor
Using Skype to Send Messages from an Expert Advisor

Using Skype to Send Messages from an Expert Advisor

The article deals with the ways of how to send internal messages and SMSes from an Expert Advisor to mobile phones using Skype.
Automated Trading Championship: The Reverse of the Medal
Automated Trading Championship: The Reverse of the Medal

Automated Trading Championship: The Reverse of the Medal

Automated Trading Championship based on online trading platform MetaTrader 4 is being conducted for the third time and accepted by many people as a matter-of-course yearly event being waited for with impatience. However, this competition specifies strict requirements to the Participants. This is precisely the topic we're going to discuss in this article.
Trend-Hunting
Trend-Hunting

Trend-Hunting

The article describes an algorithm of volume increase of a profit trade. Its implementation using MQL4 means is presented in the article.
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.
Working with Files. An Example of Important Market Events Visualization
Working with Files. An Example of Important Market Events Visualization

Working with Files. An Example of Important Market Events Visualization

The article deals with the outlook of using MQL4 for more productive work at FOREX markets.
Graphical Control of External Parameters of Indicators
Graphical Control of External Parameters of Indicators

Graphical Control of External Parameters of Indicators

External variables of indicators are controlled using a special window where parameters can be changed and the indicator is then run again. The obvious inconvenience of these manipulations has given rise to the need for displaying the required parameters on the screen and controlling the indicator graphically.
Trader's Kit: Drag Trade Library
Trader's Kit: Drag Trade Library

Trader's Kit: Drag Trade Library

The article describes Drag Trade Library that provides functionality for visual trading. The library can easily be integrated into virtually any Expert Advisor. Your Expert Advisor can be transformed from an automat into an automated trading and information system almost effortless on your side by just adding a few lines of code.
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.
Effective Averaging Algorithms with Minimal Lag: Use in Indicators and Expert Advisors
Effective Averaging Algorithms with Minimal Lag: Use in Indicators and Expert Advisors

Effective Averaging Algorithms with Minimal Lag: Use in Indicators and Expert Advisors

The article describes custom averaging functions of higher quality developed by the author: JJMASeries(), JurXSeries(), JLiteSeries(), ParMASeries(), LRMASeries(), T3Series() and MASeries(). The author considers the hot substitution of these functions in indicators using the call of the SmoothXSeries() function.
Practical Use of the Virtual Private Server (VPS) for Autotrading
Practical Use of the Virtual Private Server (VPS) for Autotrading

Practical Use of the Virtual Private Server (VPS) for Autotrading

Autotrading using VPS. This article is intended exceptionally for autotraders and autotrading supporters.
Trend Lines Indicator Considering T. Demark's Approach
Trend Lines Indicator Considering T. Demark's Approach

Trend Lines Indicator Considering T. Demark's Approach

The indicator shows trend lines displaying the recent events on the market. The indicator is developed considering the recommendations and the approach of Thomas Demark concerning technical analysis. The indicator displays both the last direction of the trend and the next-to-last opposite direction of the trend.
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!
Trading Strategies
Trading Strategies

Trading Strategies

All categories classifying trading strategies are fully arbitrary. The classification below is to emphasize the basic differences between possible approaches to trading.
Enhancing the Quality of the Code with the Help of Unit Test
Enhancing the Quality of the Code with the Help of Unit Test

Enhancing the Quality of the Code with the Help of Unit Test

Even simple programs may often have errors that seem to be unbelievable. "How could I create that?" is our first thought when such an error is revealed. "How can I avoid that?" is the second question which comes to our mind less frequently. It is impossible to create absolutely faultless code, especially in big projects, but it is possible to use technologies for their timely detection. The article describes how the MQL4 code quality can be enhanced with the help of the popular Unit Testing method.
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.
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.
MT4TerminalSync - System for the Synchronization of MetaTrader 4 Terminals
MT4TerminalSync - System for the Synchronization of MetaTrader 4 Terminals

MT4TerminalSync - System for the Synchronization of MetaTrader 4 Terminals

This article is devoted to the topic "Widening possibilities of MQL4 programs by using functions of operating systems and other means of program development". The article describes an example of a program system that implements the task of the synchronization of several terminal copies based on a single source template.
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.
Fractal Analysis of Joint Currency Movements
Fractal Analysis of Joint Currency Movements

Fractal Analysis of Joint Currency Movements

How independent are currency quotes? Are their movements coordinated or does the movement of one currency suggest nothing of the movement of another? The article describes an effort to tackle this issue using nonlinear dynamics and fractal geometry methods.
Expert Advisors Based on Popular Trading Strategies and Alchemy of Trading Robot Optimization (Part VI)
Expert Advisors Based on Popular Trading Strategies and Alchemy of Trading Robot Optimization (Part VI)

Expert Advisors Based on Popular Trading Strategies and Alchemy of Trading Robot Optimization (Part VI)

In this article, the author proposes the way of improving trading systems presented in his previous articles. The article is of interest for traders already having experiences in writing Expert Advisors.
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.
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.
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.
Expert Advisors Based on Popular Trading Systems and Alchemy of Trading Robot Optimization (Part  V)
Expert Advisors Based on Popular Trading Systems and Alchemy of Trading Robot Optimization (Part  V)

Expert Advisors Based on Popular Trading Systems and Alchemy of Trading Robot Optimization (Part V)

In this article the author offers ways to improve trading systems described in his previous articles. The article will be interesting for traders that already have some experience of writing Expert Advisors.
Visual Testing of the Profitability of Indicators and Alerts
Visual Testing of the Profitability of Indicators and Alerts

Visual Testing of the Profitability of Indicators and Alerts

What indicator of trading alerts or just the methods of their calculating to use is usually decided when testing EAs using these alerts. However, it is not always possible/necessary/reasonable to write an EA for each indicator. You can promptly calculate the profitability of trading on the alerts from other indicators, using a special indicator that collects their alerts itself and draws a picture of ideal trading with them. It can help you both make a visual estimate of the results obtained and quickly choose most optimal parameters.
Metalanguage of Graphical Lines-Requests. Trading and Qualified Trading Learning
Metalanguage of Graphical Lines-Requests. Trading and Qualified Trading Learning

Metalanguage of Graphical Lines-Requests. Trading and Qualified Trading Learning

The article describes a simple, accessible language of graphical trading requests compatible with traditional technical analysis. The attached Gterminal is a half-automated Expert Advisor using in trading results of graphical analysis. Better used for self-education and training of beginning traders.
Fallacies, Part 2. Statistics Is a Pseudo-Science, or a Chronicle of Nosediving Bread And Butter
Fallacies, Part 2. Statistics Is a Pseudo-Science, or a Chronicle of Nosediving Bread And Butter

Fallacies, Part 2. Statistics Is a Pseudo-Science, or a Chronicle of Nosediving Bread And Butter

Numerous attempts to apply statistical methods to the objective reality, i.e. to financial series, crash when met with the nonstationarity of processes, "fat tails" of accompanying probability distributions, and insufficient volume of financial data.In this publication I will try to refer not to the financial series as such, but to their subjective presentation - in this case, to the way a trader tries to halter the series, i.e. to the trading system. The eduction of statistical regularities of the trading results process is a rather enthralling task. In some cases quite true conclusions about the model of this process can be made, and these can be applied to the trading system.
Three-Dimensional Graphs - a Professional Tool of Market Analyzing
Three-Dimensional Graphs - a Professional Tool of Market Analyzing

Three-Dimensional Graphs - a Professional Tool of Market Analyzing

In this article we will write a simple library for the construction of 3D graphs and their further viewing in Microsoft Excel. We will use standard MQL4 options to prepare and export data into *.csv file.
The Statistic Analysis of Market Movements and Their Prognoses
The Statistic Analysis of Market Movements and Their Prognoses

The Statistic Analysis of Market Movements and Their Prognoses

The present article contemplates the wide opportunities of the statistic approach to marketing. Unfortunately, beginner traders deliberately fail to apply the really mighty science of statistics. Meanwhile, it is the only thing they use subconsciously while analyzing the market. Besides, statistics can give answers to many questions.
Object Approach in MQL
Object Approach in MQL

Object Approach in MQL

This article will be interesting first of all for programmers both beginners and professionals working in MQL environment. Also it would be useful if this article were read by MQL environment developers and ideologists, because questions that are analyzed here may become projects for future implementation of MetaTrader and MQL.
A Non-Trading EA Testing Indicators
A Non-Trading EA Testing Indicators

A Non-Trading EA Testing Indicators

All indicators can be divided into two groups: static indicators, the displaying of which, once shown, always remains the same in history and does not change with new incoming quotes, and dynamic indicators that display their status for the current moment only and are fully redrawn when a new price comes. The efficiency of a static indicator is directly visible on the chart. But how can we check whether a dynamic indicator works ok? This is the question the article is devoted to.
Expert Advisors Based on Popular Trading Systems and Alchemy of Trading Robot Optimization (Part VII)
Expert Advisors Based on Popular Trading Systems and Alchemy of Trading Robot Optimization (Part VII)

Expert Advisors Based on Popular Trading Systems and Alchemy of Trading Robot Optimization (Part VII)

In this article, the author gives an example Expert Advisor meeting the requirements stated in the Rules of the Automated Trading Championship 2008
Expert Advisors Based on Popular Trading Systems and Alchemy of Trading Robot Optimization (Part IV)
Expert Advisors Based on Popular Trading Systems and Alchemy of Trading Robot Optimization (Part IV)

Expert Advisors Based on Popular Trading Systems and Alchemy of Trading Robot Optimization (Part IV)

In this article the author continues to analyze implementation algorithms of simplest trading systems and introduces recording of optimization results in backtesting into one html file in the form of a table. The article will be useful for beginning traders and EA writers.