Automating the Way you Trade by Programming a Forex Robot

keyboard programmer small

MetaTrader is the widely-used trading platform developed by MetaQuotes Software Corporation. It is a charting application designed for online trading for financial markets such as Stocks, Foreign Exchange, Futures, and more, but mostly it is offered by Forex brokers and used for Forex trading. To date, the two available versions of the platform are MetaTrader4 (MT4) and MetaTrader5 (MT5). MetaTrader became extremely popular because of its extendibility and has large catalog of default trading tools/indicators such as Bollinger Bands, CCI, MACD, Moving Averages, Stochastic Oscillator, etc. Traders at any level, from beginners to experts, can download the platform for free.  MT4/MT5 have an exceptional capability to support Scripts, Custom Indicators and automated trading systems or Expert Advisors (EAs).

The MT4 Client terminal uses its embedded programming language, MetaQuotes Language (MQL), for the development, enhancement, and customization of trading systems such as Indicators, EAs (trading robots), and Scripts. Based on C programming language, MQL is very simple and allows anyone with basic programming skills to develop his or her own trading system. Any trading method that can be described in algorithmic language can be programmed and used for live trading. Many of these trading systems are being distributed for free and many others are sold online. MQL4 (specific MetaQuotes Language for MT4) has hundreds of programming functions used for mathematical and logical operations, from basic to complex arithmetic,  as well as real-time and historical market data analysis. This trading platform also includes plenty of free Expert Advisors, Indicators and Oscillators which can be modified and enhanced.

What is an Expert Advisor (EA)?

Through MT4 programming, you can automate your manual trading method which can powerfully increase your trading opportunities. An EA automates your trading decisions and can do just about anything, from giving you a signal, to placing and managing the trade for you automatically.

A trading robot, or an EA, attached to an MT4 client terminal on a running internet-enabled computer, will monitor the markets for you every second on a 24/5 basis. Without any intervention, it can automatically handle all your trades according to your trading rules (that is, the trading rules that have been programmed into the robot). Unlike human traders, forex robots do not miss trading opportunities. It is able to open and close trades according to your trading strategy while you are engaged in some other activity.  You could be swimming in your pool or vacationing overseas—it is like having a full time employee who never sleeps and always follows the trading rules you have assigned. It executes trade orders directly to your MT4 Broker’s Server. It can also send trade notification messages to your mobile phone and can do many other useful things. Unlike other trading platforms, MT4 allows EA backtesting based on historical market price data.

Another benefit of creating your own EA is the ability of a forex robot to trade markets without any emotions. It follows all your trading rules—no matter what the market condition is. (Note: Sometimes this is not always a good thing though, as blindly trading during poor or unstable market conditions can lead to great loss.)  A trading robot won’t panic in a losing trade or be motivated by revenge after a huge loss. It won’t jump back in the markets after a big win to try and make more money. It plays out your rules without clouding up the trading process with emotions.

You also don’t need to be glued on your screen and analyze the right chart close enough for potential trade setups. Your EA gives you the power to monitor dozens of forex pairs at once with the ability to identify and react to trading opportunities immediately. It executes trades in a fraction of a second and profits even from sudden market movements.

What is a custom indicator?

A Custom Indicator is a technical indicator coded independently of an EA which is basically intended to help traders with their market data analysis. It can be added to the default MT4 indicators which are already installed in the platform. Unlike EAs, MT4 built-in custom indicators are not used to trade automatically. They are designed to help traders with on-chart analysis in order to find possible trading opportunities.

With the MQL4 programming language, the MT4 platform offers an exceptional opportunity for traders to create and add their own custom indicators into their MT4 client terminals. It’s not only for technical traders. If you are trading based on fundamental news only, you can load all relevant news events on your terminal, and create your own custom indicator and set alarms for the new events that you consider important.

The internet at large and the MQL4 community have plenty of custom indicators for MT4 for free. Built-in indicators can also be customized to meet different traders’ requirements.

What is an MQL4 script?

A Script is a short program code that is intended to perform a single action. It is the simplest type of MQL4 program.  Unlike an indicator and expert advisor that works continuously, a script only functions once. It stops after completing the task. A script is created, setup, and launched in the same manner as custom indicators and EAs.

An MT4 Script acts as a shortcut to perform a number of tasks on an MT4 platform such as closing all trades running on one currency, closing all trades running on the account, allowing you to set or edit all the stop loss and take profit orders at a set distance from the entry price, deleting all pending orders that are related to a currency pair, delete all pending orders, and many more. Depending on how it was programmed to execute the task, most scripts work by simply dragging and dropping onto the chart of the currency that needs the script’s function.  A script performs these tasks faster than manually doing each task repeatedly.

How to choose the best MQL4 programmer

You do not need to be an expert programmer to create your own EA, custom indicator, or script. The internet offers lots of MQL4 programmers that provide programming services for the MetaTrader trading platform. Various experts in the field of both trading and software development are available to maximize the quality of the job and minimize time required for building your EA. In order to successfully automate your trading, your trading system must clearly identify buy, sell, stop loss, and target profit rules. You must be able to clearly describe the conditions under which a trade will be initiated, and when the trade should be closed at profit or at loss.

keyboard programmer

The duty of your MT4 programmer in automating your trading system is very critical since it involves real money in the markets. A little programming mistake may result in a loss of money.  It is very important to hire the service of an excellent MQL4 programmer to ensure that you will get the trading software the way you envisioned it. Therefore, it is advisable to evaluate the following criteria:

  • Exceptional MQL4 programming capabilities – Of course, you must look for a highly skilled and experienced expert advisor and custom indicator programmer. The level of a programmer’s technical skills can be assessed through the samples of recent work. He or she must be able to build indicators and EAs from scratch based on clear specifications.
  • Good Communication Skills – Your programmer must have good interaction capabilities so that issues will not be misinterpreted. He must be a prompt communicator in discussing concerns. Excellent communication skills avoid delays caused by incorrect interpretation of trading algorithms. All your trading rules must be understood and coded perfectly.
  • Basic and Advanced Skills with Forex Trading – It is vital to a hire a programmer who knows how to trade currencies. He must have knowledge of MT4 broker execution issues and basic or even advanced skills in forex trading. He should be able to follow all your trading rules, as well as envision your programming requirements and needs.  He should be able to grasp your trading ideas immediately without the need to explain trading jargon.
  • Professionalism and Passion Towards Job – The programmer must be able to meet his own deadline, reply to emails on a timely manner, and ask help for clarification issues. The programmer must have an organized project development process in order to maximize the quality and minimize the time required for the project development. (These types of things you might not be able to see when first hiring, nor is it strictly necessary.)
  • clocks of different timesOnline Availability – Knowing your programmer’s time availability certainly helps keep good communication, which is very important during the development of the project. Depending on the country you live in, you may not be in the same time zone as your programmer.  This is not necessarily a problem and often is the case. You might be hiring a programmer from Eastern Europe while you live in Hong Kong, or maybe you live in the United States and are hiring a programmer from India.  This happens all of the time, and since most communication is done by email, it doesn’t make for a world of difference.  However, if you are the kind of person who needs to talk on the phone or on Skype about a project, you should make sure your programmer is in a time zone (or keeps hours) that is conducive to working together and completing the project.
  • Confidentiality – You and your programmer must have a solid agreement on all things such as financial and ownership rights. All confidential information that you disclose to your programmer will remain as your property. Your programmer shall agree not to disclose any confidential information about you and your trading strategy to third parties, and not to use any confidential information as a basis upon which to develop a competing or similar automated trading system.
  • Commitment – The programmer must be reliable and committed on working to the project. Most programmers charge in advance, and often this is unavoidable.  If the project is very large, you might be able to negotiate for 50% down and 50% payment upon completion.  Most programmers do not like to start work, however, before they receive complete payment in full.
  • Cost of their service – A programmer may charge you a reasonable price or fixed or hourly paid price. The price indicates the professionalism of the programmer. A professional programmer will not complete a serious programming job for $5 and a simple script for $1000.  It is often ‘You get what you pay for’ when it comes to programming services, though some programmers are simply more expensive than others.  The higher the price does not necessarily translate into higher quality, though this is often the case.
  • Feedback of real customers – Feedback and reviews from real people who have used the programmer in the past can share the truth on a programmer’s service. It is good to hire those that come from the positive recommendations of others. You can use sites like MyFXBook for reviews of some programmers, or if you are using sites like or then they have their own built-in review system.
  • Coding Support – The last, and most important, is your programmer’s support even after your automated trading system has been completed. He must be able to provide case-by-case MQL4 consulting services to assist with specific coding issues. The first version of a software will often have bugs—this is just the nature of software programming in general.  You should be kind in providing feedback but also ask for the work to be mended according to the rules of the initial agreement.  Bugs must be worked out and the programming work completed as agreed upon.

Before ordering an EA or a custom indicator from your chosen programmer, it is wise to ask some questions to a programmer to address the above criteria. Below is a list of ten questions that you should ask your programmer before starting work. You are not limited only to these questions.  You could also ask for more information regarding the automation of your specific trading strategy.

Questions you should ask your programmer ahead of time

1. What are the exact steps in hiring the programming service?

As a general step to hire a programming service, you need to contact the programmer and ask for a price quote on the specific project. You need to explain the EA requirements and provide complete details as to how they would be programmed.

After the complete requirements are laid out, the programmer will determine how much time it would take to complete a fully working EA, and how much the price will be. Some programmers require you to make a full or partial payment before the coding proceeds.  Each programmer is different, but as mentioned, most programmers will ask for the complete project payment up-front before any work begins.  However, if hiring using services like or, you will have more flexibility and often only need to pay once the project is completed.

2. What is the rate of the programming service?

The charge is commonly project-based and price depends on the complexity of the requirements. On average, fixed price projects can costs between 250USD to 700USD. On an hourly basis, an EA that requires 2 to 40 hours could cost 40USD to 50 USD per hour. Typically, large projects have lower discounted hourly rates.

3. How long will it take for the EA to be programmed?

It depends on the complexity of the project and the speed of the programmer. In most cases, experienced and professional EA programmers can finish an EA in less than 72 hours.  It will also depend on how many other active projects they have when your project begins.

4. What is the payment method for the service?

Payment methods may be through wire transfers or other online payment services like Skrill, PayPal, Western Union, and Money Bookers, and other methods.

5. Does the EA or the indicator programming have a 100% guarantee?

The EA or the indicator must work exactly as stated in your requirements.  You cannot ask for a guarantee when it comes to the results of your trading system, as this is not in the hands of your programmer.  What must be guaranteed is the precision of the programming itself—it must follow the rules that you laid out initially.

6. Are corrections of errors free of charge?

A programmer should let you test your EA once it was completed. Any errors on the programmer’s part should be fixed for free. Any change or additional functionality is of course subjected to additional charges.

7. Are there any standard EA features?

There are standard and ready-made features that come with every expert advisor and can be easily added to any trading system. These features are optional and can be added at no extra costs.  Discuss with your programmer about money management options.

8. In case of project withdrawal, is it possible to refund the payments?

Refunds are the discretion of the programmer.

9. Will you agree to sign a Non-Disclosure Agreement (NDA)?

To address confidentiality issues, you can supply your own NDA that must be signed by you and your programmer. The software and source code is your property and not to be resold or publicly redistributed by your programmer without prior agreement.

10. What if an error is found after 6 months of using the delivered EA?

Depending on the programmer, he may provide a lifetime warranty and continued support. Free updates, if necessary, may be available for an amount agreed upon.

What is a non-disclosure agreement (NDA)?

When you hire a programmer to write a program of your trading strategy, you need to disclose your proprietary trading strategy. An NDA is a signed legal contract between you and your programmer for the purpose of preventing the unauthorized disclosure of certain proprietary and confidential information. It prohibits the programmer from reselling your expert advisor or publishing your trading strategy, trade secrets, patents, trademarks, and any other intellectual property.  Furthermore, the trading software, as well as the source code, is your property.

signing a contract or agreement

The programmer has the sole responsibility to keep all confidential information in strictest confidence and not to be used in any form. Any third party must be restricted from having access to the information. Aside from the programmer, any third party that is directly involved in the development of the software—such as employees and contractors—shall be required to sign the Non-Disclosure Agreement as well.

The NDA must carefully define the confidential information that is subject to the agreement. Exceptions should be precisely defined such as: information generally known by the public, information that is already known by the programmer prior to your disclosure, information that was known by the programmer from a third party who is not bound by a confidential agreement, and information that is independently developed by the programmer.

The agreement shall remain in effect until the confidential information no longer qualifies as a trade secret. Termination of the agreement shall be specified by you within the NDA or until you send your programmer a written notice of NDA termination.

An NDA signed between you and your programmer maybe applicable in your country of residence, though it is not a guarantee that it will be enforceable in other countries. It also important to address which state’s (or country’s) law applies when interpreting the NDA. Defining the appropriate law and jurisdiction is really useful in case a dispute arises. It is also necessary to address where a dispute will be resolved in case the NDA is breached.

After your Expert Advisor is completed and released for your personal trading use, you must make sure that you have complete copyright of your trading robot. The copyright prevents the unauthorized use, distribution, and alteration of your EA without your consent. Unauthorized distribution and modification of a copyrighted work entails civil liability and is subjected to criminal sanctions

A well-crafted Non-Disclosure Agreement and the copyright law relating to it can provide you with legal remedies for improper disclosure or use of proprietary information. However, in the software industry, there are often unscrupulous parties who would abuse the information they are given. The agreements alone do not effectively stop third parties from potential disclosures. Thus, it is your responsibility to properly select the potential programmers that would receive your proprietary trading information. It is wise to confirm that such programmer(s) are professional and respected programmers in the field of forex trading. Sometimes you just need to take the risk in order to be able to move forward, but do so with good discretion and judgment.

Does it make sense to automate your trading strategy?

If your trading strategy has been proven effective, and you are able to trade it profitably yourself, then yes, it certainly can be automated.  Personally, I never manually traded the strategy that I turned into an automated trading solution, so it isn’t an absolute requirement.  If you have a good idea, and the funds to be able to build and test your idea, then go for it.  “Nothing ventured, nothing gained,” it could be said.  You will learn from your first programming experience.  No one, that I know of, got it right their first time.  As you develop your EA, you will learn and grow and gain very valuable experience from the investment.  Be frugal with your money and make sure that you have done all the research and testing that you can before sending the idea off to be programmed.

Personally I do not create bespoke applications anymore and focus only on my own projects. But I have several MQL4 programmers on my list that you can contact by submitting a price quote. Click here to request a price quote for MT4 programming services.

About the author

Rimantas Petrauskas

First I am a father, a husband and then the author of the book “How to Start Your Own Forex Signals Service”. I am also a Forex trader, a programmer, an entrepreneur, and the founder of Forex blog. I have created two of the most popular trade copiers and other trading tools for MT4 that are already used world wide by hundreds of currency traders.


Leave a comment

Leave a Reply to Rimantas Petrauskas Cancel Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Copyright © 2009-2020. Rimantas Petrauskas | Terms and ConditionsPrivacy PolicyEarnings Disclaimer
Trading foreign exchange on margin carries a high level of risk, and may not be suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with foreign exchange trading, and seek advice from an independent financial advisor if you have any doubts.
The purchase, sale or advice regarding a currency can only be performed by a licensed Broker/Dealer. Neither us, nor our affiliates or associates involved in the production and maintenance of these products or this site, is a registered Broker/Dealer or Investment Advisor in any State or Federally-sanctioned jurisdiction. All purchasers of products referenced at this site are encouraged to consult with a licensed representative of their choice regarding any particular trade or trading strategy. No representation is being made that any account will or is likely to achieve profits or losses similar to those discussed on this website. The past performance of any trading system or methodology is not necessarily indicative of future results.
Clearly understand this: Information contained in this product are not an invitation to trade any specific investments. Trading requires risking money in pursuit of future gain. That is your decision. Do not risk any money you cannot afford to lose. This document does not take into account your own individual financial and personal circumstances. It is intended for educational purposes only and NOT as individual investment advice. Do not act on this without advice from your investment professional, who will verify what is suitable for your particular needs & circumstances. Failure to seek detailed professional personally tailored advice prior to acting could lead to you acting contrary to your own best interests & could lead to losses of capital.

Copyright © 2009-2021. Rimantas Petrauskas | Terms and Conditions | Privacy Policy | Earnings Disclaimer
Malcare WordPress Security