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

AI Trading Platform: Why MetaTrader 5 Is the Best Choice for Algorithmic Trading with Python, ONNX, and AI Assistant for MetaTrader 5

MetaTrader 5 is well suited for AI trading because it combines market data, MQL5 development, Python research, ONNX models, Strategy Tester, VPS, and the MQL5.community ecosystem into a single workflow. This article demonstrates a practical path from AI prompts to structured signals, working with

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

Forum

Discussing the article: "Building a Correlation-Aware Portfolio Risk Monitor in MQL5"

Check out the new article: Building a Correlation-Aware Portfolio Risk Monitor in MQL5 . The article quantifies correlation and portfolio risk in MetaTrader 5: from time-aligned returns to a covariance matrix, true portfolio variance against the independent-sum assumption, and position-level risk

Discussing the article: "Price Action Analysis Toolkit Development (Part 75): Building a Modular Multi-Symbol Trading Panel in MQL5"

Check out the new article: Price Action Analysis Toolkit Development (Part 75): Building a Modular Multi-Symbol Trading Panel in MQL5 . A structured MQL5 implementation of a multi‑symbol trading panel with clear separation of concerns: symbol handling, trading logic, and GUI. Integrated into an

Discussing the article: "Digital Signal Processing for Traders (Part 2): The Dominant Cycle, MAMA, and a Regime-Switching Expert Advisor"

Check out the new article: Digital Signal Processing for Traders (Part 2): The Dominant Cycle, MAMA, and a Regime-Switching Expert Advisor . In Part 2 we measure the market's dominant cycle using Ehlers' Hilbert-transform homodyne discriminator and wrap it as an indicator. We then build the MESA

Discussing the article: "Execution Cost Sensitivity Analyzer"

Check out the new article: Execution Cost Sensitivity Analyzer . Backtests often understate spread, commission, and slippage. This MQL5 analyzer loads closing deals and simulates rising execution costs to measure robustness. It computes the breakeven cost per deal, the cushion over an assumed cost

Discussing the article: "Defining your Edge (Part 1): Using a Discrete Fourier Transform and a Spiking Neural Network in a Trading Robot"

Check out the new article: Defining your Edge (Part 1): Using a Discrete Fourier Transform and a Spiking Neural Network in a Trading Robot . In this article we make the case for pairing the Discrete Fourier Transform with a Spiking Neural Network in a Trading Robot. The Fourier Transform helps

Discussing the article: "Dingo Optimization Algorithm Modification (DOAm)"

Check out the new article: Dingo Optimization Algorithm Modification (DOAm) . The custom modification of the Dingo algorithm presented in the article has raised the bar for finding the best optimization algorithm. Are even better results possible? Let's ask ourselves: are there population-based

Discussing the article: "A Symbol Metadata and Trading Hours Cache in MQL5: Eliminating Redundant SymbolInfo Calls in Multi-Symbol EAs"

Check out the new article: A Symbol Metadata and Trading Hours Cache in MQL5: Eliminating Redundant SymbolInfo Calls in Multi-Symbol EAs . This article presents CSymbolMetaCache, an MQL5 layer that preloads contract specifications and trading-session schedules for monitored symbols at EA startup and

Discussing the article: "Broker Reality Check (Part 1): Why Your EA Works on a Demo and Breaks on a Client's Broker"

Check out the new article: Broker Reality Check (Part 1): Why Your EA Works on a Demo and Breaks on a Client's Broker . Your Expert Advisor runs clean on your demo, then throws errors on a client's broker and quietly stops trading - and the code never changed. What changed is the broker's rulebook

Discussing the article: "Mapping Dealer Gamma Exposure (GEX) in MetaTrader 5: Walls, the Zero-Gamma Flip, and a Chart Overlay"

Check out the new article: Mapping Dealer Gamma Exposure (GEX) in MetaTrader 5: Walls, the Zero-Gamma Flip, and a Chart Overlay . In this article we build a dealer gamma-exposure map in MQL5. From an option chain, the tool computes per-strike GEX, finds the call and put walls, and solves for the

Discussing the article: "Constructing a Trade Replay Engine in MQL5: Stepping Through Historical Trades Bar by Bar for Manual Review"

Check out the new article: Constructing a Trade Replay Engine in MQL5: Stepping Through Historical Trades Bar by Bar for Manual Review . An MQL5 script reconstructs closed trades from raw deal history and replays them on the chart bar by bar, drawing entry, exit, stop, target, and an annotation with