How to start with MQL5 - page 43

 

Forum on trading, automated trading systems and testing trading strategies

Moving Average

Sergey Golubev, 2024.07.14 18:04

Cascade Order Trading Strategy Based on EMA Crossovers for MetaTrader 5

Cascade Order Trading Strategy Based on EMA Crossovers for MetaTrader 5

In this article, we are demonstrating the Cascade Order Trading Strategy of Forex Trading Expert Advisor (EA) in MetaQuotes Language 5 (MQL5)  for MetaTrader 5. In this article of the MQL5 Expert Advisor using moving average crossovers as the basis for trading strategy, this MQL5 article automates trading choices on the MetaTrader 5 platform. This article incorporates essential features for position initialization, adjustment, and monitoring and makes use of the Trade.mqh library for effective order administration.


 

Introduction to MQL5 (Part 8): Beginner's Guide to Building Expert Advisors (II)

Having already studied the fundamentals of MQL5, you are now prepared to take on one of the most important tasks associated with algorithmic trading: creating a working Expert Advisor. As I indicated in the previous article, We will use a project-based approach for this series. This method helps in both comprehending abstract ideas and recognizing how they are used in practical situations. You will have a firm grasp of how to automate trading decisions based on candlestick patterns and predetermined conditions by the time you finish this guide.

In this article, we will focus on developing an EA that uses the candlestick analysis from the previous day to determine its trading direction. The EA will concentrate on selling for the day if the most recent daily candlestick is bearish and buying if it is bullish. The EA will also verify its trading signals by utilizing the close price of the day's first 1-hour candlestick. There won't be more than one open position at any given time, and the daily maximum of two trades will be enforced. It will function under stringent trade limits. Furthermore, its operation will be limited to the designated trading hours of Monday to Wednesday.
Introduction to MQL5 (Part 8): Beginner's Guide to Building Expert Advisors (II)
Introduction to MQL5 (Part 8): Beginner's Guide to Building Expert Advisors (II)
  • www.mql5.com
This article addresses common beginner questions from MQL5 forums and demonstrates practical solutions. Learn to perform essential tasks like buying and selling, obtaining candlestick prices, and managing automated trading aspects such as trade limits, trading periods, and profit/loss thresholds. Get step-by-step guidance to enhance your understanding and implementation of these concepts in MQL5.
 

Practicing the development of trading strategies 

A trading strategy is a fixed plan that is designed to achieve a profitable return by going long or short in markets. By combining various ideas, traders can develop their own strategies to meet their specific needs and style preferences.

The number of possible trading strategies is so large that even classifying them becomes a difficult task. However, there is a certain set of elements that most of trading strategies usually include.

An important step in creating a strategy is testing. Using the strategy tester, you can evaluate the features of a trading strategy, its advantages and disadvantages. If necessary, you make the necessary changes. In addition, the tester enables the selection of optimal strategy parameters that can improve trading results.
Strategy Testing - Algorithmic Trading, Trading Robots - MetaTrader 5 Help
  • www.metatrader5.com
The Strategy Tester allows you to test and optimize trading strategies ( Expert Advisors ) before using them for live trading. During testing, an...
 

Forum on trading, automated trading systems and testing trading strategies

Everything about RSI

Sergey Golubev, 2024.07.31 16:35

Creating a Dynamic Multi-Symbol, Multi-Period Relative Strength Indicator (RSI) Indicator Dashboard in MQL5 

Creating a Dynamic Multi-Symbol, Multi-Period Relative Strength Indicator (RSI) Indicator Dashboard in MQL5

In this article, we will guide you through the process of creating a dynamic multi-symbol, multi-period RSI (Relative Strength Index) indicator dashboard in MetaQuotes Language 5 (MQL5) for MetaTrader 5 (MT5). This comprehensive guide will explore the definition, functionality, and practical applications of a custom RSI dashboard, as well as the steps required to develop it using MetaQuotes Language 5 (MQL5).


 

Forum on trading, automated trading systems and testing trading strategies

Where Do I start from?

Sergey Golubev, 2024.09.06 07:54

Introduction to MQL5 (Part 9): Understanding and Using Objects in MQL5

Introduction to MQL5 (Part 9): Understanding and Using Objects in MQL5

This project aims to familiarize you with the useful applications of chart objects in MQL5. This practical approach will teach you how to manage trades, improve visual analysis, and display important trading data right on your charts by efficiently integrating and modifying chart objects within your Expert Advisor (EA). To help you better understand how to use these tools for trading decisions and performance tracking, this project will walk you through the process of creating, modifying, and managing various chart objects.

 

Forum on trading, automated trading systems and testing trading strategies

Where Do I start from?

Sergey Golubev, 2024.12.05 09:39

Introduction to MQL5 (Part 10): A Beginner's Guide to Working with Built-in Indicators in MQL5

Introduction to MQL5 (Part 10): A Beginner's Guide to Working with Built-in Indicators in MQL5

We will be developing a Relative Strength Index (RSI) EA in this article. One of the most used technical indicators in trading is the RSI. We'll build a tool that tracks market conditions and makes trades automatically by including this indicator in our EA. Although the Relative Strength Index (RSI) is the subject of this article, the ideas we'll discuss apply to most built-in indicators because they all operate on similar principles. Since this series is intended mostly for beginners, my main goal will be to keep the explanations and code as straightforward as possible. I know that for a novice, it is crucial to fully comprehend every stage of the process, including why certain code is written, what each component performs, and how the various parts work together.

 

Forum on trading, automated trading systems and testing trading strategies

Where Do I start from?

Sergey Golubev, 2025.01.22 06:54

Introduction to MQL5 (Part 11): A Beginner's Guide to Working with Built-in Indicators in MQL5 (II)

Introduction to MQL5 (Part 11): A Beginner's Guide to Working with Built-in Indicators in MQL5 (II)

Welcome back to our MQL5 series! We'll discuss a fascinating subject in this chapter that I believe you'll find very useful and fascinating. We looked at how to use MQL5's built-in indicators in the last chapter, paying particular attention to the RSI. Not only that, but we even worked on a practical project that showed you how to incorporate the RSI into your trading approach with ease. We're going one step further this time by including not one but three potent indications in our project (RSI, the Stochastic Oscillator, and the Moving Average). That's not all; you’ll also learn about the intriguing idea of hidden divergence detection through our project. We will specifically discuss how to spot hidden bullish and bearish divergences.

 

Master MQL5 from beginner to pro (Part II): Basic data types and use of variable

Master MQL5 from beginner to pro (Part II): Basic data types and use of variable

In my previous article we looked at the main programs that are used by MQL5 programmers (and came to the conclusion that the MetaEditor IDE is well suited for beginner needs). In addition, we took a quick look at the concept of a function and created a simple script that prints a message in the system log. These messages can be viewed at the bottom of the terminal window in the Experts tab.

Master MQL5 from beginner to pro (Part II): Basic data types and use of variable
Master MQL5 from beginner to pro (Part II): Basic data types and use of variable
  • www.mql5.com
This is a continuation of the series for beginners. In this article, we'll look at how to create constants and variables, write dates, colors, and other useful data. We will learn how to create enumerations like days of the week or line styles (solid, dotted, etc.). Variables and expressions are the basis of programming. They are definitely present in 99% of programs, so understanding them is critical. Therefore, if you are new to programming, this article can be very useful for you. Required programming knowledge level: very basic, within the limits of my previous article (see the link at the beginning).
 

Master MQL5 from Beginner to Pro (Part III): Complex Data Types and Include Files

Master MQL5 from Beginner to Pro (Part III): Complex Data Types and Include Files

This article is a continuation of the series for beginners. Here I assume that the reader already has an understanding of the material from the previous two articles.

The first article is an introduction. It assumes that the reader has no prior experience with programming, and introduces the required tools for programmers, describes the main program types, and introduces some basic concepts, in particular, the concept of a "function".

The second article describes operations with data. It introduces the concepts of "literal", "variable", "data type", "operator", etc., and examines the main data modification operators: arithmetic, logical, bitwise, and others

Master MQL5 from Beginner to Pro (Part III): Complex Data Types and Include Files
Master MQL5 from Beginner to Pro (Part III): Complex Data Types and Include Files
  • www.mql5.com
This is the third article in a series describing the main aspects of MQL5 programming. This article covers complex data types that were not discussed in the previous article. These include structures, unions, classes, and the 'function' data type. It also explains how to add modularity to your program using the #include preprocessor directive.
 

Forum on trading, automated trading systems and testing trading strategies

Where Do I start from?

Sergey Golubev, 2025.02.08 06:47

Introduction to MQL5 (Part 12): A Beginner's Guide to Building Custom Indicators

Introduction to MQL5 (Part 12): A Beginner's Guide to Building Custom Indicators

Welcome back to our MQL5 series! So far, we’ve covered a lot, including dealing with built-in indicators, creating Expert Advisors, exploring fundamental MQL5 concepts, and putting our knowledge to use through practical projects. It's time to advance by learning how to create a custom indicator from scratch. We'll gain a  more in-depth understanding of how indicators operate internally, allowing us complete control over their operation and design rather than depending on built-in features. Have you ever wondered how the Moving Average or MACD, two of MQL5's built-in indicators, are created? If there were no such functions as iRSI or iMA, could you still build indicators? 

Using a project-based approach, we will divide the process into two main parts. First, without utilizing the iMA function, we will build a Moving Average indicator entirely from scratch. Next, we'll go one step further and transform the Moving Average from the conventional line shape into a candle-style indication. In addition, this practical method will open up new avenues for developing trading tools that are specifically suited to your requirements.