Latest News: Course Updated Again in July 2015 (MT4 Build 840+)
Learn to program in MQL4 and develop, test, and optimize your own algorithmic trading systems. This course assumes no prior programming or Forex knowledge, just a desire to learn and be successful
In the first section of this course we will install MetaTrader 4, open a free demo account, and learn the essential theory behind algorithmic trading.
The second section focuses on fundamentals of programming. Even if you have never programmed before, this part of the course will quickly bring you up to speed. Moreover, MQL4 is a C-based programming language and everything you learn in this section will also be applicable in languages like C / C++ / C# / Java / etc.
Section three introduces trading system design and gradually blends it with the programming knowledge you developed in section two. Here you will learn how to open your first order through a program also created by you, and how to then work with that order to modify or close it at your discretion.
Finally, everything is put together in the fourth section of the course, where we will come up with a unique trading strategy idea and turn it into a holistic Algorithmic Trading system. Also, I will briefly show you how to test and optimize your Forex Robot in the MetaTrader 4 strategy tester.
Enrol today and kick-start your Algorithmic Trading journey!
I'll see you inside
In this short video we will outline some of the topics covered in this free comprehensive course on MQL4 programming. In under 3 minutes we will briefly touch on some interesting aspects of the course, giving you an idea of what you can expect from this series of tutorials on Algorithmic Trading. In this course altogether there is 37 lectures, 3 quizzes, and over 6 hours of quality content! I look forward to taking this journey with you.
In this video I will show you how to install MetaTrader 4 build 600+ and open a free demo account without giving away any personal information! We will use this demo account in further tutorials to test our scripts and expert advisors. You can skip this tutorial if you already have a demo account.
IMPORTANT: Please make sure that in these tutorials you are practicing on a DEMO account. In the present course we will be creating scripts and other software which will carry out transactions on your account via the MetaTrader 4 trading platform. Therefore, you need to use a DEMO account for these educational purposes.
In this short video we will understand the basic principles that allow MetaTrader 4 and MetaEditor to work together. At a very high level I will explain how expert advisors, indicators and scripts are able to execute operations on the FOREX market.
Welcome to the first video-tutorial on MQL4 programming for complete beginners!
In this tutorial we will get to know the MetaEditor programming environment, get comfortable with the Graphical User Interface (GUI), and create our very own first MQL4-program! Exciting, isn’t it? This is a very basic tutorial to get you started.
After starting the video, click the maximise button to make it fullscreen and also watch in HD quality so you can see the code clearly!
In this second tutorial I will show you what variables look like in MT4. We will understand the concept of a variable being a box, where data is kept. Different types of boxes (variables) have the capacity to store different data. This notion is also discussed in the tutorial. We will look at the following types of variables:
In this tutorial I explain how to use basic MQL4 variables such integers, doubles, strings, and others. We also touch on simple operations: addition, subtraction, multiplication, and division. Finally, we learn how to concatenate strings. All illustrations are supported with working examples using the Alert() statement.
So, we have already learned about different types of variables including boolean variables. Today we will look at a variety of logical expressions. This is an important part of the decision-making process for automated trading system construction. In this short tutorial you will learn how to compare values using operators such as >, >=, <, <=, == and others, and assign and store the results in boolean variables. Let’s get straight into it!
And remember – if you have any questions, just leave a comment in the feedback form after the video or contact me personally! I am always happy to help out.
Hi there, I think that you will find this tutorial rather exciting! Why? Because today we will be looking your very first while loop! If you have never ever used loops before, then don’t worry – I will explain everything in detail and as usual we will see how it all works in practice. However, if you are new to programming, I recommend paying detailed attention and making sure that you understand this tutorial before moving on with the course. Feel free to ask any questions – I am here to help. PS: questions can be posted in the comments section after the video.
Hello there! Today’s tutorial is very short – in just over 3-minutes we will get to know how to use multi-line commentary in MQL4. Believe me – it is very easy! At the same time, as you will see multi-line comments are a very powerful tool and can make your programming experience so much more pleasurable: instead of deleting whole blocks of code you can use multi-line comments to “hide” these block away. Commented code will even change colour to show that it will not be executed.
The “for” loop is very similar to the “while” loop, however the “for” loop is much more commonly used. This trend is evident in other programming languages as well as in MQL4. Most likely, the “for” loop is preferred because it is more convenient. In today’s tutorial I will show you how the two loops compare to each other, and you can then decide for yourself which you prefer. Both are equally valid approaches..
Actually, this happens quite a lot in programming. Often, you can implement the same thing in two (or more) different ways, and only your personal preference will guide you to pick one. This is totally normal. Moreover, this is how people develop their ownprogramming styles, which is natural. So congratulations! Today you are making your first step towards developing your personal unique coding style.
Finally! Today we are going to apply our knowledge to the Forex market and work with some real-time EURUSD prices. Very exciting stuff!
We will learn about the if statement and see how we can use it to add decision-making processes to our future FX Robots. Note that the next couple of tutorials will be building on top of this one, so make sure you follow the code in the video carefully! Luckily, in this course we learn by doing, so if you do happen to make an error somewhere – you will be able to pick it up right away. Otherwise, If you run into trouble – why not leave me a comment with your question?
The Else statement complements the if statement, and together the two work hand-in-hand. Just like in the previous tutorial, in this video we will study the new bit of information through a real-life example. You will learn how easy it is to simulate trading decisions in a price channel using the if and else statements. Let’s do it!
Today we will finish up with conditional (branching) statements by looking at the else ifstatement. It all really comes together in this tutorial. Detailed visualisations of a EURUSD chart are used to illustrate how the implemented logic would be used in an Algorithmic Trading. You will notice from this video that we are actually looking at a thebackbone of a real working trading strategy! Psssstt: by the end of this course you will be able to build the whole strategy start to finish! Isn’t that exciting?!
The Switch Operator is a handy tool for implementing lengthy conditional statements. However, from the previous three tutorials we already know a very simple tool for doing the same thing – multiple “if”, “else if”, and “else” statements. Now this alternative may not be as elegant as using the Switch operator, but it is simpler. Having that in mind, consider this tutorial optional. Do watch it if you would like to learn some extra information, otherwise feel free to skip straight to the next one! After all, you can always revisit any of the videos at a later stage.
In this video we will recap what was discussed in this Core MQL4 section of the course. It is highly advisable that you know well all of this material, because it will be required in the next section. Don’t forget to do the quiz!
I look forward to seeing you on the next tutorial. Any feedback is appreciated!
Some really quick multiple choice questions to help you recap what we learned in this section.
There is one question for each lecture except for the one about the Switch operator.
Hello there! Today we will be looking at some examples of how you would use price levels in an Algorithmic Trading System. In fact, this approach can be used in manual trading strategies as well. The stuff we will be working with today is very basic, so you will find it very simple. At the same time, easy strategies are the best to practice programming for financial markets.
There won’t be any coding in today’s tutorial, so you can just watch it in relaxed mode We will turn one of the underlying strategies into code next time.
Welcome back! In this tutorial we will take one of the strategies we discussed last time and turn into into an MQL4 program.
Also, another important aspect of today’s lesson is – incorporating trader input. We will work with extern variables, which will allow us to create parameters for the trader. In that way the trader can control the script directly from the MetaTrader 4 Forex Platform.
Extern variables will come in very handy when we start coding our expert advisor. So pay attention today!
Spoiler alert: today will be an extremely exciting tutorial! For the first time in this course we will execute a market order!
If you include the Intro videos, then we’ve had nearly 20 lessons, so I think that we deserve to finally send a market order.
We’re going to jump straight into it, so hold on tight!
Today we are going to talk about a fundamental cornerstone of any programminglanguage – functions.
To execute a market order in the past tutorial we used the OrderSend() function. Well,MQL4 has many more other functions which we will be using throughout this course. Therefore, it is important to understand what functions are and how they work.
In this tutorial I will even show you how to create functions of your own. After you create your first function everything will fall into place and the next couple of tutorials in this course will seem like a piece of cake!
Have you ever had problems with computer software? Perhaps a program crashed while you were working in it, and you lost a lot of information or had to redo work? Well, can you imagine if that happens to an FX-Robot? If a program (script / expert advisor) crashes while trading on the Forex market, the consequences can be catastrophic!
That’s why in today’s tutorial we will learn how to create fail-safe blocks of code which willprotect the trader using our programs in the event of a malfunction. Today we will discuss the minimal error-handling that you would want to add to your programs. For more on this topic, check out my premium course Algorithmic Trading For Success!
In Tutorial 15 we learned how to open market orders from within Algorithmic Trading Systems. Closing orders is equally important and today I will show you how it’s done.
Also, we will further continue working with order ticket numbers. This skill of handling tickets will come in useful when we start programming expert advisors in section 3 of this course.
We have already discussed how to open and close market orders through a FOREX robot. Today we will learn how you can get your Algorithmic Trading system to adjust market orders. In order to do this you will need to use the OrderModify() function.
Modifying market orders is used to adjust the StopLoss (e.g. trailing stoploss),TakeProfit, and other parameters of the orders. In many trading systems it is imperative to modify existing market orders and that is why I have included this topic in this basic course.
Note that in this beginners course we will not be working with pending orders. If you want to learn about pending orders (such as Buy-Limit, Sell-Limit, Buy-Stop, and Sell-Stop) then look at my premium course Algorithmic Trading For Success.
How do we track market orders? Manually it’s easy – you just look at the information provided at the bottom of the terminal. But what if we want to do it from inside a Forex-robot?
Well, it’s also pretty simple – we just need to use the OrderSelect() function to select the order and then we are able to use a range of functions to find out additional information about our order. Today I will show you how to use OrderSelect(), OrderStopLoss(), OrderTakeProfit().
Also, I will give you an extremely useful tip on how to check if an order has been closed or not using the OrderCloseTime() function. This part will be very important when we get to coding our Expert Advisor in Section 3 of the course.
In this brief tutorial we will recap on all of the knowledge gained in Section 3: System design and trading functions.
In this section we covered off some important topics such as how to design basic trading systems, how to incorporate trader input in algorithmic trading systems, what functions are and how to build your own functions. Also, we talked extensively about the followingtrading functions: OrderSend(), OrderClose(), OrderModify().
Finally, we discussed how to get information on market orders through OrderSelect() and assisting functions. We will need all of this knowledge in our next section, so please make sure that you are quite comfortable with everything we have learned up until now.
Some really quick multiple choice questions to help you recap what we learned in this section.
There are two question for each lecture.
In this tutorial we will introduce a new type of program in MQL4 – expert advisors.
In essence, expert advisors (EA’s) are your Forex robots. There are some key differences between expert advisors and scrips, and we will discuss them in this tutorial.
Also, we will create our first test EA and see how it works in the MetaTrader 4 trading terminal.
Source code below video. Important: remember that this is no longer a script – it’s an expert advisor now, and therefore you need to select the associated option in when using the MetaEditor Wizard.
Developing a trading strategy is a very important part of any Algorithmic Trading System (Forex Robot). In fact, it is the basis!
You can’t just go and start programming a system not knowing what you want to get in the end. Sure, your goals may change in the process. However, always before you start you should have a plan in mind or even better – on a piece of paper.
That is why today and in the next two tutorials we will have a short break from programming and focus on developing our trading strategy. In this tutorial we will learn about different types of rule-based decisions, which you might consider for your Algorithmic Trading System.
In today’s tutorial we will brainstorm and together come up with a trading strategy idea for the GBPUSD. I think it’s important to enjoy what you program in MQL4, and therefore instead of coding something generic in the upcoming tutorials, we will be working on this really cool trend retracement idea. Look inside to find out more!
Interested in Automated Trading System design? Well this tutorial is exactly what you need to improve your skills!
Today we will turn our Forex trading idea into a holistic trading strategy. Moreover, we will put it all into a fancy looking diagram to help our programming down the track, and I will show you how this is done too!
The preparation stage is complete and today we will finally start programming our FOREX Robot in MQL4. We will start by completing the blue section of the trading strategy design template, which is responsible for time of day controls. If you recall we want our expert advisor to send buy and sell orders only once at a certain hour of every day. That is exactly what we will implement today.
Today we will continue coding the Simple System expert advisor. In this tutorial we will program the core of our Algorithmic Trading System.
We will use the OrderSend() function to send Buy and Sell orders to the market based on which way the price has moved. To check the price we will be using the Open array, which Metaeditor provides for us.
In this video we will complete our Forex Robot by adding market exit conditions to it. Specifically, we want to close any existing orders before we the Algorithmic Trading System opens new ones. This way we will make sure that there is only one open order at any given time, therefore limiting our currency risk and exposure.
Feel free to leave me some feedback if you have any questions on the code or if you just like my tutorials!
Today we will learn the very basics of backtesting. We will practice using the Metatrader Strategy Tester and see how we can optimize the expert advisor which we have created. We will find two different sets of parameters, which will both be profitable in the backtest.
Please note: do not use this expert advisor for trading on your real account. This Forex robot has been developed exclusively for educational purposes.
In this tutorial we will add the moving average indicator as an additional market entry condition to our trading strategy. To do this we will use the iMA() function which is built-in into MQL4. Functions such as iMA, iMACD, iRSI and many others allow you to quickly access the Moving Average, MACD, RSI and other indicators from within your Algorithmic Trading Systems. In this beginners course we will only touch on the iMA() briefly, but that should be enough for what we need in our trading system.
Welcome back to our Series of Tutorials! Today we are going to compare how our algorithmic trading system performs before and after adding the Moving Average entry filter. This will allow us to evaluate the effectiveness of this filter. Then we will learn how to optimise the filter for a given set of parameters. Do you think we can boost the result of our system by an extra 5% ?? Well let’s find out!
In this short tutorial we will summarize everything we learned in the previous section called “Putting it all together”. Looking back you will see how we first came up with an idea, then put that idea into a diagram, then programmed the algorithmic trading systemstep-by-step, making sure that everything works correctly every time, and finally we back-tested our algorithmic trading system, added a moving average filter, and even optimizedthis filter to get the maximum profit!
IMPORTANT: I just wanted to stress one more time that the expert advisor from this course is only for educational purposes. If you choose to use it on any account, then you are doing so at your own risk. Forex trading carries substantial risks, and you could lose all of your investment.
A series of brief multiple choice questions to help you revise what we learned in this section.
I should warn you! This quiz is tough and you have to be on your A-Game this time.
In this tutorial I will suggest some next steps which you may consider taking to further improve your MQL4 programming and algorithmic trading skills.
I am currently working on more FREE as well as Premium courses. Once published they will be available through this page: http://www.forexboat.com/courses/
It has been a pleasure learning together and I look forward to seeing you at the next series of lectures. Until then – happy coding!
My name is Kirill Eremenko and I am super-psyched that you are reading this!
I teach courses in two distinct Business areas on Udemy: Data Science and Forex Trading. I want you to be confident that I can deliver the best training there is, so below is some of my background in both these fields.
Professionally, I am a Data Science management consultant with over five years of experience in finance, retail, transport and other industries. I was trained by the best analytics mentors at Deloitte Australia and today I leverage Big Data to drive business strategy, revamp customer experience and revolutionize existing operational processes.
From my courses you will straight away notice how I combine my real-life experience and academic background in Physics and Mathematics to deliver professional step-by-step coaching in the space of Data Science. I am also passionate about public speaking, and regularly present on Big Data at leading Australian universities and industry events.
Since 2007 I have been actively involved in the Forex market as a trader as well as running programming courses in MQL4. Forex trading is something I really enjoy, because the Forex market can give you financial, and more importantly - personal freedom.
In my other life I am a Data Scientist - I study numbers to analyze patterns in business processes and human behaviour... Sound familiar? Yep! Coincidentally, I am a big fan of Algorithmic Trading :) EAs, Forex Robots, Indicators, Scripts, MQL4, even java programming for Forex - Love It All!
To sum up, I am absolutely and utterly passionate about both Data Science and Forex Trading and I am looking forward to sharing my passion and knowledge with you!
We are the ForexBoat team. You will find us in the Forex courses by Kirill Eremenko - we are here to help you out with any questions and make sure your journey through the courses is always smooth sailing!
The best way to get in touch is to post a discussion in the Q&A of the course you are taking. In most cases we will respond within 24 hours.
We're passionate about helping you enjoy the courses!
See you in class,
The Real People at ForexBoat