Articles on the MQL5 programming and use of trading robots

icon

Expert Advisors created for the MetaTrader platform perform a variety of functions implemented by their developers. Trading robots can track financial symbols 24 hours a day, copy deals, create and send reports, analyze news and even provide specific custom graphical interface.

The articles describe programming techniques, mathematical ideas for data processing, tips on creating and ordering of trading robots.

Add a new article
latest | best
preview
Neural Networks in Trading: Node-Adaptive Graph Representation with NAFS

Neural Networks in Trading: Node-Adaptive Graph Representation with NAFS

We invite you to get acquainted with the NAFS (Node-Adaptive Feature Smoothing) method, which is a non-parametric approach to creating node representations that does not require parameter training. NAFS extracts features of each node given its neighbors and then adaptively combines these features to form a final representation.
preview
MQL5 Wizard Techniques you should know (Part 69): Using Patterns of SAR and the RVI

MQL5 Wizard Techniques you should know (Part 69): Using Patterns of SAR and the RVI

The Parabolic-SAR (SAR) and the Relative Vigour Index (RVI) are another pair of indicators that could be used in conjunction within an MQL5 Expert Advisor. This indicator pair, like those we’ve covered in the past, is also complementary since SAR defines the trend while RVI checks momentum. As usual, we use the MQL5 wizard to build and test any potential this indicator pairing may have.
preview
Neural Networks in Trading: Contrastive Pattern Transformer (Final Part)

Neural Networks in Trading: Contrastive Pattern Transformer (Final Part)

In the previous last article within this series, we looked at the Atom-Motif Contrastive Transformer (AMCT) framework, which uses contrastive learning to discover key patterns at all levels, from basic elements to complex structures. In this article, we continue implementing AMCT approaches using MQL5.
preview
Automating Trading Strategies in MQL5 (Part 19): Envelopes Trend Bounce Scalping — Trade Execution and Risk Management (Part II)

Automating Trading Strategies in MQL5 (Part 19): Envelopes Trend Bounce Scalping — Trade Execution and Risk Management (Part II)

In this article, we implement trade execution and risk management for the Envelopes Trend Bounce Scalping Strategy in MQL5. We implement order placement and risk controls like stop-loss and position sizing. We conclude with backtesting and optimization, building on Part 18’s foundation.
preview
MQL5 Wizard Techniques you should know (Part 68):  Using Patterns of TRIX and the Williams Percent Range with a Cosine Kernel Network

MQL5 Wizard Techniques you should know (Part 68): Using Patterns of TRIX and the Williams Percent Range with a Cosine Kernel Network

We follow up our last article, where we introduced the indicator pair of TRIX and Williams Percent Range, by considering how this indicator pairing could be extended with Machine Learning. TRIX and William’s Percent are a trend and support/ resistance complimentary pairing. Our machine learning approach uses a convolution neural network that engages the cosine kernel in its architecture when fine-tuning the forecasts of this indicator pairing. As always, this is done in a custom signal class file that works with the MQL5 wizard to assemble an Expert Advisor.
preview
Introduction to MQL5 (Part 17): Building Expert Advisors Using Technical Chart Patterns (II)

Introduction to MQL5 (Part 17): Building Expert Advisors Using Technical Chart Patterns (II)

This article teaches beginners how to build an Expert Advisor (EA) in MQL5 that trades based on chart pattern recognition using trend line breakouts and reversals. By learning how to retrieve trend line values dynamically and compare them with price action, readers will be able to develop EAs capable of identifying and trading chart patterns such as ascending and descending trend lines, channels, wedges, triangles, and more.
preview
MQL5 Trading Tools (Part 3): Building a Multi-Timeframe Scanner Dashboard for Strategic Trading

MQL5 Trading Tools (Part 3): Building a Multi-Timeframe Scanner Dashboard for Strategic Trading

In this article, we build a multi-timeframe scanner dashboard in MQL5 to display real-time trading signals. We plan an interactive grid interface, implement signal calculations with multiple indicators, and add a close button. The article concludes with backtesting and strategic trading benefits
preview
Neural Networks in Trading: Contrastive Pattern Transformer

Neural Networks in Trading: Contrastive Pattern Transformer

The Contrastive Transformer is designed to analyze markets both at the level of individual candlesticks and based on entire patterns. This helps improve the quality of market trend modeling. Moreover, the use of contrastive learning to align representations of candlesticks and patterns fosters self-regulation and improves the accuracy of forecasts.
preview
Automating Trading Strategies in MQL5 (Part 18): Envelopes Trend Bounce Scalping - Core Infrastructure and Signal Generation (Part I)

Automating Trading Strategies in MQL5 (Part 18): Envelopes Trend Bounce Scalping - Core Infrastructure and Signal Generation (Part I)

In this article, we build the core infrastructure for the Envelopes Trend Bounce Scalping Expert Advisor in MQL5. We initialize envelopes and other indicators for signal generation. We set up backtesting to prepare for trade execution in the next part.
preview
Neural Networks in Trading: Market Analysis Using a Pattern Transformer

Neural Networks in Trading: Market Analysis Using a Pattern Transformer

When we use models to analyze the market situation, we mainly focus on the candlestick. However, it has long been known that candlestick patterns can help in predicting future price movements. In this article, we will get acquainted with a method that allows us to integrate both of these approaches.
preview
Developing a multi-currency Expert Advisor (Part 19): Creating stages implemented in Python

Developing a multi-currency Expert Advisor (Part 19): Creating stages implemented in Python

So far we have considered the automation of launching sequential procedures for optimizing EAs exclusively in the standard strategy tester. But what if we would like to perform some handling of the obtained data using other means between such launches? We will attempt to add the ability to create new optimization stages performed by programs written in Python.
preview
MQL5 Wizard Techniques you should know (Part 67): Using Patterns of TRIX and the Williams Percent Range

MQL5 Wizard Techniques you should know (Part 67): Using Patterns of TRIX and the Williams Percent Range

The Triple Exponential Moving Average Oscillator (TRIX) and the Williams Percentage Range Oscillator are another pair of indicators that could be used in conjunction within an MQL5 Expert Advisor. This indicator pair, like those we’ve covered recently, is also complementary given that TRIX defines the trend while Williams Percent Range affirms support and Resistance levels. As always, we use the MQL5 wizard to prototype any potential these two may have.
preview
Trading with the MQL5 Economic Calendar (Part 10): Draggable Dashboard and Interactive Hover Effects for Seamless News Navigation

Trading with the MQL5 Economic Calendar (Part 10): Draggable Dashboard and Interactive Hover Effects for Seamless News Navigation

In this article, we enhance the MQL5 Economic Calendar by introducing a draggable dashboard that allows us to reposition the interface for better chart visibility. We implement hover effects for buttons to improve interactivity and ensure seamless navigation with a dynamically positioned scrollbar.
preview
Building MQL5-Like Trade Classes in Python for MetaTrader 5

Building MQL5-Like Trade Classes in Python for MetaTrader 5

MetaTrader 5 python package provides an easy way to build trading applications for the MetaTrader 5 platform in the Python language, while being a powerful and useful tool, this module isn't as easy as MQL5 programming language when it comes to making an algorithmic trading solution. In this article, we are going to build trade classes similar to the one offered in MQL5 to create a similar syntax and make it easier to make trading robots in Python as in MQL5.
preview
Neural Networks in Trading: Transformer with Relative Encoding

Neural Networks in Trading: Transformer with Relative Encoding

Self-supervised learning can be an effective way to analyze large amounts of unlabeled data. The efficiency is provided by the adaptation of models to the specific features of financial markets, which helps improve the effectiveness of traditional methods. This article introduces an alternative attention mechanism that takes into account the relative dependencies and relationships between inputs.
preview
Introduction to MQL5 (Part 16): Building Expert Advisors Using Technical Chart Patterns

Introduction to MQL5 (Part 16): Building Expert Advisors Using Technical Chart Patterns

This article introduces beginners to building an MQL5 Expert Advisor that identifies and trades a classic technical chart pattern — the Head and Shoulders. It covers how to detect the pattern using price action, draw it on the chart, set entry, stop loss, and take profit levels, and automate trade execution based on the pattern.
preview
Neural Networks in Trading: Controlled Segmentation (Final Part)

Neural Networks in Trading: Controlled Segmentation (Final Part)

We continue the work started in the previous article on building the RefMask3D framework using MQL5. This framework is designed to comprehensively study multimodal interaction and feature analysis in a point cloud, followed by target object identification based on a description provided in natural language.
preview
MQL5 Wizard Techniques you should know (Part 66): Using Patterns of FrAMA and the Force Index with the Dot Product Kernel

MQL5 Wizard Techniques you should know (Part 66): Using Patterns of FrAMA and the Force Index with the Dot Product Kernel

The FrAMA Indicator and the Force Index Oscillator are trend and volume tools that could be paired when developing an Expert Advisor. We continue from our last article that introduced this pair by considering machine learning applicability to the pair. We are using a convolution neural network that uses the dot-product kernel in making forecasts with these indicators’ inputs. This is done in a custom signal class file that works with the MQL5 wizard to assemble an Expert Advisor.
preview
Data Science and ML (Part 41): Forex and Stock Markets Pattern Detection using YOLOv8

Data Science and ML (Part 41): Forex and Stock Markets Pattern Detection using YOLOv8

Detecting patterns in financial markets is challenging because it involves seeing what's on the chart, something that's difficult to undertake in MQL5 due to image limitations. In this article, we are going to discuss a decent model made in Python that helps us detect patterns present on the chart with minimal effort.
preview
Overcoming The Limitation of Machine Learning (Part 2): Lack of Reproducibility

Overcoming The Limitation of Machine Learning (Part 2): Lack of Reproducibility

The article explores why trading results can differ significantly between brokers, even when using the same strategy and financial symbol, due to decentralized pricing and data discrepancies. The piece helps MQL5 developers understand why their products may receive mixed reviews on the MQL5 Marketplace, and urges developers to tailor their approaches to specific brokers to ensure transparent and reproducible outcomes. This could grow to become an important domain-bound best practice that will serve our community well if the practice were to be widely adopted.
preview
Neural Networks in Trading: Controlled Segmentation

Neural Networks in Trading: Controlled Segmentation

In this article. we will discuss a method of complex multimodal interaction analysis and feature understanding.
preview
Trading with the MQL5 Economic Calendar (Part 9): Elevating News Interaction with a Dynamic Scrollbar and Polished Display

Trading with the MQL5 Economic Calendar (Part 9): Elevating News Interaction with a Dynamic Scrollbar and Polished Display

In this article, we enhance the MQL5 Economic Calendar with a dynamic scrollbar for intuitive news navigation. We ensure seamless event display and efficient updates. We validate the responsive scrollbar and polished dashboard through testing.
preview
MQL5 Wizard Techniques you should know (Part 65): Using Patterns of FrAMA and the Force Index

MQL5 Wizard Techniques you should know (Part 65): Using Patterns of FrAMA and the Force Index

The Fractal Adaptive Moving Average (FrAMA) and the Force Index Oscillator are another pair of indicators that could be used in conjunction within an MQL5 Expert Advisor. These two indicators complement each other a little bit because FrAMA is a trend following indicator while the Force Index is a volume based oscillator. As always, we use the MQL5 wizard to rapidly explore any potential these two may have.
preview
Data Science and ML (Part 40): Using Fibonacci Retracements in Machine Learning data

Data Science and ML (Part 40): Using Fibonacci Retracements in Machine Learning data

Fibonacci retracements are a popular tool in technical analysis, helping traders identify potential reversal zones. In this article, we’ll explore how these retracement levels can be transformed into target variables for machine learning models to help them understand the market better using this powerful tool.
preview
Neural Networks in Trading: Generalized 3D Referring Expression Segmentation

Neural Networks in Trading: Generalized 3D Referring Expression Segmentation

While analyzing the market situation, we divide it into separate segments, identifying key trends. However, traditional analysis methods often focus on one aspect and thus limit the proper perception. In this article, we will learn about a method that enables the selection of multiple objects to ensure a more comprehensive and multi-layered understanding of the situation.
preview
Trading with the MQL5 Economic Calendar (Part 8): Optimizing News-Driven Backtesting with Smart Event Filtering and Targeted Logs

Trading with the MQL5 Economic Calendar (Part 8): Optimizing News-Driven Backtesting with Smart Event Filtering and Targeted Logs

In this article, we optimize our economic calendar with smart event filtering and targeted logging for faster, clearer backtesting in live and offline modes. We streamline event processing and focus logs on critical trade and dashboard events, enhancing strategy visualization. These improvements enable seamless testing and refinement of news-driven trading strategies.
preview
Data Science and ML (Part 39): News + Artificial Intelligence, Would You Bet on it?

Data Science and ML (Part 39): News + Artificial Intelligence, Would You Bet on it?

News drives the financial markets, especially major releases like Non-Farm Payrolls (NFPs). We've all witnessed how a single headline can trigger sharp price movements. In this article, we dive into the powerful intersection of news data and Artificial Intelligence.
preview
Automating Trading Strategies in MQL5 (Part 17): Mastering the Grid-Mart Scalping Strategy with a Dynamic Dashboard

Automating Trading Strategies in MQL5 (Part 17): Mastering the Grid-Mart Scalping Strategy with a Dynamic Dashboard

In this article, we explore the Grid-Mart Scalping Strategy, automating it in MQL5 with a dynamic dashboard for real-time trading insights. We detail its grid-based Martingale logic and risk management features. We also guide backtesting and deployment for robust performance.
preview
Neural Networks in Trading: Mask-Attention-Free Approach to Price Movement Forecasting

Neural Networks in Trading: Mask-Attention-Free Approach to Price Movement Forecasting

In this article, we will discuss the Mask-Attention-Free Transformer (MAFT) method and its application in the field of trading. Unlike traditional Transformers that require data masking when processing sequences, MAFT optimizes the attention process by eliminating the need for masking, significantly improving computational efficiency.
preview
Price Action Analysis Toolkit Development (Part 22): Correlation Dashboard

Price Action Analysis Toolkit Development (Part 22): Correlation Dashboard

This tool is a Correlation Dashboard that calculates and displays real-time correlation coefficients across multiple currency pairs. By visualizing how pairs move in relation to one another, it adds valuable context to your price-action analysis and helps you anticipate inter-market dynamics. Read on to explore its features and applications.
preview
MQL5 Trading Tools (Part 2): Enhancing the Interactive Trade Assistant with Dynamic Visual Feedback

MQL5 Trading Tools (Part 2): Enhancing the Interactive Trade Assistant with Dynamic Visual Feedback

In this article, we upgrade our Trade Assistant Tool by adding drag-and-drop panel functionality and hover effects to make the interface more intuitive and responsive. We refine the tool to validate real-time order setups, ensuring accurate trade configurations relative to market prices. We also backtest these enhancements to confirm their reliability.
preview
MQL5 Wizard Techniques you should know (Part 64): Using Patterns of DeMarker and Envelope Channels with the White-Noise Kernel

MQL5 Wizard Techniques you should know (Part 64): Using Patterns of DeMarker and Envelope Channels with the White-Noise Kernel

The DeMarker Oscillator and the Envelopes' indicator are momentum and support/ resistance tools that can be paired when developing an Expert Advisor. We continue from our last article that introduced these pair of indicators by adding machine learning to the mix. We are using a recurrent neural network that uses the white-noise kernel to process vectorized signals from these two indicators. This is done in a custom signal class file that works with the MQL5 wizard to assemble an Expert Advisor.
preview
Forecasting exchange rates using classic machine learning methods: Logit and Probit models

Forecasting exchange rates using classic machine learning methods: Logit and Probit models

In the article, an attempt is made to build a trading EA for predicting exchange rate quotes. The algorithm is based on classical classification models - logistic and probit regression. The likelihood ratio criterion is used as a filter for trading signals.
preview
Creating a Trading Administrator Panel in MQL5 (Part XI): Modern feature communications interface (I)

Creating a Trading Administrator Panel in MQL5 (Part XI): Modern feature communications interface (I)

Today, we are focusing on the enhancement of the Communications Panel messaging interface to align with the standards of modern, high-performing communication applications. This improvement will be achieved by updating the CommunicationsDialog class. Join us in this article and discussion as we explore key insights and outline the next steps in advancing interface programming using MQL5.
preview
MQL5 Wizard Techniques you should know (Part 63): Using Patterns of DeMarker and Envelope Channels

MQL5 Wizard Techniques you should know (Part 63): Using Patterns of DeMarker and Envelope Channels

The DeMarker Oscillator and the Envelopes' indicator are momentum and support/resistance tools that can be paired when developing an Expert Advisor. We therefore examine on a pattern by pattern basis what could be of use and what potentially avoid. We are using, as always, a wizard assembled Expert Advisor together with the Patterns-Usage functions that are built into the Expert Signal Class.
preview
Overcoming The Limitation of Machine Learning (Part 1): Lack of Interoperable Metrics

Overcoming The Limitation of Machine Learning (Part 1): Lack of Interoperable Metrics

There is a powerful and pervasive force quietly corrupting the collective efforts of our community to build reliable trading strategies that employ AI in any shape or form. This article establishes that part of the problems we face, are rooted in blind adherence to "best practices". By furnishing the reader with simple real-world market-based evidence, we will reason to the reader why we must refrain from such conduct, and rather adopt domain-bound best practices if our community should stand any chance of recovering the latent potential of AI.
preview
MQL5 Trading Tools (Part 1): Building an Interactive Visual Pending Orders Trade Assistant Tool

MQL5 Trading Tools (Part 1): Building an Interactive Visual Pending Orders Trade Assistant Tool

In this article, we introduce the development of an interactive Trade Assistant Tool in MQL5, designed to simplify placing pending orders in Forex trading. We outline the conceptual design, focusing on a user-friendly GUI for setting entry, stop-loss, and take-profit levels visually on the chart. Additionally, we detail the MQL5 implementation and backtesting process to ensure the tool’s reliability, setting the stage for advanced features in the preceding parts.
preview
Data Science and ML (Part 38): AI Transfer Learning in Forex Markets

Data Science and ML (Part 38): AI Transfer Learning in Forex Markets

The AI breakthroughs dominating headlines, from ChatGPT to self-driving cars, aren’t built from isolated models but through cumulative knowledge transferred from various models or common fields. Now, this same "learn once, apply everywhere" approach can be applied to help us transform our AI models in algorithmic trading. In this article, we are going to learn how we can leverage the information gained across various instruments to help in improving predictions on others using transfer learning.
preview
Neural Networks in Trading: Superpoint Transformer (SPFormer)

Neural Networks in Trading: Superpoint Transformer (SPFormer)

In this article, we introduce a method for segmenting 3D objects based on Superpoint Transformer (SPFormer), which eliminates the need for intermediate data aggregation. This speeds up the segmentation process and improves the performance of the model.
preview
MQL5 Wizard Techniques you should know (Part 62): Using Patterns of ADX and CCI with Reinforcement-Learning TRPO

MQL5 Wizard Techniques you should know (Part 62): Using Patterns of ADX and CCI with Reinforcement-Learning TRPO

The ADX Oscillator and CCI oscillator are trend following and momentum indicators that can be paired when developing an Expert Advisor. We continue where we left off in the last article by examining how in-use training, and updating of our developed model, can be made thanks to reinforcement-learning. We are using an algorithm we are yet to cover in these series, known as Trusted Region Policy Optimization. And, as always, Expert Advisor assembly by the MQL5 Wizard allows us to set up our model(s) for testing much quicker and also in a way where it can be distributed and tested with different signal types.