Articles with examples of trading robot developed in MQL4

icon

An Expert Advisor is the 'pinnacle' of programming and the desired goal of every automated trading developer. Read the articles in this section to create your own trading robot. By following the described steps you will learn how to create, debug and test automated trading systems.

The articles not only teach MQL5 programming, but also show how to implement trading ideas and techniques. You will learn how to program a trailing stop, how to apply money management, how to get the indicator values, and much more.

Add a new article
latest | best
Price Action. Automating the Engulfing Pattern Trading Strategy
Price Action. Automating the Engulfing Pattern Trading Strategy

Price Action. Automating the Engulfing Pattern Trading Strategy

This article describes a process of creating an Expert Advisor for MetaTrader 4 based on the Engulfing pattern, as well as the pattern recognition principle, rules of setting pending orders and stop orders. The results of testing and optimization are provided for your information.
Price Action. Automating the Inside Bar Trading Strategy
Price Action. Automating the Inside Bar Trading Strategy

Price Action. Automating the Inside Bar Trading Strategy

The article describes the development of a MetaTrader 4 Expert Advisor based on the Inside Bar strategy, including Inside Bar detection principles, as well as pending and stop order setting rules. Test and optimization results are provided as well.
Common Errors in MQL4 Programs and How to Avoid Them
Common Errors in MQL4 Programs and How to Avoid Them

Common Errors in MQL4 Programs and How to Avoid Them

To avoid critical completion of programs, the previous version compiler handled many errors in the runtime environment. For example, division by zero or array out of range are critical errors and usually lead to program crash. The new compiler can detect actual or potential sources of errors and improve code quality. In this article, we discuss possible errors that can be detected during compilation of old programs and see how to fix them.
Expert Advisor Sample
Expert Advisor Sample

Expert Advisor Sample

The principles of MQL4-programs development are shown on sample of creating a simple Expert Advisor system based on the standard MACD indicator.
Applying fuzzy logic in trading by means of MQL4
Applying fuzzy logic in trading by means of MQL4

Applying fuzzy logic in trading by means of MQL4

The article deals with examples of applying fuzzy set theory in trading by means of MQL4. The use of FuzzyNet library for MQL4 in the development of an indicator and an Expert Advisor is described as well.
Orders Management - It's Simple
Orders Management - It's Simple

Orders Management - It's Simple

The article deals with various ways of how to control open positions and pending orders. It is devoted to simplifying of writing Expert Advisors.
Features of Experts Advisors
Features of Experts Advisors

Features of Experts Advisors

Creation of expert advisors in the MetaTrader trading system has a number of features.
Mechanical Trading System "Chuvashov's Triangle"
Mechanical Trading System "Chuvashov's Triangle"

Mechanical Trading System "Chuvashov's Triangle"

Let me offer you an overview and the program code of the mechanical trading system based on ideas of Stanislav Chuvashov. Triangle's construction is based on the intersection of two trend lines built by the upper and lower fractals.
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.
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.
Testing Features and Limits in MetaTrader 4
Testing Features and Limits in MetaTrader 4

Testing Features and Limits in MetaTrader 4

This article allows to find out more about features and limits of Strategy Tester in MetaTrader 4.
Enhancing the StrategyTester to Optimize Indicators Solely on the Example of Flat and Trend Markets
Enhancing the StrategyTester to Optimize Indicators Solely on the Example of Flat and Trend Markets

Enhancing the StrategyTester to Optimize Indicators Solely on the Example of Flat and Trend Markets

It is essential to detect whether a market is flat or not for many strategies. Using the well known ADX we demonstrate how we can use the Strategy Tester not only to optimize this indicator for our specific purpose, but as well we can decide whether this indicator will meet our needs and get to know the average range of the flat and trend markets which might be quite important to determine stops and targets of the markets.
Error 146 ("Trade context busy") and How to Deal with It
Error 146 ("Trade context busy") and How to Deal with It

Error 146 ("Trade context busy") and How to Deal with It

The article deals with conflict-free trading of several experts on one МТ 4 Client Terminal. It will be useful for those who have basic command of working with the terminal and programming in MQL 4.
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.
Research of Statistical Recurrences of Candle Directions
Research of Statistical Recurrences of Candle Directions

Research of Statistical Recurrences of Candle Directions

Is it possible to predict the behavior of the market for a short upcoming interval of time, based on the recurring tendencies of candle directions, at specific times throughout the day? That is, If such an occurrence is found in the first place. This question has probably arisen in the mind of every trader. The purpose of this article is to attempt to predict the behavior of the market, based on the statistical recurrences of candle directions during specific intervals of time.
Contest of Expert Advisors inside an Expert Advisor
Contest of Expert Advisors inside an Expert Advisor

Contest of Expert Advisors inside an Expert Advisor

Using virtual trading, you can create an adaptive Expert Advisor, which will turn on and off trades at the real market. Combine several strategies in a single Expert Advisor! Your multisystem Expert Advisor will automatically choose a trade strategy, which is the best to trade with at the real market, on the basis of profitability of virtual trades. This kind of approach allows decreasing drawdown and increasing profitability of your work at the market. Experiment and share your results with others! I think many people will be interested to know about your portfolio of strategies.
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.
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.
Considering Orders in a Large Program
Considering Orders in a Large Program

Considering Orders in a Large Program

General principles of considering orders in a large and complex program are discussed.