Download MetaTrader 5

Articles with MQL4 programming examples

Access a huge collection of articles with code examples showing how to create indicators and trading robots for the MetaTrader platform in the MQL5 language. Source codes are attached to the articles, so you can open them in MetaEditor and run them to see how the applications work.

These articles will be useful both for those who have just started exploring automated trading and for professional traders with programming experience. They feature not only examples, but also contain new ideas.

latest | best

Working with Doubles in MQL4

In this note we will consider a typical programming errors, that occurs while working with double numbers in MQL4 programs.

Interaction between MеtaTrader 4 and MATLAB Engine (Virtual MATLAB Machine)

The article contains considerations regarding creation of a DLL library - wrapper that will enable the interaction of MetaTrader 4 and the MATLAB mathematical desktop package. It describes "pitfalls"...

Superposition and Interference of Financial Securities

The more factors influence the behavior of a currency pair, the more difficult it is to evaluate its behavior and make up future forecasts. Therefore, if we managed to extract components of a currency...

Using Neural Networks In MetaTrader

This article shows you how to easily use Neural Networks in your MQL4 code taking advantage of best freely available artificial neural network library (FANN) employing multiple neural networks in your...

Alert and Comment for External Indicators

In practical work a trader can face the following situation: it is necessary to get "alert" or a text message on a display (in a chart window) indicating about an appeared signal of an indicator. The...

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...

Recipes for Neuronets

The article is intended for beginners in baking "multi-layered" cakes.

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...

Program Folder of MetaTrader 4 Client Terminal

The article describes the contents of the program folder of MetaTrader 4 Client Terminal. The article will be useful for those who have already started to grasp into the details of the client terminal...

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...

To Sleep, or Not to Sleep?

An alternative use of the Sleep() function in the realization of pauses between EA's actions is proposed. The approach under consideration allows a smart use of machine time.

Idleness is the Stimulus to Progress. Semiautomatic Marking a Template

Among the dozens of examples of how to work with charts, there is a method of manual marking a template. Trend lines, channels, support/resistance levels, etc. are imposed in a chart. Surely, there...

HTML Walkthrough Using MQL4

HTML is nowadays one of the wide-spread types of documents. MetaTrader 4 Client Terminal allows you to save statements, test and optimization reports as .htm files. It is sometimes necessary to get...

How to Write Fast Non-Redrawing ZigZags

A rather universal approach to writing indicators of the ZigZag type is proposed. The method includes a significant part of ZigZags already described and allows you to create new ones relatively...

Idleness is the Stimulus to Progress, or How to Work with Graphics Interacively

An indicator for interactive working with trend lines, Fibo levels, icons manually imposed on a chart. It allows you to draw the colored zones of Fibo levels, shows the moments of the price crossing...

Changing the External Parameters of MQL4 Programs without Restarting

The article describes a method of changing the external parameters of MQL4 programs on-the-fly, without restarting.

Drawing Horizontal Break-Through Levels Using Fractals

The article describes creation of an indicator that would display the support/resistance levels using up/down fractals.

A Trader's Assistant Based on Extended MACD Analysis

Script 'Trader's Assistant' helps you to make a decision on opening positions, based on the extended analysis of the MACD status for the last three bars in the real-time trading on any timeframe. It...

Grouped File Operations

It is sometimes necessary to perform identical operations with a group of files. If you have a list of files included into a group, then it is no problem. However, if you need to make this list...

Method of Determining Errors in Code by Commenting

The article describes a method of searching the errors in the MQL4 code that is based on commenting. This method is found to be a useful one in case of problems occuring during the compilation caused...

All about Automated Trading Championship: Additional Materials of Championships 2006-2007

We present to you a selection of these materials that are divided into several parts. The present one contains additional materials about automated trading, Expert Advisors development, etc.

File Operations via WinAPI

Environment MQL4 is based on the conception of safe "sandbox": reading and saving files using the language are allowed in some predefined folders only. This protects the user of MetaTrader 4 from the...

All about Automated Trading Championship: Reporting the Championship 2007

The present article contains Weekly Reports of the ATC 2007. These materials are like snapshots, they are interesting-to-read not only during the Championship, but years later as well.

All about Automated Trading Championship: Interviews with the Participants'07

The published interviews of Championship 2007 bear the stamp of the results obtained during the preceding contest. The first Championship evoked a wide response on the internet and in printings. The...

All about Automated Trading Championship: Reporting the Championship 2006

This article contains Weekly Reports of the ATC 2006. These materials are like snapshots, they are interesting-to-read not only during the Championship, but years later as well.

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....

All about Automated Trading Championship: Interviews with the Participants'06

Interviews with the Participants of Automated Trading Championship 2006 demonstrated a great variety of views of automated trading and trading as a whole. You can see yourselves which ideas turned out...

Interaction between MetaTrader 4 and Matlab via DDE

Step-by-step instructions of how to organize data transfer from Matlab to MetaTrader 4 using DDE.

All about Automated Trading Championship: Statistical Reports

Creating a profitable and stable trading system is always related to statistical data processing. In this article, we pout together statistical reports of the Automated Trading Championships 2006-2007...

All about Automated Trading Championship: Registration

This article comprises useful materials that will help you learn more about the procedure of registration for participation in the Automated Trading Championship.

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....

Two-Stage Modification of Opened Positions

The two-stage approach allows you to avoid the unnecessary closing and re-opening of positions in situations close to the trend and in cases of possible occurrence of divirgence.

Integrating MetaTrader 4 Client Terminal with MS SQL Server

The article gives an example of integrating MetaTrader 4 Client Terminal with MS SQL Server using a dll. Attached are both source codes in С++ and in MQL4, and a ready-made and compiled Visual C++ 6.0...

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...

MetaEditor:Templates as a Spot to Stand On

It may be news to many our readers that all preparations for writing an EA can be performed once and then used continuously.

Fallacies, Part 1: Money Management is Secondary and Not Very Important

The first demonstration of testing results of a strategy based on 0.1 lot is becoming a standard de facto in the Forum. Having received "not so bad" from professionals, a beginner sees that "0.1"...

Easy Way to Publish a Video at MQL4.Community

It is usually easier to show, than to explain. We offer a simple and free way to create a video clip using CamStudio for publishing it in forums.

An Expert Advisor Made to Order. Manual for a Trader

Not all traders are programmers. And not all of the programmers are really good ones. So, what should be done, if you need to automate your system by do not have time and desire to study MQL4?

Equivolume Charting Revisited

The article dwells on the method of constructing charts, at which each bar consists of the equal number of ticks.

MQL4 Language for Newbies. Custom Indicators (Part 2)

This is the fifth article from the series "MQL4 Languages for Newbies". Today we will learn to use graphical objects - a very powerful development tool that allows to widen substantially possibilities...