Codes

Examples from the book "Neural networks for algorithmic trading with MQL5" for MetaTrader 5

The book "Neural networks in algorithmic trading with MQL5" is a comprehensive guide, covering both the theoretical foundations of artificial intelligence and neural networks and practical aspects of their application in financial trading using the MQL5 programming language

MQL5 Programming for Traders – Source Codes from the Book. Part 7 for MetaTrader 5

The final seventh part of the book discusses the advanced capabilities of the MQL5 API, which will be useful when developing programs for MetaTrader 5. These include custom financial symbols, built-in economic calendar events, and general-purpose technologies such as networking, databases, and

MQL5 Programming for Traders – Source Codes from the Book. Part 6 for MetaTrader 5

In Part 6 of the "MQL5 Programming for Traders", we will study a key component of the MQL5 language – trading automation. We will start with a description of the fundamental entities, such as financial instrument specifications and trading account settings. These are prerequisites for creating

MQL5 Programming for Traders – Source Codes from the Book. Part 5 for MetaTrader 5

In Part 5 of the book, we'll delve deeper into the APIs associated with algorithmic trading, including financial data analysis and processing, chart visualization, automation, and user interactions

MQL5 Programming for Traders – Source Codes from the Book. Part 4 for MetaTrader 5

In the fourth part of the book, we will focus on mastering built-in functions (MQL5 API) and will gradually delve into specialized subsystems. Any MQL5 program can utilize a plethora of technologies and functionalities. Therefore, it makes sense to begin with the most simple and useful functions

MQL5 Programming for Traders – Source Codes from the Book. Part 3 for MetaTrader 5

Part 3 "Object Oriented Programming in MQL5" offers an immersion into the world of object-oriented programming (OOP) in the MQL5 language. Software development often involves the complexity related to the management of multiple entities, requiring advanced technology to improve programming

MQL5 Programming for Traders – Source Codes from the Book. Part 2 for MetaTrader 5

Part 2 "MQL5 programming fundamentals" is an introduction to the key concepts of this programming language. This part of the book is devoted to data types, identifiers, variables, expressions, and operators. You will learn how to combine different instructions to form the program logic

MQL5 Programming for Traders – Source Codes from the Book. Part 1 for MetaTrader 5

The first chapter of the book introduces the MQL5 language and development environment. One of the new features introduced in the MQL5 language compared to MQL4 (MetaTrader 4 language) is support for object-oriented programming (OOP), which makes it similar to C++

Zigzag R for MetaTrader 4

An optimized version of the Zigzag indicator, which was included in the MT4 delivery of 2005 (and in MT3.83)

RegularExpressions in MQL4 for working with regular expressions for MetaTrader 4

Regular expressions provide a formal language for quick and flexible processing of texts. Each regular expression is a pattern (mask), for which the regular expression engine tries to find matches in the source text. A pattern consists of one or more character literals, operators, or constructs

Articles

Publish Your Article Code to MQL5 Algo Forge in 10 Minutes: A Step-by-Step Guide for MetaTrader 5

The article provides a step-by-step guide on how to migrate code from a published project into a fully-fledged MQL5 Algo Forge project. You will set up the environment and authentication in MetaEditor, create a project in Shared Projects, select the type, arrange the files, add README.md, check the

3D Visualization Without External Libraries: How MetaTrader 5 Reveals Optimization Results via MQL5 + DX11 for MetaTrader 5

The article describes the practical application of DirectX 11 and built-in MQL5 tools for creating 3D visualizations and interactive interfaces in MetaTrader 5. The focus is on cognitive efficiency - the ability of 3D charts and guided scenes to help in understanding optimization data, liquidity

From "Best Pass" to Robust Solutions: Exploring the Optimization Surface in MetaTrader 5 for MetaTrader 5

The article examines an engineering approach to optimizing an Expert Advisor in MetaTrader 5: from collecting custom metrics through Optimization Frames to parameter surface analysis. A simple event-driven EMA/RSI model demonstrates CSV export, smoothing, and local stability assessment in Python

MetaTrader 5: Build a Market to Suit Your Strategy — Renko/Range/Volume, Synthetics, and Stress Tests on Custom Symbols for MetaTrader 5

In this article, we demonstrate how to use API of the MetaTrader 5 custom symbols to transform your terminal into a data constructor for generating timeless Renko, Range, and Equal-Volume charts and assembling synthetic instruments. We will analyze tick aggregation and history modification for

The Power of MetaTrader 5: From Step-by-Step Debugging to EX5 Protection in a Unified Environment for MetaTrader 5

This article examines a comprehensive approach to developing trading algorithms: from project setup and logic debugging to protecting the finished product. We will explore MetaEditor's built-in tools, including step-by-step debugging using real ticks, performance profiling, and direct integration

From Matrices to Models: How to Build an ML Pipeline in MQL5 and Export It to ONNX for MetaTrader 5

The article describes the arrangement of a coordinated ML pipeline in MetaTrader 5 with separation of roles: Python trains and exports the model to ONNX, MQL5 reproduces normalization and PCA via matrix/vector and performs inference. This approach makes the model's inputs stable and verifiable, and

Event-Driven Architecture in MQL5: How to Turn an Expert Advisor into a Full-Fledged Trading System for MetaTrader 5

The article is dedicated to the event-driven architecture in MQL5 and describes the transition from the monolithic OnTick model to distributed processing. We will consider predefined and custom events, services and messaging between programs, as well as common architectural errors. A practical

MetaTrader 5 and the MQL5 Economic Calendar: How to Turn News into a Reproducible Trading System for MetaTrader 5

The article presents a systematic approach to news trading in MetaTrader 5 using the built-in economic calendar: data structure, API functions, time synchronization rules, and event filtering. Methods of caching and incremental updating without overloading the server are described. The article also

From CPU to GPU in MQL5: A Practical OpenCL Framework for Accelerating Research, Optimizations, and Patterns for MetaTrader 5

Find out how to build a practical CPU-to-GPU migration path in MQL5 using OpenCL. We will focus on context initialization, buffer organization, large batches, kernel startup, and minimizing data exchanges. Typical errors and ways to eliminate them will be considered as well. An example with

Algorithmic Trading Without the Routine: Quick Trade Analysis in MetaTrader 5 with SQLite for MetaTrader 5

The article presents a minimal working set for maintaining a trading journal in MQL5 using SQLite: a table structure for trades, signals, and events, indices, prepared statements and trades, as well as standard analytical SQL queries. Integration with the statistics dashboard in MetaTrader 5 and

Forum

Discussing the article: "Beyond GARCH (Part V): Fitting the Multifractal Spectrum in MQL5"

Check out the new article: Beyond GARCH (Part V): Fitting the Multifractal Spectrum in MQL5 . This article builds the Spectrum Fitter: from tau(q) we compute f(alpha) with a discrete Legendre transform, then fit Normal, Binomial, Poisson, and Gamma spectra under box constraints using BLEIC. The best

Discussing the article: "Engineering Trading Discipline into Code (Part 7): Automating Equity Protection Through Governance Logic"

Check out the new article: Engineering Trading Discipline into Code (Part 7): Automating Equity Protection Through Governance Logic . Automated trading systems often focus heavily on signal generation while neglecting the mechanisms required to protect capital during periods of stress. This article

Discussing the article: "Neural Networks in Trading: Hierarchical Skill Discovery for Adaptive Agent Behavior (HiSSD)"

Check out the new article: Neural Networks in Trading: Hierarchical Skill Discovery for Adaptive Agent Behavior (HiSSD) . In this article, we explore the HiSSD framework, which combines hierarchical learning and multi-agent approaches to create adaptive systems. We examine in detail how this

Discussing the article: "MQL5 Wizard Techniques you should know (Part 93): Using Suffix Automation and an Auto Encoder in a Custom Money Management Class"

Check out the new article: MQL5 Wizard Techniques you should know (Part 93): Using Suffix Automation and an Auto Encoder in a Custom Money Management Class . For this article we switch to a custom MQL5 Wizard class implementation that explores Money Management. We are labelling our custom class

Discussing the article: "Price Action Analysis Toolkit Development (Part 71): Weekend Gap Structure Mapping in MQL5"

Check out the new article: Price Action Analysis Toolkit Development (Part 71): Weekend Gap Structure Mapping in MQL5 . The article delivers an object-based MQL5 implementation that detects weekend gaps from time discontinuities and renders them directly on the chart. It manages graphical objects

Discussing the article: "Building an Object-Oriented Z-Score Statistical Arbitrage Engine in MQL5"

Check out the new article: Building an Object-Oriented Z-Score Statistical Arbitrage Engine in MQL5 . This article shows how to implement a production Z-Score engine in MQL5 using an object-oriented include file, the library computes a rolling mean and population standard deviation, exposes a shift

Discussing the article: "Carry Trade Logic in MQL5: Building an EA That Factors Swap Rates Into Position Sizing and Holding Decisions"

Check out the new article: Carry Trade Logic in MQL5: Building an EA That Factors Swap Rates Into Position Sizing and Holding Decisions . Most retail traders ignore overnight swap rates, but for long-term positions, these interest payments can make or break your strategy. This article shows you how

Discussing the article: "Exchange Market Algorithm (EMA)"

Check out the new article: Exchange Market Algorithm (EMA) . The article presents a detailed analysis of the Exchange Market Algorithm (EMA) inspired by the behavior of stock market traders. The algorithm simulates stock trading, where market participants with varying levels of success employ

Discussing the article: "Developing a Multi-Currency Expert Advisor (Part 28): Adding a Position Closing Manager"

Check out the new article: Developing a Multi-Currency Expert Advisor (Part 28): Adding a Position Closing Manager . When running multiple strategies in parallel, you may want to periodically close all open positions and start the strategies over again. The existing code only allows this behavior to

Discussing the article: "Neural Networks in Trading: Anomaly Detection in the Frequency Domain (Final Part)"

Check out the new article: Neural Networks in Trading: Anomaly Detection in the Frequency Domain (Final Part) . We continue to work on implementing the CATCH framework, which combines the Fourier transform and frequency patching mechanisms, ensuring accurate detection of market anomalies. In this