CFTC Data Mining in Python and Building an AI Model
CFTC Data Mining in Python and Building an AI Model
Let's try mining CFTC data, downloading COT and TFF reports via Python, connecting all this with MetaTrader 5 quotes and an AI model, and get forecasts. What are COT reports in the Forex market? How to use COT and TFF reports for forecasting?
Three MACD Filters on US_TECH100: Five Years of Broker Data
Three MACD Filters on US_TECH100: Five Years of Broker Data
This article tests three common filters on a standard MACD crossover for US_TECH100 H1 using five years of broker-native data. Filters are layered incrementally: regime, higher timeframe (HTF) alignment, and US session timing, to isolate each one's marginal impact. Results show session timing contributes far more than indicator refinements, while regime and HTF add little on their own. Includes a reproducible MQL5 regime classifier.
Stress Testing Trade Sequences with Monte Carlo in MQL5
Stress Testing Trade Sequences with Monte Carlo in MQL5
A backtest shows only one path among many possible outcomes. This MQL5 script performs 1000 bootstrap Monte Carlo resamples of a trade P&L series, draws a percentile fan chart on the chart via CCanvas, and reports probability of ruin, value at risk, and 95th‑percentile worst drawdown. The result is a practical view of path risk and drawdown exposure beyond a single equity curve.
Algorithmic Trading Without the Routine: Quick Trade Analysis in MetaTrader 5 with SQLite
Algorithmic Trading Without the Routine: Quick Trade Analysis in MetaTrader 5 with SQLite
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 working with the database via MetaEditor are demonstrated. The approach allows automating the journal, accelerating calculations, and performing analysis without complicating the EA code.
Feature Engineering for ML (Part 2): Implementing Fixed-Width Fractional Differentiation in MQL5
Feature Engineering for ML (Part 2): Implementing Fixed-Width Fractional Differentiation in MQL5
This article delivers a production-grade MQL5 implementation of fixed-width fractional differentiation for live MetaTrader 5 feeds. We introduce a header-only CFFDEngine that precomputes weights without a fixed cap, performs O(width) per-bar updates, and avoids per-tick allocations. The FFD.mq5 indicator supports all ENUM_APPLIED_PRICE types and prev_calculated optimization. Validation scripts confirm numerical equivalence with the standard Python frac diff_ffd pipeline.
How to implement AutoARIMA forecasting in MQL5
How to implement AutoARIMA forecasting in MQL5
This article presents an MQL5 implementation of AutoARIMA that builds ARIMA models without manual tuning. It estimates d via a variance-based heuristic, fits ARMA(p,q) by gradient optimization with Adam, and selects p and q using AICc. The code returns a one-step-ahead price forecast by differencing, model estimation, and integration back to price level, ready to call on a Close series.
MetaTrader 5 and the MQL5 Economic Calendar: How to Turn News into a Reproducible Trading System
MetaTrader 5 and the MQL5 Economic Calendar: How to Turn News into a Reproducible Trading System
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 provides a working mechanism for exporting history to an .EX5 resource for deterministic testing using the same algorithm.
Exploring Conformal Forecasting of Financial Time Series
Exploring Conformal Forecasting of Financial Time Series
In this article, we will consider conformal predictions and the MAPIE library that implements them. This approach is one of the most modern ones in machine learning and allows us to focus on risk management for existing diverse machine learning models. Conformal predictions, by themselves, are not a way to find patterns in data. They only determine the degree of confidence of existing models in predicting specific examples and allow filtering for reliable predictions.
Cross Recurrence Quantification Analysis (CRQA) in MQL5: Building a Complete Analysis Library
Cross Recurrence Quantification Analysis (CRQA) in MQL5: Building a Complete Analysis Library
This article extends the MQL5 RQA library to Cross-Recurrence Quantification Analysis (CRQA) for comparing two time series. We implement dual‑series embedding, cross‑recurrence matrix construction, adapted metrics (CRR, CDET, CLAM, CENTR, and others), and rolling‑window analysis, with optional GPU acceleration via OpenCL. A ready-to-use indicator compares two symbols in real time, supporting timestamp alignment and normalization for practical inter-market analysis.
MetaTrader 5 Machine Learning Blueprint (Part 1): Data Leakage and Timestamp Fixes
MetaTrader 5 Machine Learning Blueprint (Part 1): Data Leakage and Timestamp Fixes
Before we can even begin to make use of ML in our trading on MetaTrader 5, it’s crucial to address one of the most overlooked pitfalls—data leakage. This article unpacks how data leakage, particularly the MetaTrader 5 timestamp trap, can distort our model's performance and lead to unreliable trading signals. By diving into the mechanics of this issue and presenting strategies to prevent it, we pave the way for building robust machine learning models that deliver trustworthy predictions in live trading environments.
One-Dimensional Singular Spectrum Analysis
One-Dimensional Singular Spectrum Analysis
The article examines the theoretical and practical aspects of the singular spectrum analysis (SSA) method, which is an efficient method of time series analysis that allows one to represent the complex structure of a series as a decomposition into simple components, such as trend, seasonal (periodic) fluctuations and noise.
Battle Royale Optimizer (BRO)
Battle Royale Optimizer (BRO)
The article explores the Battle Royale Optimizer algorithm — a metaheuristic in which solutions compete with their nearest neighbors, accumulate “damage,” are replaced when a threshold is exceeded, and periodically shrink the search space around the current best solution. It presents both pseudocode and an MQL5 implementation of the CAOBRO class, including neighbor search, movement toward the best solution, and an adaptive delta interval. Test results on the Hilly, Forest, and Megacity functions highlight the strengths and limitations of the approach. The reader is provided with a ready-to-use foundation for experimentation and tuning key parameters such as popSize and maxDamage.
Market Simulation (Part 16): Sockets (X)
Market Simulation (Part 16): Sockets (X)
We are close to completing this challenge. However, before we begin, I want you to try to understand these two articles—this one and the previous one. That way, you will truly understand the next article, in which I will cover exclusively the part related to MQL5 programming. But I will also try to make it understandable. If you do not understand these last two articles, it will be difficult for you to understand the next one, because the material accumulates. The more things there are to do, the more you need to create and understand in order to achieve the goal.
Coral Reefs Optimization (CRO)
Coral Reefs Optimization (CRO)
The article presents a comprehensive analysis of the Coral Reef Optimization (CRO) algorithm, a metaheuristic method inspired by the biological processes of coral reef formation and development. The algorithm models key aspects of coral evolution: broadcast spawning, brooding, larval settlement, asexual reproduction, and competition for limited reef space. Particular attention is paid to the improved version of the algorithm.
MQL5 Wizard Techniques you should know (Part 90): Fenwick Tree Money Management with 1D CNN in MQL5
MQL5 Wizard Techniques you should know (Part 90): Fenwick Tree Money Management with 1D CNN in MQL5
This article implements a Fenwick Tree (Binary Indexed Tree) for volume-aware money management inside an MQL5 Wizard Expert Advisor. We structure cumulative volume in O(log n) and apply four scaling modes—linear, conservative, aggressive, and mean-reversion—optionally gated by a lightweight 1D CNN. Practical tests compare the algorithm alone versus the CNN‑filtered approach to illustrate adaptive lot sizing and risk control under varying volume topologies.
Biogeography-Based Optimization (BBO)
Biogeography-Based Optimization (BBO)
Biogeography-Based Optimization (BBO) is an elegant global optimization method inspired by natural processes of species migration between islands within archipelagos. The algorithm is based on a simple yet powerful idea: high-quality solutions actively share their characteristics, while low-quality ones actively adopt new features, creating a natural flow of information from the best solutions to the worst. A unique adaptive mutation operator provides an excellent balance between exploration and exploitation. BBO demonstrates high efficiency on a variety of tasks.
Bivariate Copulae in MQL5 (Part 3): Implementation and Tuning of Mixed Copula Models in MQL5
Bivariate Copulae in MQL5 (Part 3): Implementation and Tuning of Mixed Copula Models in MQL5
The article extends our copula toolkit with mixed copulas implemented natively in MQL5. We construct Clayton–Frank–Gumbel and Clayton–Student–t–Gumbel mixtures, estimate them via EM, and enable sparsity control through SCAD with cross‑validation. Provided scripts tune hyperparameters, compare mixtures using information criteria, and save trained models. Practitioners can apply these components to capture asymmetric tail dependence and embed the selected model in indicators or Expert Advisors.
Beyond GARCH (Part I): Mandelbrot's MMAR versus Engle's GARCH
Beyond GARCH (Part I): Mandelbrot's MMAR versus Engle's GARCH
This article starts the MMAR pipeline on EURUSD M5 data. We load market data via the MetaTrader5 Python API and run partition-function analysis with non-overlapping intervals to test for multifractal scaling. The result is an evidence-based decision on fractality, a prerequisite for building MMAR and for choosing whether to proceed beyond GARCH.
MQL5 Wizard Techniques you should know (Part 89): Using Bitwise Vectorization with Perceptron Classifiers
MQL5 Wizard Techniques you should know (Part 89): Using Bitwise Vectorization with Perceptron Classifiers
This article presents a custom MQL5 signal class, CSignalBitwisePerceptron, for ultra-lightweight entry logic. It packs 64 bars into a single uint64 via bitwise vectorization and evaluates them with a perceptron that sums weights only for active bits. A two-gate flow (algorithmic hash map plus neural threshold) minimizes array iteration and heavy math. Readers get a practical template to cut latency and refine entry validation.
Beyond GARCH (Part II): Measuring the Fractal Dimension of Markets
Beyond GARCH (Part II): Measuring the Fractal Dimension of Markets
Building on the partition function analysis from Part 1, this article deepens the theoretical foundation before completing the analytical pipeline. We first give a full treatment of the Hurst exponent: what it measures, what it implies about market memory, and why it matters for the MMAR. This is followed by an intuitive exploration of multifractal spectra and what f(α) reveals about volatility heterogeneity. We then move to implementation: extracting the scaling function τ(q), estimating H via R/S analysis, and fitting the multifractal spectrum across four candidate distributions. By the end, we have the complete parameter set needed to construct the MMAR process in Part 3. Part 2 of an eight-part series.
Market Microstructure in MQL5: Measuring long memory in MQL5 with Hurst estimators (Part 2)
Market Microstructure in MQL5: Measuring long memory in MQL5 with Hurst estimators (Part 2)
Part 2 focuses on practical long-memory detection for intraday data. Three complementary Hurst estimators are implemented and combined into a confidence‑weighted composite, with confidence tied to valid regression scales. The final H and confidence populate the shared analysis struct, enabling indicators to act only when H departs from the neutral 0.40–0.60 band and to select trend‑following above 0.60 or mean‑reversion below 0.40.
Beyond GARCH (Part III): Building the MMAR and the Verdict
Beyond GARCH (Part III): Building the MMAR and the Verdict
With the multifractal parameters from Part 2 in hand, this article builds the full MMAR process. We construct the multiplicative cascade for trading time, generate Fractional Brownian Motion via Davies-Harte FFT, and combine both into X(t) = B_H[theta(t)]. A 100-path Monte Carlo simulation produces the volatility forecast, which we then pit against GARCH on the same EURUSD M5 data. Does Mandelbrot's fractal architecture outforecast Engle's conditional variance framework? Part 3 of a eight-part series leading to a native MQL5 library and Expert Advisor.
Eagle Strategy (ES)
Eagle Strategy (ES)
Eagle Strategy is an algorithm that mimics the eagle's two-phase hunting strategy: global search via Levy flights using Mantegna method, alternating with intense local exploitation using the firefly algorithm, a mathematically sound approach to balancing exploration and exploitation, and a bioinspired concept that combines two natural phenomena into a single computational method.
MetaTrader 5: Build a Market to Suit Your Strategy — Renko/Range/Volume, Synthetics, and Stress Tests on Custom Symbols
MetaTrader 5: Build a Market to Suit Your Strategy — Renko/Range/Volume, Synthetics, and Stress Tests on Custom Symbols
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 stress tests (spread widening, stop level changes) taking into account platform limitations. Besides, you will get some practice of handling CiCustomSymbol and routing orders to a real symbol through the CustomOrder wrapper with ready-made code fragments.
Price Action Analysis Toolkit Development (Part 45): Creating a Dynamic Level-Analysis Panel in MQL5
Price Action Analysis Toolkit Development (Part 45): Creating a Dynamic Level-Analysis Panel in MQL5
In this article, we explore a powerful MQL5 tool that let's you test any price level you desire with just one click. Simply enter your chosen level and press analyze, the EA instantly scans historical data, highlights every touch and breakout on the chart, and displays statistics in a clean, organized dashboard. You'll see exactly how often price respected or broke through your level, and whether it behaved more like support or resistance. Continue reading to explore the detailed procedure.
Market Microstructure in MQL5: Estimating ARFIMA d with GPH (Part 3)
Market Microstructure in MQL5: Estimating ARFIMA d with GPH (Part 3)
A GPH‑based estimator for d, the key ARFIMA parameter, is added to MicroStructure_Foundation.mqh. GPHEstimator() computes d via log‑periodogram regression, while PopulateARFIMAAnalysis() stores d with an R² confidence score and validates the theoretical relationship H = d + 0.5. An empirical study on 72 US100 M1 sessions confirms pooled d = −0.006, consistent with the random walk boundary established in Part 2.
From "Best Pass" to Robust Solutions: Exploring the Optimization Surface in MetaTrader 5
From "Best Pass" to Robust Solutions: Exploring the Optimization Surface in 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. The goal is to find stable areas of configurations and validate them with forward optimization for reliable implementation.
Overcoming Accessibility Problems in MQL5 Trading Tools (Part IV): Remote voice trading
Overcoming Accessibility Problems in MQL5 Trading Tools (Part IV): Remote voice trading
Learn a practical way to execute MetaTrader 5 trades from Telegram voice notes using a Python middleware and an MQL5 EA acting as an HTTP client. The article covers architecture, WebRequest polling, in-memory queuing, JSON parsing with null-terminator stripping, and a constrained command grammar with a 0.001-lot default. You will configure the environment and validate round‑trip latency suitable for mobile data connections.
MQL5 Wizard Techniques you should know (Part 91): Using Skip Lists and a Hopfield Network in a Custom Trailing Class
MQL5 Wizard Techniques you should know (Part 91): Using Skip Lists and a Hopfield Network in a Custom Trailing Class
For our next Exploration on notions that are testable with the MQL5 Wizard we examine if Skip Lists and the Hopfield Network can give us a profit-guarding trailing strategy. Trailing Stop Management, as already argued, can be overlooked in most trading systems at the expense of Entry Signals or even Money Management. Trailing stops can make all the difference in certain situations such as trending markets, and thus we test this out with GBP USD.
How to Detect and Normalize Chart Objects in MQL5 (Part 1): Building a Chart Object Detection Engine
How to Detect and Normalize Chart Objects in MQL5 (Part 1): Building a Chart Object Detection Engine
This article addresses the interpretative gap between visual chart objects and algorithmic execution. You will build a systematic detector that iterates over all chart objects, identifies analytical types, and normalises their geometric data (time and price coordinates) into a structured SChartObjectInfo array. The implementation uses raw MQL5 functions, a filter‑extract‑store pipeline, and a timer‑driven test EA, resulting in a reusable framework for rule‑based trading inputs.
3D Visualization Without External Libraries: How MetaTrader 5 Reveals Optimization Results via MQL5 + DX11
3D Visualization Without External Libraries: How MetaTrader 5 Reveals Optimization Results via MQL5 + DX11
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 clusters, and multi-dimensional trading scenarios. The basics of the DX pipeline, working with shaders, binding mouse and keyboard events, and objective technological limitations are discussed in detail. The article is intended for MQL5 developers and algorithmic traders who are ready to transform strategy metrics into understandable 3D analytical landscapes, where the visual layer accelerates decision-making.
Joint Recurrence Quantification Analysis (JRQA) in MQL5: Detecting Simultaneous Recurrence in Two Series
Joint Recurrence Quantification Analysis (JRQA) in MQL5: Detecting Simultaneous Recurrence in Two Series
We extend the RQA library for MetaTrader 5 with JRQA, which detects when two series simultaneously revisit their own past states. The article covers the joint recurrence matrix, twelve JRQA metrics (including TREND and COMPLEXITY), dual-epsilon configuration, and a rolling-window engine with OpenCL acceleration and automatic CPU fallback. A practical indicator plots JRR, JDET, JLAM, JENTR, and JTREND for any symbol pair with timestamp alignment and normalization.
Covariance Matrix Adaptation Evolution Strategy (CMA-ES)
Covariance Matrix Adaptation Evolution Strategy (CMA-ES)
The article explores one of the most interesting non-gradient optimization algorithms, which learns to understand the geometry of the objective function. We will focus on the classical implementation of CMA-ES with a slight modification - replacing the normal distribution with the power one. We will thoroughly examine the math behind the algorithm, as well as practical implementation, and check where CMA-ES is unbeatable and where it should be avoided.
Building Volatility Models in MQL5 (Part II): Implementing GJR-GARCH and TARCH in MQL5
Building Volatility Models in MQL5 (Part II): Implementing GJR-GARCH and TARCH in MQL5
The article implements GJR-GARCH and TARCH in an MQL5 volatility library and explains why asymmetry improves on standard ARCH/GARCH. It covers model formulation, parameterization, and usage through derived classes and scripts. Readers get code examples for calibration and one-step-ahead forecasting on real data to support risk and diagnostics.