Building your own forex robot

Author: AlexRU Date: 21.07.2017

Do you like the article? Share it with others - post a link to it!

building your own forex robot

Use new possibilities of MetaTrader 5. Trading on financial markets involves many risks including the most critical one - the risk of making a wrong trading decision. The dream of every trader is to find a trading robot , which is always in good shape and not subject to human weaknesses - fear, greed and impatience.

Each newcomer wants to get or create a clear and strict trading system that can be presented in the form of algorithms and completely get rid of routine operations. A trading system is a necessary condition for entering the market and that system should be profitable, of course. When newcomers come to the market, they are usually overwhelmed by the great mass of information difficult to grasp. Books and trader forums can provide some help in that case. Unfortunately, not all authors are successful traders and not all successful traders write books.

Many special web resources are created only to earn profit for their owners, as it is much more difficult to trade your own money than to issue forecasts and teach trading systems. Each trader should independently pass all stages of a trading system creation. There is a popular saying that it does not matter what system you use for trading, the main thing is that you should really trade according to that system.

Otherwise, trading on the market turns into a gamble with a predictable result. Forex market is believed to have a great liquidity. Also, it allows trading 24 hours a day, unlike many other markets.

Therefore, many traders try to make trading robots specially for Forex market, as it offers a large number of trading instruments. However, skeptics claim that all currency pairs are strongly correlated with each other providing very low volatility in the market. But their opponents respond that each currency pair has its own features and low volatility is compensated by a big leverage. In any case, Forex instruments are attractive for making trading robots and most supporters of the automated trading hone their skills on currency pairs.

MetaTrader 4 and MetaTrader 5 trading terminals are specially designed to easily develop automated trading systems but at the same time their interface is also convenient for manual trading. There are many approaches to building an automated trading system. We will describe only a few major ones. The first approach rests on math. A developer tries to create a sort of an equation that can consider many factors. This approach is based on the firm belief that price movements are managed by a model that can be found using available historical data.

The market is a pure abstraction, a type of an intellectual game for them. This approach usually leads to many years of study and development, while a definite result in the form of a working automated trading system is not so important. The second approach is based on studying the market laws.

No attempts are made to understand why the price goes up or down when various technical analysis figures appear on a chart.

Minesweeper

The advantage of this approach is that it requires no special knowledge of mathematics and makes no assumptions about the market driving force. It is most clear and convenient when studying trading. It is most popular among traders who received universal recognition. The disadvantage of the approach is the necessity to constantly track all necessary symbols. Sooner or later, a trader starts considering automation of trading processes and the most considerable issue appears at that stage — complexity of formalizing trading rules when trying to express them in the form of algorithms.

In some cases traders who try to order a trading robot cannot describe trading rules and find common ground with programmers. Creation of an automated trading system with the elements of the artificial intelligence is an exciting and challenging task even for newcomers, as it requires neither deep mathematical background, nor programming experience - everything is done using visual aids.

A trader should know the basics of technical indicators, possess an ability to prepare necessary price data and experience in some definite package for working with neural networks. The main drawback of this approach is that a trading robot obtained using such specialized tools for working with neural networks is actually a "black box".

Traders do not know its working principles and, generally, it is impossible to predict what market phase will be the most problematic for the robot. Programmers often choose the fourth approach — they start making a trading robot from the very beginning without spending time for manual trading.

building your own forex robot

You can make a robot spending a few months and reap the benefits of your efforts then. In most cases, programmers start creating all necessary infrastructure using a familiar programming language rather than just making a trading robot — getting and processing price data, visual representation of charts and indicators, custom means of testing strategies on historical data and so on. They gain much experience in the process.

But in most cases, that experience does not bring them closer to the final goal — creation of an automated trading system. And even if a trading robot is created, there is no guarantee that it will be profitable.

And what if a programmer wants to write another trading system?

Forex Daily Scalper: Main Page

Deep restructuring and new programming errors are inevitable. There is also the fifth approach — buying a ready-made trading system in the form of a trading robot. In this case, a trader acts as an operator or a tuner.

This approach saves much time no need to learn many new things and allows traders to quickly enter the world of the automated trading. The main drawback of this approach stems from its advantages — you don't know the operation principles of your trading robot and its structure.

And even if a seller has provided you with a detailed description of the implemented trading system, you will never be completely sure in it. However, neither of the mentioned approaches can give you absolute guarantee except a bank deposit. But that is not a very suitable solution for people interested in market trading and ways to increase their private assets. Each of the five described approaches has its advantages and corresponds to some definite type of trader. It is unlikely that you will choose the first approach market analytical description without good mathematical background.

It is equally unlikely that you will start from making trading robots based on neural networks. However, both of these approaches are very exciting and provide good intellectual exercise.

Below we will discuss only the second approach, which is already considered to be the classical one. That is the approach usually chosen by new followers of the automated trading, as the technical analysis remains the key knowledge area when learning trading basics.

Another advantage of the second approach is that after you spend some time for manual trading and obtain the sense of the market, you will already have a good understanding of technical analysis tools. Besides, you will be able to program trading strategies or create neural networks on a higher level. To make an automated trading system, you need programming skills and knowledge of all intricacies of trade requests processing.

But first you can start from the ready-made Expert Advisors — trading robots from the free Code Base library. Download any Expert Advisor trading robot and launch it in the Strategy Tester of MetaTrader 4 or MetaTrader 5 client terminals. Select a history interval showing a strong trend and an interval with a flat. Perform optimization of an Expert Advisor input parameters and examine their differences at these two intervals.

Launch an Expert Advisor with the optimal parameters for a flat on a trend interval and with the optimal parameters for a trend on a flat interval. Examine the differences in trading results, deals distributions and other statistical parameters. As a result, you will know how much the behavior of your trading system can vary when the market situation changes.

It would be better to try several standard trading strategies using this method on different parts of history and various symbols. Such a trial run prevents from fitting a trading system for some definite history interval and provides better understanding of trend and countertrend systems.

The next step would be to create more complex trading systems based on the combination of already existing simple signals from MQL5 Wizard set. You can test and develop your trading intuition sorting out bad signals of one system using a filter based on another system without programming means. The main thing here is not to overachieve. The more input parameters a trading system has, the easier it is to be fitted. There have been a lot of discussions about the differences between optimization and fitting.

There are no widely accepted solutions here.

Learn to identify the most critical input parameters affecting your trading system from the whole set of input data. Do not pay much attention to secondary parameters that take time during optimization but do not affect the very logic of the system.

Remember that a good trading system always demonstrates a small free motion of secondary parameters but it does not display dramatic volatility in case of inconsiderable market changes. You can spend as much time at this stage, as you wish, until you are sure that you can understand any trading strategy examining test and optimization results. The knowledge of strengths and weaknesses of standard systems will allow you to be better prepared when creating your own trading robot.

Several cases are possible here. First, you can examine several ready-made trading robots described in the articles to better understand programming intricacies. Second, you can ask questions on MQL4. Experienced community participants usually help the newcomers showing sincere interest in the subject. Third, you can order imrpovement or development of an Expert Advisor or an indicator in Jobs service , if you are not able to write a necessary program on your own.

But even if you make an order via the freelance service, you should have some idea about strategy testing to find a common language with a developer. Besides, basic knowledge of a programming language allows you to implement minor fixes and changes into the code after the work has been already completed.

After all, it would not be too convenient to call a programmer to fix every small issue you encounter. It would be much more easier and faster to fix it yourself. How to find your own trading strategy, or at least in what direction should you focus your search? All traders protect their own trading systems, if they have one. All newcomers want to create a profitable system or get a ready-made one. At the same time, any obtained solution seems to be too simple compared to newcomers' ideas about a genuine trading system.

Army men all over the world are prone to excessive levels of secrecy. There are many jokes about that including the following one: The situation with trading systems is similar enough: There are plenty of trader forums with limited access where participants join their efforts to develop or improve some secret trading systems.

Most interesting thing is that such systems do not contain anything special at all. Usually a well-known idea like "trade with the trend" is used as a basis. Then it is perfected with some new indicators unknown to general public. Therefore, you can easily take available trading robot source codes and try to use them correctly with various symbols and timeframes.

Another popular saying can be mentioned here: You just don't know how to cook them! The main thing here is to create a system using available ingredients.

Do not think that some geniuses have access to some secret systems from NASA laboratories. That is the secret of the Grail. So, why does no one use trading ideas, if they are literally within arm's reach? The answer probably lies in human psychology. The staff of many banks and large investment funds includes traders performing deals according to strict rules and within limited volumes. But for some reasons, only a few institutional traders leave their companies and start trading using their own money.

It turns out that you need not only a trading strategy but also the iron discipline to follow it. Many traders found out with regret that they also have the same psychological problems described in books. After realizing that the worst enemy of traders are themselves, a newcomer starts thinking about making a trading robot to eliminate a psychological burden.

Though I slightly deviate from the topic, I should mention the legendary Turtles traders who successfully traded on multiple markets in the late 20th century. Read "Way of the Turtle" and you will see that the most important thing for a trader is a self-discipline and not some top secret system. Alas, most newcomers will not be able to follow a profitable strategy, even if they get it for free.

The problem is that most trading strategies that are perfectly fitted for manual trading can hardly be formalized and transcribed to a programming language.

The strategies that can be easily formalized for example, those involving two moving averages' intersection are too simple and require a lot of refinements and improvements, so they can be used in practice. Thus, a simple idea is gradually complicated by a plenty of external parameters preventing a trading robot from false entries and errors clearly visible for a developer. A trading robot optimization issue emerges.

This process should not turn into an overoptimization and fitting for a particular history interval. To address this issue, the forward testing using the obtained system parameters has been implemented in MetaTrader 5 terminal. If the forward testing results do not significantly differ from the ones obtained in the optimization section, there is a probability that a trading robot will be stable enough for some time after its launch on a trading account.

A length of an interval for parameters optimization and an actual value of that "some time" depend on a certain trading system.

Thus, the optimization of a trading robot before launching it on a trading account reminds of unwinding a sling - the more carefully we have unwound and flung a projectile from the sling, the farther it will fly and the more accurate its trajectory will be.

A thoroughly developed trading robot will keep a positive result on a trading account for a longer time than a trading robot obtained as a result of a fitting. We can say that the Grail is a working idea and correct adjustment of parameters performed from time to time at the moments of market conditions changes. This can be illustrated by the results of the Automated Trading Championship that is held for many years already.

Submitted Expert Advisors of all the participants pass through automatic tests on the time interval from January to the end of July. The main requirement for passing the automatic test is a profit earned for eight months of testing. But less than a half of trading robots admitted for the Championship remain profitable after thee months of autonomous work.

You can also try your skills in making and adjusting your trading robot to take part in the Championship and get the forward testing results of your Expert Advisor. Besides, the participation is free and the awards are impressive. We hope to see you there! Professional intraday traders spend many hours sitting at their computers and waiting for the right moment to perform a deal. Of course, they cannot be in good shape all the time.

Most traders come to the conclusion that their actions violate their own trading rules. Not all trading systems can be completely formalized but even such systems can in most cases adopt additional tools, such as indicators, analytical systems and false signals filters. We do not make any special recommendations here concerning MQL4 or MQL5 languages learning, as there are a lot of other useful articles concerning that subject.

The purpose of this article was to provide some initial idea about how to start making your trading robot for MetaTrader 4 and MetaTrader 5 terminals. We hope that this article will save time for newcomers and show the right direction in the difficult task of developing an automated trading system. Translated from Russian by MetaQuotes Software Corp.

Forum on trading, automated trading systems and testing trading strategies. Trader Styles and Flavors based on dailyfx article. Fundamental Technical analysis is the art of studying past price behavior and attempting to anticipate price moves in the future.

These are traders that focus solely on price charts and often times incorporate indicators and tools to assist them. They look at price action, support and resistance levels, and chart patterns to create trading strategies that hopefully will turn a profit. Fundamental analysis looks at the underlying economic conditions of each currency. Traders will turn to the Economic Calendar and Central Bank Announcements. They attempt to predict where price might be headed based on interest rates, jobless claims , treasury yields and more.

Long-Term Deciding what time frame we should use is mostly decided by how much time you have to devote to the market on a day-to-day basis. The more time you have each day to trade, the smaller the time frame you could trade, but the choice is ultimately yours.

Due to the speed at which trades are opened and closed, short-term traders use small time-frame charts Hourly, 30min, 15min, 5min, 1min.

Common time frames used for this type of trading are Daily, 4-hour and hourly charts. Long-Term trading involves keeping trades open for days, weeks, months and possibly years. Weekly and Daily charts are popular choices for long term traders. If you are a part-time trader, it might be suitable to begin by trading long term trades that require less of your time.

Automated Discretionary trading means a trader is opening and closing trades by using their own discretion. They can use any of the trading styles listed above to create a strategy and then implement that strategy by placing each individual trade. The first challenge is creating a winning strategy to follow, but the second and possibly more difficult challenge is diligently following the strategy through thick and thin. The psychology of trading can wreak havoc on an otherwise profitable strategy if you break your own rules during crunch time.

Automated trading or algorithmic trading requires the same time and dedication to create a trading strategy as a discretionary trader, but then the trader automates the actual trading process. This has three main benefits. First, it saves the trader quite a bit of time since they no longer have to monitor the market as closely to input trades.

Second, it takes the emotions out of trading by letting a computer open and close trades on your behalf. This means you are following your strategy to the letter and are not able to deviate.

And third, automated strategies can trade 24 hours a day, 5 days a week giving your account the ability to take advantage of any opportunity that comes its way no matter the time of day. It a MUST READ article for all Freelance customers here before they press the New Job button, to minimize the arbitration procedure. This article serves to familiarize the reader with the empirical mode decomposition EMD method.

It is the fundamental part of the Hilbert—Huang transform and is intended for analyzing data from nonstationary and nonlinear processes. This article also features a possible software implementation of this method along with a brief consideration of its peculiarities and gives some simple examples of its use.

This article's objective is to study profitability of algorithms with different entries into trades and exits using trailing stop.

Entry types to be used are random entry and reverse entry. Stop orders to be used are trailing stop and trailing take. You have decided to study MQL5 trading strategies' programming language, but you know nothing about it?

We have tried to examine MQL5 and MetaTrader 5 terminal from the newcomers' point of view and have written this short introductory article. In this article, you can find a brief idea of the possibilities of the language, as well as some tips on working with MetaEditor 5 and the terminal. The major problem of applied statistics is the problem of accepting statistical hypotheses. It was long considered impossible to be solved. The situation has changed with the emergence of the eigen-coordinates method.

It is a fine and powerful tool for a structural study of a signal allowing to see more than what is possible using methods of modern applied statistics. The article focuses on practical use of this method and sets forth programs in MQL5. It also deals with the problem of function identification using as an example the distribution introduced by Hilhorst and Schehr.

MetaTrader 5 Examples Indicators Experts Tester Trading Trading Systems Integration Indicators Expert Advisors Statistics and analysis Interviews MetaTrader 4 Examples Indicators Experts Tester Trading Trading Systems Integration Indicators Expert Advisors Statistics and analysis. MetaTrader 5 — Examples. To Make a Trading Robot, You Need a Trading System Trading on financial markets involves many risks including the most critical one - the risk of making a wrong trading decision.

Trading Robots and Forex Forex market is believed to have a great liquidity. How to Start Making a Trading Robot? What is the Best Approach to the Automated Trading for a Trader? The First Steps in Making a Trading Robot To make an automated trading system, you need programming skills and knowledge of all intricacies of trade requests processing. No Need to Reinvent the Wheel How to find your own trading strategy, or at least in what direction should you focus your search?

Only a Few Will Make It Through So, why does no one use trading ideas, if they are literally within arm's reach? Conclusion Professional intraday traders spend many hours sitting at their computers and waiting for the right moment to perform a deal. All rights to these materials are reserved by MQL5 Ltd.

Copying or reprinting of these materials in whole or in part is prohibited. Last comments Go to discussion 2. Sergey Golubev 15 Feb at Syariful Anwar 8 Mar at Introduction to the Empirical Mode Decomposition Method This article serves to familiarize the reader with the empirical mode decomposition EMD method.

Money-Making Algorithms Employing Trailing Stop This article's objective is to study profitability of algorithms with different entries into trades and exits using trailing stop.

Fast Dive into MQL5 You have decided to study MQL5 trading strategies' programming language, but you know nothing about it? Application of the Eigen-Coordinates Method to Structural Analysis of Nonextensive Statistical Distributions The major problem of applied statistics is the problem of accepting statistical hypotheses.

Rating 4,3 stars - 299 reviews
inserted by FC2 system