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

How We Built the Most Powerful Machine Learning-Powered Trading Platform: The Evolution of MQL and MetaTrader Through Archives, Forums, and Releases for MetaTrader 5

A technical history of MQL evolution: from the limited MQL and MQL II languages, through procedural MQL4, to object-oriented MQL5 with native compilation, rich APIs, and a full-fledged engineering environment. We show here the key capabilities of the language and its integrations with Python

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

Forum

Discussing the article: "Machine Learning Under Constraint (Part 1): A Configurable Rule Set for Prop-Firm Position Sizing"

Check out the new article: Machine Learning Under Constraint (Part 1): A Configurable Rule Set for Prop-Firm Position Sizing . Hardcoded prop-firm rules lock the sizer to one program. This article factors those rules into a PropFirmRuleSet and refactors PropFirmAccountState and the sizing modifiers

Discussing the article: "Ecological Cycle Optimizer (ECO)"

Check out the new article: Ecological Cycle Optimizer (ECO) . The ECO (Ecological Cycle Optimizer) algorithm offers an interesting metaphor for applying the concept of the ecological cycle to the field of metaheuristic optimization. The idea of dividing a population into trophic levels — producers

Discussing the article: "Neural Networks in Trading: Unraveling Structural Components (Encoder)"

Check out the new article: Neural Networks in Trading: Unraveling Structural Components (Encoder) . We invite you to explore the next stage in implementing the SCNN framework, which combines flexibility and interpretability, allowing structural components of a time series to be identified precisely

Discussing the article: "Tables in the MVC Paradigm in MQL5: Symbol Correlation Table"

Check out the new article: Tables in the MVC Paradigm in MQL5: Symbol Correlation Table . In this article, we will refine the graphics library classes by adding a vertical header to the table and use the table classes to create an indicator that displays the correlation between the symbols specified

Discussing the article: "Price Action Analysis Toolkit Development (Part 81): Adding Persistent Historical Bookmarks to an MQL5 Navigator"

Check out the new article: Price Action Analysis Toolkit Development (Part 81): Adding Persistent Historical Bookmarks to an MQL5 Navigator . We introduce a persistent bookmark layer for the MetaTrader 5 History Navigator. Bookmarks capture a chart's symbol, timeframe, and historical position with a

Discussing the article: "Building a Bar Replay Tool in MQL5"

Check out the new article: Building a Bar Replay Tool in MQL5 . This article shows how to build an interactive bar replay tool in MQL5 for MetaTrader 5 that reveals historical candles one by one without exposing future data. You will implement custom candles with DRAW COLOR CANDLES, an event-driven

Discussing the article: "Machine Learning Under Constraint (Part 2): Calibrating Position Size to the Remaining Drawdown Budget"

Check out the new article: Machine Learning Under Constraint (Part 2): Calibrating Position Size to the Remaining Drawdown Budget . We present a rule-set-aware calibration chain that turns the remaining risk budget into a calibrated sigmoid scale for position sizing. It computes a ceiling from stop

Discussing the article: "Self-Optimizing Expert Advisors in MQL5 (Part 19): Parameter Optimization For Time-Lagged Independent Components Analysis (2)"

Check out the new article: Self-Optimizing Expert Advisors in MQL5 (Part 19): Parameter Optimization For Time-Lagged Independent Components Analysis (2) . The article shows how to tune ICA hyperparameters with a supervised evaluation pipeline and apply spectral clustering to time-lagged indicators

Discussing the article: "Zero-Copy Tick Streaming (Part 1): Bridging MetaTrader 5 to Shared Memory with the Arrow C Data Interface"

Check out the new article: Zero-Copy Tick Streaming (Part 1): Bridging MetaTrader 5 to Shared Memory with the Arrow C Data Interface . This article implements a lock-free shared-memory bridge in MetaTrader 5 that writes ticks in Apache Arrow’s columnar layout via the C Data Interface. It details the

Discussing the article: "First Fractal Breakout — Intraday Strategy, Expert Advisor and Backtesting"

Check out the new article: First Fractal Breakout — Intraday Strategy, Expert Advisor and Backtesting . This article develops a market‑structure‑driven intraday breakout system based on Bill Williams fractals. We define session bounds, derive volatility‑scaled stops, use fixed risk and take‑profit