Articles with examples of trading robots developed in MQL5

icon

An Expert Advisor is the 'pinnacle' of programming and the desired goal of every automated trading developer. Read the articles in this section to create your own trading robot. By following the described steps you will learn how to create, debug and test automated trading systems.

The articles not only teach MQL5 programming, but also show how to implement trading ideas and techniques. You will learn how to program a trailing stop, how to apply money management, how to get the indicator values, and much more.

Add a new article
latest | best
preview
Neural Networks in Trading: Using Language Models for Time Series Forecasting

Neural Networks in Trading: Using Language Models for Time Series Forecasting

We continue to study time series forecasting models. In this article, we get acquainted with a complex algorithm built on the use of a pre-trained language model.
preview
Automating Trading Strategies in MQL5 (Part 6): Mastering Order Block Detection for Smart Money Trading

Automating Trading Strategies in MQL5 (Part 6): Mastering Order Block Detection for Smart Money Trading

In this article, we automate order block detection in MQL5 using pure price action analysis. We define order blocks, implement their detection, and integrate automated trade execution. Finally, we backtest the strategy to evaluate its performance.
preview
Neural Networks in Trading: Lightweight Models for Time Series Forecasting

Neural Networks in Trading: Lightweight Models for Time Series Forecasting

Lightweight time series forecasting models achieve high performance using a minimum number of parameters. This, in turn, reduces the consumption of computing resources and speeds up decision-making. Despite being lightweight, such models achieve forecast quality comparable to more complex ones.
preview
Creating a Trading Administrator Panel in MQL5 (Part IX): Code Organization (I)

Creating a Trading Administrator Panel in MQL5 (Part IX): Code Organization (I)

This discussion delves into the challenges encountered when working with large codebases. We will explore the best practices for code organization in MQL5 and implement a practical approach to enhance the readability and scalability of our Trading Administrator Panel source code. Additionally, we aim to develop reusable code components that can potentially benefit other developers in their algorithm development. Read on and join the conversation.
preview
Feature Engineering With Python And MQL5 (Part III): Angle Of Price (2) Polar Coordinates

Feature Engineering With Python And MQL5 (Part III): Angle Of Price (2) Polar Coordinates

In this article, we take our second attempt to convert the changes in price levels on any market, into a corresponding change in angle. This time around, we selected a more mathematically sophisticated approach than we selected in our first attempt, and the results we obtained suggest that our change in approach may have been the right decision. Join us today, as we discuss how we can use Polar coordinates to calculate the angle formed by changes in price levels, in a meaningful way, regardless of which market you are analyzing.
preview
Neural Networks in Trading: Reducing Memory Consumption with Adam-mini Optimization

Neural Networks in Trading: Reducing Memory Consumption with Adam-mini Optimization

One of the directions for increasing the efficiency of the model training and convergence process is the improvement of optimization methods. Adam-mini is an adaptive optimization method designed to improve on the basic Adam algorithm.
preview
Build Self Optimizing Expert Advisors in MQL5 (Part 5): Self Adapting Trading Rules

Build Self Optimizing Expert Advisors in MQL5 (Part 5): Self Adapting Trading Rules

The best practices, defining how to safely us an indicator, are not always easy to follow. Quiet market conditions may surprisingly produce readings on the indicator that do not qualify as a trading signal, leading to missed opportunities for algorithmic traders. This article will suggest a potential solution to this problem, as we discuss how to build trading applications capable of adapting their trading rules to the available market data.
preview
Automating Trading Strategies in MQL5 (Part 5): Developing the Adaptive Crossover RSI Trading Suite Strategy

Automating Trading Strategies in MQL5 (Part 5): Developing the Adaptive Crossover RSI Trading Suite Strategy

In this article, we develop the Adaptive Crossover RSI Trading Suite System, which uses 14- and 50-period moving average crossovers for signals, confirmed by a 14-period RSI filter. The system includes a trading day filter, signal arrows with annotations, and a real-time dashboard for monitoring. This approach ensures precision and adaptability in automated trading.
preview
Automating Trading Strategies in MQL5 (Part 4): Building a Multi-Level Zone Recovery System

Automating Trading Strategies in MQL5 (Part 4): Building a Multi-Level Zone Recovery System

In this article, we develop a Multi-Level Zone Recovery System in MQL5 that utilizes RSI to generate trading signals. Each signal instance is dynamically added to an array structure, allowing the system to manage multiple signals simultaneously within the Zone Recovery logic. Through this approach, we demonstrate how to handle complex trade management scenarios effectively while maintaining a scalable and robust code design.
preview
Build Self Optimizing Expert Advisors in MQL5 (Part 4): Dynamic Position Sizing

Build Self Optimizing Expert Advisors in MQL5 (Part 4): Dynamic Position Sizing

Successfully employing algorithmic trading requires continuous, interdisciplinary learning. However, the infinite range of possibilities can consume years of effort without yielding tangible results. To address this, we propose a framework that gradually introduces complexity, allowing traders to refine their strategies iteratively rather than committing indefinite time to uncertain outcomes.
preview
Price Action Analysis Toolkit Development (Part 9): External Flow

Price Action Analysis Toolkit Development (Part 9): External Flow

This article explores a new dimension of analysis using external libraries specifically designed for advanced analytics. These libraries, like pandas, provide powerful tools for processing and interpreting complex data, enabling traders to gain more profound insights into market dynamics. By integrating such technologies, we can bridge the gap between raw data and actionable strategies. Join us as we lay the foundation for this innovative approach and unlock the potential of combining technology with trading expertise.
preview
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)

Discover how to develop an Expert Advisor (EA) in MQL5 using multiple indicators like RSI, MA, and Stochastic Oscillator to detect hidden bullish and bearish divergences. Learn to implement effective risk management and automate trades with detailed examples and fully commented source code for educational purposes!
preview
Neural Networks in Trading: Spatio-Temporal Neural Network (STNN)

Neural Networks in Trading: Spatio-Temporal Neural Network (STNN)

In this article we will talk about using space-time transformations to effectively predict upcoming price movement. To improve the numerical prediction accuracy in STNN, a continuous attention mechanism is proposed that allows the model to better consider important aspects of the data.
preview
Integration of Broker APIs with Expert Advisors using MQL5 and Python

Integration of Broker APIs with Expert Advisors using MQL5 and Python

In this article, we will discuss the implementation of MQL5 in partnership with Python to perform broker-related operations. Imagine having a continuously running Expert Advisor (EA) hosted on a VPS, executing trades on your behalf. At some point, the ability of the EA to manage funds becomes paramount. This includes operations such as topping up your trading account and initiating withdrawals. In this discussion, we will shed light on the advantages and practical implementation of these features, ensuring seamless integration of fund management into your trading strategy. Stay tuned!
preview
Neural Networks in Trading: Dual-Attention-Based Trend Prediction Model

Neural Networks in Trading: Dual-Attention-Based Trend Prediction Model

We continue the discussion about the use of piecewise linear representation of time series, which was started in the previous article. Today we will see how to combine this method with other approaches to time series analysis to improve the price trend prediction quality.
preview
Chaos theory in trading (Part 1): Introduction, application in financial markets and Lyapunov exponent

Chaos theory in trading (Part 1): Introduction, application in financial markets and Lyapunov exponent

Can chaos theory be applied to financial markets? In this article, we will consider how conventional Chaos theory and chaotic systems are different from the concept proposed by Bill Williams.
preview
Price Action Analysis Toolkit Development (Part 7): Signal Pulse EA

Price Action Analysis Toolkit Development (Part 7): Signal Pulse EA

Unlock the potential of multi-timeframe analysis with 'Signal Pulse,' an MQL5 Expert Advisor that integrates Bollinger Bands and the Stochastic Oscillator to deliver accurate, high-probability trading signals. Discover how to implement this strategy and effectively visualize buy and sell opportunities using custom arrows. Ideal for traders seeking to enhance their judgment through automated analysis across multiple timeframes.
preview
Neural Networks in Trading: Piecewise Linear Representation of Time Series

Neural Networks in Trading: Piecewise Linear Representation of Time Series

This article is somewhat different from my earlier publications. In this article, we will talk about an alternative representation of time series. Piecewise linear representation of time series is a method of approximating a time series using linear functions over small intervals.
preview
Developing A Swing Entries Monitoring (EA)

Developing A Swing Entries Monitoring (EA)

As the year approaches its end, long-term traders often reflect on market history to analyze its behavior and trends, aiming to project potential future movements. In this article, we will explore the development of a long-term entry monitoring Expert Advisor (EA) using MQL5. The objective is to address the challenge of missed long-term trading opportunities caused by manual trading and the absence of automated monitoring systems. We'll use one of the most prominently traded pairs as an example to strategize and develop our solution effectively.
preview
Build Self Optimizing Expert Advisors in MQL5  (Part 3): Dynamic Trend Following and Mean Reversion Strategies

Build Self Optimizing Expert Advisors in MQL5 (Part 3): Dynamic Trend Following and Mean Reversion Strategies

Financial markets are typically classified as either in a range mode or a trending mode. This static view of the market may make it easier for us to trade in the short run. However, it is disconnected from the reality of the market. In this article, we look to better understand how exactly financial markets move between these 2 possible modes and how we can use our new understanding of market behavior to gain confidence in our algorithmic trading strategies.
preview
Neural Networks Made Easy (Part 97): Training Models With MSFformer

Neural Networks Made Easy (Part 97): Training Models With MSFformer

When exploring various model architecture designs, we often devote insufficient attention to the process of model training. In this article, I aim to address this gap.
preview
News Trading Made Easy (Part 6): Performing Trades (III)

News Trading Made Easy (Part 6): Performing Trades (III)

In this article news filtration for individual news events based on their IDs will be implemented. In addition, previous SQL queries will be improved to provide additional information or reduce the query's runtime. Furthermore, the code built in the previous articles will be made functional.
preview
Developing a multi-currency Expert Advisor (Part 14): Adaptive volume change in risk manager

Developing a multi-currency Expert Advisor (Part 14): Adaptive volume change in risk manager

The previously developed risk manager contained only basic functionality. Let's try to consider possible ways of its development, allowing us to improve trading results without interfering with the logic of trading strategies.
preview
Neural Networks Made Easy (Part 96): Multi-Scale Feature Extraction (MSFformer)

Neural Networks Made Easy (Part 96): Multi-Scale Feature Extraction (MSFformer)

Efficient extraction and integration of long-term dependencies and short-term features remain an important task in time series analysis. Their proper understanding and integration are necessary to create accurate and reliable predictive models.
preview
Automating Trading Strategies in MQL5 (Part 3): The Zone Recovery RSI System for Dynamic Trade Management

Automating Trading Strategies in MQL5 (Part 3): The Zone Recovery RSI System for Dynamic Trade Management

In this article, we create a Zone Recovery RSI EA System in MQL5, using RSI signals to trigger trades and a recovery strategy to manage losses. We implement a "ZoneRecovery" class to automate trade entries, recovery logic, and position management. The article concludes with backtesting insights to optimize performance and enhance the EA’s effectiveness.
preview
Building a Candlestick Trend Constraint Model (Part 10): Strategic Golden and Death Cross (EA)

Building a Candlestick Trend Constraint Model (Part 10): Strategic Golden and Death Cross (EA)

Did you know that the Golden Cross and Death Cross strategies, based on moving average crossovers, are some of the most reliable indicators for identifying long-term market trends? A Golden Cross signals a bullish trend when a shorter moving average crosses above a longer one, while a Death Cross indicates a bearish trend when the shorter average moves below. Despite their simplicity and effectiveness, manually applying these strategies often leads to missed opportunities or delayed trades. By automating them within the Trend Constraint EA using MQL5, these strategies can operate independently to handle market reversals efficiently, while constrained strategies align with broader trends. This approach revolutionizes performance by ensuring precise execution and seamless integration of reversal and trend-following systems.
preview
Mastering File Operations in MQL5: From Basic I/O to Building a Custom CSV Reader

Mastering File Operations in MQL5: From Basic I/O to Building a Custom CSV Reader

This article focuses on essential MQL5 file-handling techniques, spanning trade logs, CSV processing, and external data integration. It offers both conceptual understanding and hands-on coding guidance. Readers will learn to build a custom CSV importer class step-by-step, gaining practical skills for real-world applications.
preview
Automating Trading Strategies in MQL5 (Part 2): The Kumo Breakout System with Ichimoku and Awesome Oscillator

Automating Trading Strategies in MQL5 (Part 2): The Kumo Breakout System with Ichimoku and Awesome Oscillator

In this article, we create an Expert Advisor (EA) that automates the Kumo Breakout strategy using the Ichimoku Kinko Hyo indicator and the Awesome Oscillator. We walk through the process of initializing indicator handles, detecting breakout conditions, and coding automated trade entries and exits. Additionally, we implement trailing stops and position management logic to enhance the EA's performance and adaptability to market conditions.
preview
Building a Candlestick Trend Constraint Model (Part 9): Multiple Strategies Expert Advisor (III)

Building a Candlestick Trend Constraint Model (Part 9): Multiple Strategies Expert Advisor (III)

Welcome to the third installment of our trend series! Today, we’ll delve into the use of divergence as a strategy for identifying optimal entry points within the prevailing daily trend. We’ll also introduce a custom profit-locking mechanism, similar to a trailing stop-loss, but with unique enhancements. In addition, we’ll upgrade the Trend Constraint Expert to a more advanced version, incorporating a new trade execution condition to complement the existing ones. As we move forward, we’ll continue to explore the practical application of MQL5 in algorithmic development, providing you with more in-depth insights and actionable techniques.
preview
Price Action Analysis Toolkit Development (Part 5): Volatility Navigator EA

Price Action Analysis Toolkit Development (Part 5): Volatility Navigator EA

Determining market direction can be straightforward, but knowing when to enter can be challenging. As part of the series titled "Price Action Analysis Toolkit Development", I am excited to introduce another tool that provides entry points, take profit levels, and stop loss placements. To achieve this, we have utilized the MQL5 programming language. Let’s delve into each step in this article.
preview
Neural Networks Made Easy (Part 95): Reducing Memory Consumption in Transformer Models

Neural Networks Made Easy (Part 95): Reducing Memory Consumption in Transformer Models

Transformer architecture-based models demonstrate high efficiency, but their use is complicated by high resource costs both at the training stage and during operation. In this article, I propose to get acquainted with algorithms that allow to reduce memory usage of such models.
preview
Creating a Trading Administrator Panel in MQL5 (Part VIII): Analytics Panel

Creating a Trading Administrator Panel in MQL5 (Part VIII): Analytics Panel

Today, we delve into incorporating useful trading metrics within a specialized window integrated into the Admin Panel EA. This discussion focuses on the implementation of MQL5 to develop an Analytics Panel and highlights the value of the data it provides to trading administrators. The impact is largely educational, as valuable lessons are drawn from the development process, benefiting both upcoming and experienced developers. This feature demonstrates the limitless opportunities this development series offers in equipping trade managers with advanced software tools. Additionally, we'll explore the implementation of the PieChart and ChartCanvas classes as part of the continued expansion of the Trading Administrator panel’s capabilities.
preview
Trading with the MQL5 Economic Calendar (Part 5): Enhancing the Dashboard with Responsive Controls and Filter Buttons

Trading with the MQL5 Economic Calendar (Part 5): Enhancing the Dashboard with Responsive Controls and Filter Buttons

In this article, we create buttons for currency pair filters, importance levels, time filters, and a cancel option to improve dashboard control. These buttons are programmed to respond dynamically to user actions, allowing seamless interaction. We also automate their behavior to reflect real-time changes on the dashboard. This enhances the overall functionality, mobility, and responsiveness of the panel.
preview
Price Action Analysis Toolkit Development Part (4): Analytics Forecaster EA

Price Action Analysis Toolkit Development Part (4): Analytics Forecaster EA

We are moving beyond simply viewing analyzed metrics on charts to a broader perspective that includes Telegram integration. This enhancement allows important results to be delivered directly to your mobile device via the Telegram app. Join us as we explore this journey together in this article.
preview
Trading with the MQL5 Economic Calendar (Part 4): Implementing Real-Time News Updates in the Dashboard

Trading with the MQL5 Economic Calendar (Part 4): Implementing Real-Time News Updates in the Dashboard

This article enhances our Economic Calendar dashboard by implementing real-time news updates to keep market information current and actionable. We integrate live data fetching techniques in MQL5 to update events on the dashboard continuously, improving the responsiveness of the interface. This update ensures that we can access the latest economic news directly from the dashboard, optimizing trading decisions based on the freshest data.
preview
Trading with the MQL5 Economic Calendar (Part 3): Adding Currency, Importance, and Time Filters

Trading with the MQL5 Economic Calendar (Part 3): Adding Currency, Importance, and Time Filters

In this article, we implement filters in the MQL5 Economic Calendar dashboard to refine news event displays by currency, importance, and time. We first establish filter criteria for each category and then integrate these into the dashboard to display only relevant events. Finally, we ensure each filter dynamically updates to provide traders with focused, real-time economic insights.
preview
Neural Networks Made Easy (Part 94): Optimizing the Input Sequence

Neural Networks Made Easy (Part 94): Optimizing the Input Sequence

When working with time series, we always use the source data in their historical sequence. But is this the best option? There is an opinion that changing the sequence of the input data will improve the efficiency of the trained models. In this article I invite you to get acquainted with one of the methods for optimizing the input sequence.
preview
Creating a Trading Administrator Panel in MQL5 (Part VII): Trusted User, Recovery and Cryptography

Creating a Trading Administrator Panel in MQL5 (Part VII): Trusted User, Recovery and Cryptography

Security prompts, such as those triggered every time you refresh the chart, add a new pair to the chat with the Admin Panel EA, or restart the terminal, can become tedious. In this discussion, we will explore and implement a feature that tracks the number of login attempts to identify a trusted user. After a set number of failed attempts, the application will transition to an advanced login procedure, which also facilitates passcode recovery for users who may have forgotten it. Additionally, we will cover how cryptography can be effectively integrated into the Admin Panel to enhance security.
preview
Trading Insights Through Volume: Moving Beyond OHLC Charts

Trading Insights Through Volume: Moving Beyond OHLC Charts

Algorithmic trading system that combines volume analysis with machine learning techniques, specifically LSTM neural networks. Unlike traditional trading approaches that primarily focus on price movements, this system emphasizes volume patterns and their derivatives to predict market movements. The methodology incorporates three main components: volume derivatives analysis (first and second derivatives), LSTM predictions for volume patterns, and traditional technical indicators.
preview
Creating a Trading Administrator Panel in MQL5 (Part VI):Trade Management Panel (II)

Creating a Trading Administrator Panel in MQL5 (Part VI):Trade Management Panel (II)

In this article, we enhance the Trade Management Panel of our multi-functional Admin Panel. We introduce a powerful helper function that simplifies the code, improving readability, maintainability, and efficiency. We will also demonstrate how to seamlessly integrate additional buttons and enhance the interface to handle a wider range of trading tasks. Whether managing positions, adjusting orders, or simplifying user interactions, this guide will help you develop a robust, user-friendly Trade Management Panel.