Neural Networks in Trading: LSTM Optimization for Multivariate Time Series Forecasting (DA-CG-LSTM)
This article introduces the DA-CG-LSTM algorithm, which offers new approaches to time series analysis and forecasting. It explains how innovative attention mechanisms and model flexibility can improve forecast accuracy.
Price Action Analysis Toolkit Development (Part 72): Building a Gap Fill Indicator in MQL5
An EA-ready weekend gap-fill tool for MetaTrader 5 that detects gaps, confirms complete fills, and posts deterministic buy/sell values to indicator buffers. It reconstructs historical events, monitors live markets without repainting, and visualizes gap structure directly on the chart. Configurable alerts and clear object graphics support both manual review and automated execution.
Graph Theory: Network Flow of Commodities (Ford-Fulkerson Algorithm), Used as a Liquidity-Capacity Engine
The article presents an MQL5 Expert Advisor that adapts the Ford–Fulkerson max-flow method into a liquidity-capacity filter. Market structures—Swing Highs/Lows, Fair Value Gaps, Order Blocks, and Liquidity Pools—form a directed graph with edge capacities from volume, price reaction, distance, and structure quality. Maximum flow qualifies ICT setups, filters weak paths, and drives dynamic position sizing for a consistent, two-stage decision process.
MQL5 Wizard Techniques you should know (Part 96): Using Wavelet Thresholding and LSTM Network in a Custom Money Management Class
In this article we consider a custom MQL5 Wizard class that processes Money Management. Our custom class is labelled ‘CMoneyWaveletLSTM’, and is developed by combining the Wavelet Thresholding algorithm with an LSTM network. As has been the case throughout these series, the developed model is testable with MQL5 Wizard-Assembled Expert Advisors that can be tuned with different trailing stops and entry Signals classes. We maintain our entry Signal, as in past articles as the built-in 'Envelopes' class and the RSI class.
The Repository Pattern in MQL5: Abstracting Trade History Access for Testable EA Logic
Direct calls to the MQL5 History API inside analytics components create hidden terminal dependencies that make isolated testing structurally impossible. This article constructs an ITradeRepository abstraction layer with CLiveTradeRepository and CMockTradeRepository implementations, enabling the same analytics engine and equity curve panel to operate identically against live account data or a deterministic in-memory dataset. Repository injection eliminates direct API coupling, supports offline validation, and confines data source changes to a single implementation class.
Competitive Learning Algorithm (CLA)
The article presents the Competitive Learning Algorithm (CLA), a new metaheuristic optimization method based on simulating the educational process. The algorithm organizes the population of solutions into classes with students and teachers, where agents learn through three mechanisms: following the best in the class, using personal experience, and sharing knowledge between classes.
Gaussian Processes in Machine Learning (Part 1): Classification Model in MQL5
The article considers the classification model of Gaussian processes. We will start by studying its theoretical principles moving on to the practical development of the GP library in MQL5.
Neural Networks in Trading: Actor—Director—Critic (Final Part)
The Actor–Director–Critic framework is an evolution of the classic agent learning architecture. The article presents practical experience of its implementation and adaptation to financial market conditions.
CSV Data Analysis (Part 4): Building an Automated Python-Driven Comparative Analysis Module for MQL5 Strategy Validation
The article presents a reproducible MetaTrader 5 to Python pipeline for large-scale indicator research. An MQL5 export schema captures fixed columns, including custom lag and whipsaw counters. A baseline module performs parameter-matched comparisons across symbols and timeframes, while a walk-forward module locks the InSample optimum and evaluates it on unseen data. Readers gain unbiased robustness measurements and automation that removes manual selection bias.
Swing Extremes and Pullbacks (Part 4): Dynamic Pullback Depth Using Volatility Models
This article replaces binary swing validation with a volatility‑normalized pullback model. Retracement depth is measured as a ratio of the prior impulse and calibrated to a rolling ATR regime, while entries require a minimum quality score and confirmation by structure or liquidity signals. The five‑layer design integrates detection, validation, liquidity mapping, regime‑aware scoring, and execution, helping you filter weak corrections and size stops dynamically to current conditions.
From Static MA to Adaptive Filtering (Part 1): Introducing SAMA with NLMS in MQL5
This article introduces the Self-Adaptive Moving Average (SAMA), an adaptive filter leveraging the Normalized Least Mean Squares (NLMS) algorithm. It explores why fixed-period averages fail, how NLMS adapts bar by bar, and the engineering protections required for production. This conceptual and mathematical foundation prepares you for the MQL5 code implementation in Part 2.
MQL5 Trading Tools (Part 36): Adding Shape and Annotation Tools with In-Place Label Editing to the Canvas Drawing Layer
We add eight shape tools and nine annotation tools to the canvas and implement a full in-place label-editing system. The article walks through geometry, AA rendering, shared word-wrap and supersampled text helpers, and the caret-driven state machine for typing, navigation, and selection. This yields a complete, consistent annotation toolkit with editable labels that plugs into the prior interaction pipeline.
A Generic Object Pool in MQL5: Eliminating Heap Fragmentation in High-Frequency Indicators
High-frequency MQL5 indicators that instantiate objects on every tick accumulate allocation overhead and timing jitter in OnCalculate(). This article constructs a generic templated object pool using a free-list index array, delivering O(1) Acquire() and Release() operations. The design includes double-release protection, strict separation of payload state from pool metadata in Reset(), and a fixed-capacity free list with no heap fallback. A dual-path custom indicator benchmark measures per-tick overhead difference using GetMicrosecondCount().
Market Microstructure in MQL5 (Part 5): Microstructure Noise
The article extends MicroStructure_Foundation.mqh with a MicrostructureAnalysis struct and five functions that decompose M1 price variation into a quoted spread proxy, Roll-implied spread, OHLC-based noise ratio, order imbalance, and an adverse selection component. A wrapper populates these fields and links them to the volatility suite from Part 4. Empirical thresholds come from 602 NQ E-mini NY sessions (Jan 2024–Jun 2026), helping you gate volatility signals, size risk, and recognize spread-driven frictions.
CSV Data Analysis (Part 3): Engineering a Python Analytics Pipeline for MetaTrader 5 CSV Exports
MetaTrader 5 provides rich performance data but limited structural analysis. This article shows how to export results to CSV from MQL5 and build five Python visualizations that expose cross-asset parameter consistency, the lag‑versus‑noise trade-off, walk‑forward decay, drawdown depth and duration, and intraday hour‑by‑day clusters. A unified automation module runs the full pipeline on any new export to deliver repeatable diagnostics.
MQL5 Wizard Techniques you should know (Part 95): Using Disjoint Set Union and Deep Belief Network in a Custom Signal Class
For this article we switch to a custom MQL5 Wizard class that examines entry Signals. Our custom class is ‘CSignalDSUDBN’ this time around, and is coded by combining the Disjoint Set Union algorithm with a Deep Belief network. As has been the case throughout these series, our model is testable with MQL5 Wizard-Assembled Expert Advisors that can be tuned with different trailing stops and money management classes.
Implementing a Fluent Interface Builder Pattern for MQL5 Order Construction
Manual population of MqlTradeRequest leaves cross-field rules unchecked, creating silent misconfigurations at execution time. A fluent COrderBuilder for MQL5 adds pointer-based method chaining, per-field validation, and directional SL/TP checks against broker stop‑level constraints. Its Send() method runs a four-stage gate—flag completeness, cross-field consistency, OrderCheck(), then OrderSend()—so configuration errors are caught early and order code stays clear and reusable.
Engineering a Self-Healing Expert Advisor in MQL5 (Part 2): Restart-Safe Virtual Trade Protection
Build a restart-aware virtual protection layer on top of the SQLite persistence from Part 1. The EA reconstructs hidden stop-loss and take-profit after restart, verifies current price against recovered exits, and closes or continues positions accordingly. The result is a consistent recovery path that detects managed positions and sustains safe runtime management.
Building a Type-Safe Event Bus in MQL5: Decoupling EA Components Without Global Variables
A typed publish-subscribe event bus in MQL5 replaces global variables and direct cross-references. Using an abstract listener interface and an enum-indexed subscription table, a signal engine, order manager, and drawdown monitor communicate only through the bus, with no shared state. The article analyzes dispatch overhead, pointer validation, and recursive publish risks, helping you design decoupled, testable EAs.
Extremal Optimization (EO)
The article discusses the Extremal Optimization (EO) algorithm, an optimization method inspired by the Bak-Sneppen self-organized criticality model, where evolution occurs through the elimination of the worst-case components of the system. The modified population version of the algorithm demonstrates a shift away from theoretical principles in favor of practical efficiency, leading to the creation of powerful computational tools.
Neural Networks in Trading: Actor—Director—Critic
We invite you to explore the Actor-Director-Critic framework, which combines hierarchical learning and a multi-component architecture for creating adaptive trading strategies. In this article, we take a detailed look at how using the Director to classify the Actor's actions helps to effectively optimize trading decisions and improve the robustness of models in financial market conditions.
Implementing Partial Position Closing in MQL5
This article develops a class for managing partial position closing in MQL5 and then integrates it into an Order Blocks Expert Advisor. It also presents test results comparing the strategy with and without partial position closing, and analyzes the conditions under which this approach can help provide and maximize profit. In conclusion, partial position closing can be highly beneficial in trading strategies, especially those focused on wider price movements.
Neural Networks in Trading: Skill Hierarchy for Adaptive Agent Behavior (Final Part)
The article discusses the practical implementation of the HiSSD framework in algorithmic trading tasks. It explains how the skill hierarchy and adaptive architecture can be used to build sustainable trading strategies.
Custom Debugging and Profiling Tools for MQL5 Development (Part III): Regression Gates for Performance and Trading Rules
This article adds a regression gate to the MQL5 debugging and profiling workflow. It keeps the Part II profiler, TestLite runner, and trading math helper as contracts, then compares current profiler evidence with an accepted baseline. The workflow also adds symbol-aware assertions, compact status files, and report tables so performance drift, missing tests, and broker-assumption problems are visible before a build is accepted.
Quantum Neural Network in MQL5 (Part I): Creating the Include File
The article presents a new approach to creating trading systems based on quantum principles and artificial intelligence. The author describes the development of a unique neural network that goes beyond classical machine learning by combining quantum mechanics with modern AI architectures.
MQL5 Wizard Techniques you should know (Part 94): Using Reservoir Sampling and Linear Regression in a Custom Trailing Stop Class
For this article we rotate to a custom MQL5 Wizard class implementation that explores Trailing Stops. Our custom class is ‘CTrailingReservoirLinReg’ that we derive by combining the Reservoir Sampling algorithm with a Linear Regression network. As has been the case throughout these series, this formulation is testable with MQL5 Wizard Assembled Expert Advisors that can be tuned with various entry signals and money management classes.
Step-by-Step Implementation of a Local Stop Loss System in MQL5
This article shows how to build a local stop-loss system in an MQL5 Expert Advisor that keeps stop levels on the terminal side. It walks through the execution logic, event handlers, inputs, and an OOP design using CTrade, CPositionInfo, CHashMap/CHashSet, and chart objects. You will implement multi-position tracking, draggable stops, visual spacers and labels, plus cleanup and disconnection behavior to create a practical risk-control utility.
CSV Data Analysis (Part 2): Building a Production-Grade CSV Export and Parsing Pipeline for Quantitative Strategy Analysis
MQL5's file system operates within a strict sandbox. Understanding its access flags and path resolution rules is the foundation of any reliable export pipeline. This article builds a CCSVExporter class that handles file creation, safe appending, and error recovery. It also covers CSV parsing, field tokenization, concurrent access conflicts, and write-buffering strategies for high-frequency optimization runs.
MQL5 Custom Symbols: Creating a 3D Bars Symbol
The article provides a detailed guide to creating the innovative 3DBarCustomSymbol.mq5 indicator, which generates custom symbols in MetaTrader 5 that combine price, time, volume, and volatility into a single three-dimensional representation. The mathematical foundations, system architecture, practical aspects of implementation and application in trading strategies are considered.
Position Management: A Reusable Trade Journal with Live Maximum Adverse Excursion, Maximum Favorable Excursion, and R-Multiple Tracking in MQL5
This article presents CTradeJournal, a self-contained MQL5 class for live tracking of open positions at tick frequency. It maintains MAE, MFE, and initial risk in money, calculates the R-multiple when a position closes, and writes a complete CSV record. The text explains the design choices, provides the implementation, and shows simple EA integration so you can analyze entries, stop placement, and outcome distribution.
CSV Data Analysis (Part 1): CSV Export Engine for MQL5 Multi-Core Optimizations
Multi-core optimization in MetaTrader 5 can silently drop results when parallel agents contend for the same CSV file. A reusable MQL5 export engine applies an iteration-based spin-lock to acquire the file handle reliably and append rows without loss. It persists custom metrics such as the Sortino Ratio, average trade duration, and signal-quality measures (lag and whipsaws) into a consolidated CSV for downstream analysis.
Exploring Regression Models for Causal Inference and Trading
The article explores the possibility of using regression models in algorithmic trading. Regression models, unlike binary classification, allow for the creation of more flexible trading strategies by quantifying predicted price changes.
Recurrence Network Analysis (RNA) in MQL5: From Recurrence Matrices to Complex Networks
The article extends the MQL5 recurrence library to Recurrence Network Analysis (RNA) by treating recurrence matrices as adjacency matrices of undirected graphs. It implements core network metrics—clustering, transitivity, average path length, betweenness, assortativity, and density—and applies them in rolling windows for single-series RNA and Joint RNA (JRNA). A modular metrics engine and two indicators visualize the evolving network structure on MetaTrader 5 charts for practical time-series analysis.
How to Detect and Normalize Chart Objects in MQL5 (Part 2): Collecting and Structuring Data from Complex Analytical Objects
Manually drawn analytical object tools like Fibonacci tools, and Andrews Pitchforks are invisible to automated trading logic. This article extends a base detector to extract anchor points, level arrays, and geometric offsets from complex objects. You will implement a reusable collector that normalizes the raw chart data into structured memory arrays, ready for strategy decisions.
MQL5 Trading Tools (Part 35): Adding Channel, Pitchfork, Gann, and Fibonacci Tools to the Canvas Drawing Layer
We extend the canvas drawing layer from the previous part with seven new categories of multi-anchor analytical drawing tools, covering three channel variants, three pitchfork variants, three Gann tools, and the six Fibonacci tools. We work through how each tool encodes its geometry on the canvas, how derived handles let users reshape compound shapes coherently, and how shared helpers handle ray clipping, scanline filling, and anti-aliased arc rendering. By the end, we will have a full set of analytical drawing tools that live on the same interactive canvas alongside the basic line tools from the previous part.
Feature Engineering for ML (Part 5): Microstructural Features in Python
This article implements the Chapter 19 microstructure suite in afml.features.microstructure and explains a two-layer design for OHLCV-only and tick-augmented workflows. We cover Roll and Corwin–Schultz spread/volatility, Kyle's, Amihud's, and Hasbrouck's lambdas, VPIN, and bar‑level imbalance features, all in Numba‑accelerated kernels. A single np.searchsorted pass resolves bar boundaries, enabling prange parallelization and producing a bar‑indexed feature matrix ready for downstream ML models.
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 presents an Equity Governance Framework in MQL5 that monitors drawdown conditions, evaluates equity pressure, and dynamically controls trading activity through a state-driven risk management model. By combining drawdown analysis, cooldown logic, trade authorization, and execution restrictions, the framework demonstrates how trading discipline can be engineered directly into code using a modular and extensible architecture.
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 innovative methodology helps uncover hidden patterns in financial markets and optimize trading strategies in decentralized environments.
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 model by SSE is selected, and its parameters (eg, alpha min, alpha max or alpha_0, gamma) become the cascade inputs for multifractal simulation.
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 to build a dynamic MQL5 module that retrieves real-time swap data and converts it into actual profit or loss in your account currency. You will learn how to program an Expert Advisor that automatically calculates if a trade is worth holding based on carry income and adjusts your position size to account for expected interest. It is a practical guide to turning a hidden cost into a mathematical advantage for your trading systems.