Trading Robot Development in MQL5
3.9 (44 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
243 students enrolled

Trading Robot Development in MQL5

Build your own technical indicators and algorithmic trading programs from scratch.
3.9 (44 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
243 students enrolled
Created by Samuel Williams
Last updated 4/2019
English [Auto]
Current price: $12.99 Original price: $19.99 Discount: 35% off
2 days left at this price!
30-Day Money-Back Guarantee
This course includes
  • 3 hours on-demand video
  • 14 downloadable resources
  • Full lifetime access
  • Access on mobile and TV
  • Assignments
  • Certificate of Completion
Training 5 or more people?

Get your team access to 4,000+ top Udemy courses anytime, anywhere.

Try Udemy for Business
What you'll learn
  • How to create technical indicators and algorithmic trading programs for Metatrader 5
  • An understanding of financial markets and how trading works.
  • An idea of order types, Stop Loss and Take Profit levels, as well as lot sizes.
  • An awareness of technical analysis and some of the popular indicators used.
  • You may find it easier if you have coding experience, but there is a programming basics section.


This course is a beginners course in coding trading programs and technical indicators for algorithmic trading. This could be in futures, stocks, commodities, crypto currencies and Forex.

This course teaches you how to code in MQL5 for the Metatrader 5 platform, this is a free platform with a huge support base and you don't even have to have a broker account to get started (it comes with it's own demo account!).

But crucially, the MQL5 network allows you to create products and sell them, trade and be followed (copy trading) or act as a freelancer (this is very well moderated!). So you don't have to have some magical all winning strategy to earn money, not if you know how to code in MQL5.

Despite the large support network, filled with tons of help, if you are new to programming it can all be a bit overwhelming. This course is designed to give you some basic programming skills to bring you up to speed (if you need it) and then to move on and create some programs!



Who this course is for:
  • A trader that would like to automate their strategies without paying someone else to do it.
  • A beginner programmer that would like to tap into the potential income opportunities MQL5 has to offer.
Course content
Expand all 35 lectures 02:50:38
+ Programming Basics
6 lectures 36:54

After watching this video you should have a basic understanding of how variables in programming work. This includes:

  • Types of variables (not all of them ... just the ones we need!) 

  • How to declare new variables

  • How to assign values to to variables

  • How to manipulate variables use them.


After watching this video, you will understand what Enumerations in programming are including:

  • How to create an Enumeration

  • How to use an Enumeration

  • See how Enumerations are widely used in the MQL5 language


After watching this video, you will know how loops work in programming in general and the different types of loop available in MQL5.

Preview 03:37

After watching this video you will understand how arrays work in programming and in MQL5 including:

  • How to create static and dynamic arrays

  • How to resize arrays

  • How to assign values into arrays and read arrays (this uses loops from the last video!)

  • How arrays work in MQL5 for price, volume and time data


In this video you will learn how to construct program logic through logical operators such as AND/OR using IF THEN statements.

Logical Operators

In this video you will learn how functions work in programming and MQL5, this includes:

  • How to create a function and how to create a function that returns a value of a specific type.

  • How to create a function with input parameters

  • How to call a function in our program

Preview 06:23
+ Technical Indicators: Disparity Index
4 lectures 18:23

In this video i will introduce you to the Disparity Index indicator outlined in the brief attached in this section.


In this video you will create your first indicator in MQL5!

Creating the indicator

Now that we have written the code for our indicator, this video will show you how to compile and test your indicator in Metatrader 5.

Testing the indicator

This bonus video will talk through some more indicator code including:

  • How to create dynamic color changing indicators

  • How to create indicators of different types such as histograms

  • How indicators buffers work

  • How to format the short name for a well presented indicator

This might be helpful for this section's assignment!

Supplementary - Indicators 101
Add some more features to our Disparity Index indicator
Enhance the Disparity Index code
1 question
+ Technical Indicators: Stochastic RSI
5 lectures 16:04

In this video you will see the next indicator you are going to make, the Stochastic RSI indicator.


In this video we will set up the indicator buffers using MQL5's setup system to define our inputs and buffers.

Initial set up

In this video we will bring in the RSI indicator that is available to us in MQL5 and start some indicator calculations.

Indicator Calculations Part 1

In this video we will finish off the indicator calculations and look at how we change the colors!

Indicator Calculations Part 2

In this video we will give our indicator a test drive!

Testing the Indicator
Now that we've had some experience of building an indicator from inbuilt MQL5 indicators, we can apply this to a new indicator, the Bollinger Bandwidth. This will also serve as a primer for the next section that will use Bollinger Bands in a trading program.
Bollinger Bandwidth Indicator
1 question
+ Robot: Bollinger Band Breakout
5 lectures 19:24

No introduction this time! we have the brief, it's time to get stuck in and setup the trading robot!

Setup and OnInit() function

In this video we take a look at the tick event handler function OnTick() and how we check for currently open trading positions.

OnTick() function and positions

In this video we look at a handy function that will enable us to only run our trading logic when a new bar appears on the chart instead of every new tick.

isNewBar() function

In this video we will write the logic that dictates the buy and sell signals for our program.

Trading logic

We finish up this indicator by writing the code to place buy and sell orders and to exit open positions.

Buy and Sell code
+ Section 6: Back testing and optimisation
3 lectures 18:02

Now that we've finished our trading program we are going to test it on historical data using Metatrader's back-testing capability.

Back testing our robot

This video will demonstrate the optimization abilities of Metatrader 5. We will optimize the input parameters of the program to yield the best results.


Now that we understand optimization, we will take a quick look at forward optimization.

Forward Optimization
So we created, tested and optimized our Bollinger breakout strategy. We found it works best for trending markets. Attached in this section is a brief that describes the requirements for a Bollinger bounce strategy for ranging markets. Your task is to build this robot to the specifications described.
Bollinger Bounce robot
2 questions
+ Robot: Moving Average Cross
8 lectures 51:55

We are going to make a new trading program! This time the brief is much more detailed and representative of what someone might ask you to do if you do freelancing work!


We will setup the input parameters of our new trading program, using code this time!

Setup and Input Parameters

In this video we will set up our Moving Average indicators in the OnInit() function and do some checks on the trading account to make sure all is in order!

OnInit() function and Account Checking

In this video we will set up the OnTick function and bring back the new bar function.

OnTick() and New Bar

As the brief has asked for different trade sizing settings, in this video we will write the code to determine the amount to trade. This will include:

  • Sizing trade size based on risk percentage

  • Sizing trade size based on free margin

  • Sizing trade size based on user input

Volume & Lot Sizing

In this video we will look at code to place buy and sell orders, this time using the Trade class in MQL5 for more power in less code!

Buy and Sell With Stops

Now that we have trade positions open, in this video we will look at how to code trailing stops based on what the user has selected as an option.

Position Modification - Trailing stops

And there we have it, in the blink of an eye you've coded two indicators and two trading programs and that's even without doing your homework. It's time to finish up and run the program!

Finish and Run
Ok so now you have created two technical indicators and two trading robots lets review some of the work we've done!
MQL5 is your oyster!
2 questions