Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Algorithmic Trading in MetaTrader 5: Build Your First Bot
Rating: 4.2 out of 5(600 ratings)
6,084 students

Algorithmic Trading in MetaTrader 5: Build Your First Bot

Learn How To Code A Trading Bot From Scratch In The MQL5 Programming Language For MT5 + Trading Bot (Forex, CFDs ...)
Last updated 5/2026
English

What you'll learn

  • How to build a completely automated trading robot (expert advisor) that can trade in different markets (e.g. forex, crypto, indices, stocks, commodities)
  • How to program in the most popular language for trading in the financial markets (MQL5)
  • A well-known popular trading system
  • How to read and interpret the markets with algorithms
  • How to send, modify and close market orders
  • The basics of backtesting and optimization of trading robots in Metatrader 5

Course content

12 sections111 lectures10h 20m total length
  • Disclaimer0:10

    Explore the disclaimer around algorithmic trading in MQL5 and how to code robots to free up your time.

  • Course Files0:39
  • Why Upgrade To Algorithmic Trading4:10

    Discover how automated algorithmic trading uses backtesting on historical data with a simple moving average bot in MetaTrader 5 to test strategies, scale across charts, and free your time.

  • Expectations for the course1:29

    Set realistic expectations for algorithmic trading, noting variable income, no guaranteed profits, and risks, and learn to program, test on historical data, and deploy your own automated trading robots.

  • Welcome1:16

    Explore algorithmic trading in mql5 by building code robots and freeing up your time, guided by a two-part course with practical assignments and a final trading robot.

  • Algorithmic Trading Technologies1:08

    Explore MetaTrader 5 as a trading platform for forex, stocks, and futures, featuring a powerful strategy tester and broad assets, plus Mql5 and MetaEditor from MetaQuotes.

  • Download and Installation of MetaTrader 50:41
  • Introduction To Metatrader 514:43

    Explore MetaTrader 5 basics for algorithmic trading, including chart types, timeframes, market watch, symbols, and the strategy tester for back and forward tests.

  • MT5 Position Accounting Systems4:07

    Compare Metatrader 5 netting vs hedging position accounting, showing how netting merges positions per symbol while hedging creates independent positions with tickets that require specific closures.

  • Choosing a Broker or Trading Firm (i)3:06
  • Choosing a Broker or Trading Firm (ii)1:40
  • Connecting MT5 to the Broker8:09
  • MQL5 Applications1:31

    Explore MQL5 applications, including expert advisors, indicators, scripts, services, libraries and include files, and learn to code trading robots, perform technical analysis, and run chart-attached or one-off programs.

  • Introduction To Metaeditor7:47

    Explore the meta editor interface—top menu, navigator window, and toolbox window—to create files, compile scripts to x5 executables, and use autosuggestions and autocompletion.

  • Coding Our First Program3:53

    Create your first program and display hello world in Metatrader five by writing, compiling, and running a script on a chart while connecting to a demo account.

  • Syntax5:30

    Learn how to use the onstart event, create variables, and write expressions in mql5, with correct semicolon placement, and how the alert function displays messages in the terminal.

  • Identifiers4:28

    Learn how identifiers name functions and variables in MQL5, follow rules on max 63 characters, allowed characters (letters, digits, underscore), case sensitivity, and reserved words, using camel case for consistency.

  • Comments3:36

    Explore how comments organize code and explain decisions, using single-line comments with two slashes and multi-line comments with slash asterisk, to separate sections and guide teammates.

Requirements

  • Only requirement: willingness to learn
  • Trading knowledge is not required
  • Programming experience is not required

Description

In this course, you will learn how to fully automate your trading using MetaTrader 5 trading robots (expert advisors). We will code an expert advisor from scratch that can trade in different financial markets, such as forex, cryptocurrencies, indices, commodities, and stocks.

The course is organized into 2 blocks and 12 sections.


BLOCK 1: MQL5 PROGRAMMING LANGUAGE

In section 1, we will review the MetaTrader 5 (MT5) platform and introduce the MQL5 programming language and its applications.

In sections 2 to 5, we will cover the fundamentals of the MQL5 language. In these sections, we will address all the basic features of the language, with plenty of examples and exercises closely related to trading.

This way, the course will offer you practical, engaging, and interesting content while being concise to fast-track you to the most exciting part, sections 6 to 12.


BLOCK 2: METATRADER 5 EXPERT ADVISOR  CODING

This block begins with section 6, where we will introduce you to expert advisors and share a widely known trading system that has been extensively used in the past.

In sections 7 to 11, we will apply all the knowledge acquired in previous lessons to code a trading robot that automates a trading system and trades uninterrupted as long as the markets are open.

We will equip our expert advisor with a structure that serves as a framework for other projects, including triggers for entry and exit points.

Additionally, we will include basic aspects of position management, such as placing stop loss and take profit orders, as well as more advanced management like trailing stop loss and break-even.

Finally, in section 12, we will validate the system. To do this, we will subject the expert advisor to backtesting against historical data to ensure the code is correct.

Ultimately, we will deploy it in forex, stocks, indices, and commodities markets in a trading account. This will allow us to validate that the robot works both in a trading account and in simulation.



Now is the right time to learn algorithmic trading.

In today’s modern markets, the share of algorithmic trading in volume terms stands around 70-80 per cent, and there are several reasons for that:

  1. Algorithmic trading allows you to trade as many strategies or markets as your computing power provides, overcoming human limitations that constrain manual traders.

  2. Automating your strategies frees up time from repetitive screening of the markets that you can then allocate to research, leisure, or other activities. Furthermore, bots can trade 24/7 which mean they can trade any session, at any time and without rest, which is impossible to do for a single human.

  3. Emotionless and error-free. Algorithms read patterns and apply pre-established coded rules without experiencing fear or any other emotions, which means that robots do not commit mistakes, programmers do.

  4. Algorithmic trading will not only automate your trading, but also it is the first step to trade like a quant, which means that every decision you take will be backed by data and statistics that will be provided by your algorithms and this will increase your chances of success in the markets.

  5. Backtesting and optimization is much faster and comprehensive through algorithms than through manual means with spreadsheets, which will allows you to know the performance of a strategy in the past and, again, increase your chances of success in the markets.

Are you passionate about trading?

Do you want to free-up time from monitoring screens?

Do you want to increase your chances of winning in the markets?

If the answer is "Yes", and you are ready to put in the hard work, you are ready to start your algorithmic trading journey today!

This course is backed by Udemy’s 30 day money back guarantee.

If you're not happy for any reason you will be refunded in full!

I am confident that you will find this is one of the best courses to learn algorithmic trading and it delivers sharing insights that you won’t find easily elsewhere.

I am excited to watch you take your first step in your algorithmic trading journey and I hope to see you inside!

The expert advisor will be provided to you at the end of the course.


- José Martínez

Who this course is for:

  • Traders of any experience that desire to free-up their time from monitoring the charts
  • Traders who want to improve their trading performance through quantitative automated trading
  • Anyone who would like to learn how to program in MQL5 and similar programming languages like C++, C# or java