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
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 III)
Expert Advisors Based on Popular Trading Systems and Alchemy of Trading Robot Optimization (Part III)

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

In this article the author continues to analyze implementation algorithms of simplest trading systems and introduces backtesting automation. The article will be useful for beginning traders and EA writers.
MetaEditor:Templates as a Spot to Stand On
MetaEditor:Templates as a Spot to Stand On

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.
Expert Advisors Based on Popular Trading Systems and Alchemy of Trading Robot Optimization (Part II)
Expert Advisors Based on Popular Trading Systems and Alchemy of Trading Robot Optimization (Part II)

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

In this article the author continues to analyze implementation algorithms of simplest trading systems and describes some relevant details of using optimization results. The article will be useful for beginning traders and EA writers.
Fallacies, Part 1: Money Management is Secondary and Not Very Important
Fallacies, Part 1: Money Management is Secondary and Not Very Important

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" testing brings rather modest results and decides to introduce an aggressive money management thinking that positive mathematic expectation automatically provides positive results. Let's see what results can be achieved. Together with that we will try to construct several artificial balance graphs that are very instructive.
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.
Expert Advisors Based on Popular Trading Systems and Alchemy of Trading Robot Optimization
Expert Advisors Based on Popular Trading Systems and Alchemy of Trading Robot Optimization

Expert Advisors Based on Popular Trading Systems and Alchemy of Trading Robot Optimization

This article dwells on implementation algorithm of simplest trading systems. The article will be useful for beginning traders and EA writers.
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.
Easy Way to Publish a Video at MQL4.Community
Easy Way to Publish a Video at MQL4.Community

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 MQL.community forums.
An Expert Advisor Made to Order. Manual for a Trader
An Expert Advisor Made to Order. Manual for a Trader

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?
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.
Equivolume Charting Revisited
Equivolume Charting Revisited

Equivolume Charting Revisited

The article dwells on the method of constructing charts, at which each bar consists of the equal number of ticks.
Betting Modeling as Means of Developing "Market Intuition"
Betting Modeling as Means of Developing "Market Intuition"

Betting Modeling as Means of Developing "Market Intuition"

The article dwells on the notion of "market intuition" and ways of developing it. The method described in the article is based on the modeling of financial betting in the form of a simple game.
MQL4 Language for Newbies. Custom Indicators (Part 2)
MQL4 Language for Newbies. Custom Indicators (Part 2)

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 of using indicators. Besides, they can be used in scripts and Expert Advisors. We will learn to create objects, change their parameters, check errors. Of course, I cannot describe in details all objects - there are a lot of them. But you will get all necessary knowledge to be able to study them yourself. This article also contains a step-by-step guide-example of creating a complex signal indicator. At that, many parameters will be adjustable which will make it possible to change easily the appearance of the indicator.
Displaying a News Calendar
Displaying a News Calendar

Displaying a News Calendar

This article contains the description of writing a simple and convenient indicator displaying in a working area the main economic events from external Internet resources.
Indicator Taichi - a Simple Idea of Formalizing the Values of Ichimoku Kinko Hyo
Indicator Taichi - a Simple Idea of Formalizing the Values of Ichimoku Kinko Hyo

Indicator Taichi - a Simple Idea of Formalizing the Values of Ichimoku Kinko Hyo

Hard to interpret Ichimoku signals? This article introduces some principles of formalizing values and signals of Ichimoku Kinko Hyo. For visualization of its usage the author chose the currency pair EURUSD based on his own preferences. However, the indicator can be used on any currency pair.
MQL4 Language for Newbies. Custom Indicators (Part 1)
MQL4 Language for Newbies. Custom Indicators (Part 1)

MQL4 Language for Newbies. Custom Indicators (Part 1)

This is the fourth article from the series "MQL4 Languages for Newbies". Today we will learn to write custom indicators. We will get acquainted with the classification of indicator features, will see how these features influence the indicator, will learn about new functions and optimization, and, finally, we will write our own indicators. Moreover, at the end of the article you will find advice on the programming style. If this is the first article "for newbies" that you are reading, perhaps it would be better for you to read the previous ones. Besides, make sure that you have understood properly the previous material, because the given article does not explain the basics.
Terminal Service Client. How to Make Pocket PC a Big Brother's Friend
Terminal Service Client. How to Make Pocket PC a Big Brother's Friend

Terminal Service Client. How to Make Pocket PC a Big Brother's Friend

The article describes the way of connecting to the remote PC with installed MT4 Client Terminal via a PDA.
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.
Trading Strategy Based on Pivot Points Analysis
Trading Strategy Based on Pivot Points Analysis

Trading Strategy Based on Pivot Points Analysis

Pivot Points (PP) analysis is one of the simplest and most effective strategies for high intraday volatility markets. It was used as early as in the precomputer times, when traders working at stocks could not use any ADP equipment, except for counting frames and arithmometers.
Automated Choice of Brokerage Company for an Efficient Operation of Expert Advisors
Automated Choice of Brokerage Company for an Efficient Operation of Expert Advisors

Automated Choice of Brokerage Company for an Efficient Operation of Expert Advisors

It is not a secret that for an efficient operation of Expert Advisors we need to find a suitable brokerage company. This article describes a system approach to this search. You will get acquainted with the process of creating a program with dll for working with different terminals.
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.
Automated Optimization of a Trading Robot in Real Trading
Automated Optimization of a Trading Robot in Real Trading

Automated Optimization of a Trading Robot in Real Trading

The articles describes and provides a library of functions that allows a trader to optimize his or her Expert Advisor's inputs by launching optimization directly from the EA.
Can the Forex Market Be Forecasted? How to Create One's Own Trading Strategy?
Can the Forex Market Be Forecasted? How to Create One's Own Trading Strategy?

Can the Forex Market Be Forecasted? How to Create One's Own Trading Strategy?

Everyone starting to work in Forex tries to answer these questions. But not everyone finds the answer, even after many years of hard work and search. I personally have answered this question, as well as many other questions of this article. As a result of these answers a way of creating an efficient trading strategy was determined.
Transferring an Indicator Code into an Expert Advisor Code. Conclusion
Transferring an Indicator Code into an Expert Advisor Code. Conclusion

Transferring an Indicator Code into an Expert Advisor Code. Conclusion

This is the final article, devoted to transferring an indicator code into an Expert Advisor code. Here the author transforms on a certain example a code of an Expert Advisor so, that this EA is presented in a single file without calling custom indicators.
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.
Transferring an Indicator Code into an Expert Advisor Code. General Structural Schemes of an Expert Advisor and Indicator Functions
Transferring an Indicator Code into an Expert Advisor Code. General Structural Schemes of an Expert Advisor and Indicator Functions

Transferring an Indicator Code into an Expert Advisor Code. General Structural Schemes of an Expert Advisor and Indicator Functions

This article dwells on the ways of transferring an indicator code into an Expert Advisor Code and on writing Expert Advisors with no calling to custom indicators, and with the whole program code for the calculation of necessary indicator values inside the Expert Advisor. This article gives a general scheme of Expert Advisor changing and the idea of building an indicator function based on a custom indicator. The article is intended for readers, already having experience of programming in MQL4 language.
Problems of Technical Analysis Revisited
Problems of Technical Analysis Revisited

Problems of Technical Analysis Revisited

At present, technical analysis along with the fundamental one is the most important method to analyze stock market. Being one of the predicting methods of stock market pricing dynamics, the technical analysis has a large amount of disadvantages that cast some doubt on its practical applicability.
Transferring an Indicator Code into an Expert Advisor Code. Indicator Structure
Transferring an Indicator Code into an Expert Advisor Code. Indicator Structure

Transferring an Indicator Code into an Expert Advisor Code. Indicator Structure

This article dwells on the ways of transferring an indicator code into an Expert Advisor Code and on writing Expert Advisors with no calling to custom indicators, and with the whole program code for the calculation of necessary indicator values inside the Expert Advisor. This article gives a general scheme of an indicator structure, emulation of indicator buffers in an Expert Advisor and substitution of the function IndicatorCounted(). The article is intended for readers, already having experience of programming in MQL4 language.
MetaTrader 4 Working under Antiviruses and Firewalls
MetaTrader 4 Working under Antiviruses and Firewalls

MetaTrader 4 Working under Antiviruses and Firewalls

The most of traders use special programs to protect their PCs. Unfortunately, these programs don't only protect computers against intrusions, viruses and Trojans, but also consume a significant amount of resources. This relates to network traffic, first of all, which is wholly controlled by various intelligent antiviruses and firewalls. The reason for writing this article was that traders complained of slowed MetaTrader 4 Client Terminal when working with Outpost Firewall. We decided to make our own research using Kaspersky Antivirus 6.0 and Outpost Firewall Pro 4.0.
Indicator Alternative Ichimoku – Setup, Examples of Usage
Indicator Alternative Ichimoku – Setup, Examples of Usage

Indicator Alternative Ichimoku – Setup, Examples of Usage

How to set up Alternative Ichimoku correctly? Read the description of parameters setting up. The article will help you understand the methods of setting up parameters not only of the indicator Ichimoku. Certainly you will also better understand how to set up the standard Ichimoku Kinko Hyo.
How to Make the Detection and Recovery of Errors in an Expert Advisor Code Easier
How to Make the Detection and Recovery of Errors in an Expert Advisor Code Easier

How to Make the Detection and Recovery of Errors in an Expert Advisor Code Easier

In Export Advisors development, the questions of code errors detection and recovery are very important. The peculiarity is that a not detected in time error may ruin a precious idea of a trading system already on the stage of its first testings. That is why any sensible EA developer takes into account such problems from the very beginning. This article dwells on some approaches, helping in this difficult matter.
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.
Practical Application of Cluster Indicators in FOREX
Practical Application of Cluster Indicators in FOREX

Practical Application of Cluster Indicators in 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 forming new currency trends, receive trade signals and follow medium-term and long-term positions.
Break Through The Strategy Tester Limit On Testing Hedge EA
Break Through The Strategy Tester Limit On Testing Hedge EA

Break Through The Strategy Tester Limit On Testing Hedge EA

An idea of testing the hedge Expert Advisors using the strategy tester.
Trading Using Linux
Trading Using Linux

Trading Using Linux

The article describes how to use indicators to watch the situation on financial markets online.
Filtering by History
Filtering by History

Filtering by History

The article describes the usage of virtual trading as an integral part of trade opening filter.
How Not to Fall into Optimization Traps?
How Not to Fall into Optimization Traps?

How Not to Fall into Optimization Traps?

The article describes the methods of how to understand the tester optimization results better. It also gives some tips that help to avoid "harmful optimization".
Universal Expert Advisor Template
Universal Expert Advisor Template

Universal Expert Advisor Template

The article will help newbies in trading to create flexibly adjustable Expert Advisors.
Principles of Time Transformation in Intraday Trading
Principles of Time Transformation in Intraday Trading

Principles of Time Transformation in Intraday Trading

This article contains the concept of operation time that allows to receive more even price flow. It also contains the code of the changed moving average with an allowance for this time transformation.