From Matrices to Models: How to Build an ML Pipeline in MQL5 and Export It to ONNX
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 the MetaTrader 5 strategy tester provides metrics for analyzing the system behavior.
Feature Engineering for ML (Part 3): Session-Aware Time Features for Forex Machine Learning
The article addresses the loss of temporal information in ML pipelines by encoding periodic time variables with Fourier harmonics and adding forex session structure. It implements session and overlap flags, lagged session volatility, and calendar effects, then prunes features by timeframe. The get time features function returns an index‑aligned, ML‑ready set of time features suitable for integration with price‑based signals.
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.
The MQL5 Standard Library Explorer (Part 11): How to Build a Matrix-Based Market Structure Indicator in MQL5
Learn to engineer an MQL5 indicator that converts trend, momentum, and volatility into a single raw score using a matrix.mqh (ALGLIB). The article covers a separate‑window oscillator to validate the core mathematics, then a main‑chart indicator that plots non‑repainting buy/sell arrows when the score crosses user‑defined thresholds. An optional long‑term EMA filter, a minimum‑bar cooldown, and built‑in alerts make the tool practical for live trading.
MetaTrader 5 Machine Learning Blueprint (Part 15): How to Calibrate Profit-Taking and Stop-Loss Targets from Synthetic Data
This article applies the Optimal Trading Rule from AFML Chapter 13 to set profit targets and stop-losses without in-sample calibration. We model post-entry P&L with a discrete Ornstein–Uhlenbeck process, run a 100,000-path search, and implement Python, multiprocessing, and a Numba @njit parallel kernel (242× faster). The result is an optimal (PT, SL) under three forecast specifications, constrained by the prop-firm daily loss limit.
MetaTrader 5 Machine Learning Blueprint (Part 14): Transaction Cost Modeling for Triple-Barrier Labels in MQL5
The article replaces hardcoded cost assumptions in triple-barrier labeling with measured inputs. An MQL5 script captures spread distribution, swap rates, and symbol metadata from your broker, and a Python model converts them into a broker-calibrated min ret you can pass to get events. Labels then reflect the actual round-trip friction for your instrument and holding period.
MQL5 Trading Tools (Part 30): Class-Based Tool Palette Sidebar
We refactor the Tools Palette from a flat, function-based panel into a modular, class-driven sidebar in MQL5. The design introduces supersampled canvas rendering for anti-aliased shapes, theme control, a category registry, snap alignment, and selective corner rounding. The result is a reusable, scalable sidebar foundation that you can extend with tool selection, dragging, and fly-out menus in future steps.
Market Microstructure in MQL5: Robust Foundation (Part 1)
This article builds the foundation layer of a twelve-part MQL5 market microstructure toolkit. It implements guarded math helpers (SafeDivide, SafeLog, SafeSqrt, SafeExp, SafeTanh), robust data validation (ValidateSymbolV2, SafeCopyClose), trimmed statistical estimators (robust mean var), a linear regression slope, shared structs, and an FFT. You compile a single include file that hardens indicators and expert advisors against silent numerical failures and standardizes data flow for later parts.
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.
Beyond the Clock (Part 1): Building Activity and Imbalance Bars in Python and MQL5
The article replaces clock-based sampling with López de Prado's alternative bar types and provides two aligned implementations: a unified Python module for batch tick histories and an object‑oriented MQL5 library for live EAs. It covers Parquet/Dask infrastructure, data cleaning, and a single API. Practical issues are solved explicitly: zero‑tick time‑bar filtering, imbalance threshold initialization, EWM state persistence, and parity between Python and MQL5 outputs.
From Novice to Expert: Creating an MTF CRT Overlay Indicator in MQL5
Higher-timeframe CRT ranges are informative, yet traders often execute on lower timeframes without that context. We implement an MQL5 indicator that reads higher-timeframe OHLC, projects the full candle range, body, and wicks onto the active lower-timeframe chart, and marks entries, stops, and targets. This improves situational awareness and removes the need to switch windows.
Engineering Trading Discipline into Code (Part 5): Account-Level Risk Enforcement in MQL5
We introduce an MQL5 discipline engine that enforces risk consistently at the account level. It continuously scans positions from any source, validates SL/TP, equity-based exposure, and target R:R, and automatically corrects deviations by setting levels or adjusting volume. The result is uniform risk structure across manual and EA trades, supported by on-chart feedback and mode-based control.
Building an Object-Oriented FVG Scanner in MQL5
Create an object-oriented fair value gap (FVG) scanner in MQL5 and display liquidity gaps directly on a MetaTrader 5 chart, this article formalizes the imbalance geometry based on three candlesticks, synchronizes OHLC arrays with CopyRates, manages rectangles without leaks, and monitors mitigation in real time. It also shows how to integrate this class into an Expert Advisor with a strict new bar filter for stable and efficient execution.
Graph Theory: Heuristic Search Algorithm (A-Star) Applied in Trading
The article applies the A* heuristic to market structure by modeling validated swing highs and lows as graph nodes and weighting edges with ATR‑normalized distance, spread, and noise penalties. The engine searches the most efficient route to infer trade direction and targets, then filters signals by directional ratio, total path cost, and opposing swings. It anchors TP to the final node and SL to prior structure, with on‑chart visualization and configurable inputs.
MQL5 Wizard Techniques you should know (Part 88): Using Blooms Filter with a Custom Trailing Class
Our next focus in these series on ideas that can be rapidly prototyped with the MQL5 Wizard, is a Custom Trailing class that uses the Blooming Filter. Trailing Stop systems are an optional but very resourceful part to any trading system that we want to explore more in these series besides the traditional Entry Signals.
Price Action Analysis Toolkit Development (Part 68): Price-Attached RSI Panel in MQL5
We present a chart-embedded RSI panel that removes the need for a separate window by attaching momentum directly to live price. The article explains the design and MQL5 code: real-time RSI retrieval, slope-based signal classification, and adaptive positioning. Traders get RSI value, state, and signal strength where decisions are made, improving clarity across timeframes.
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.
Mining Central Bank Balance Sheet Data to Get a Picture of Global Liquidity
Mining central bank balance sheet data provides a picture of global liquidity in the Forex market and key currencies. We combine data from the Fed, ECB, BOJ and PBoC into a composite index and use machine learning to uncover hidden patterns. This approach turns raw data into real trading signals by combining fundamental and technical analysis.
MQL5 Wizard Techniques you should know (Part 87): Volatility-Scaled Money Management with Monotonic Queue in MQL5
This article presents a custom MQL5 money management class that adapts position sizing to real-time volatility using a monotonic queue for O(N) sliding-window extremes. The class applies inverse volatility scaling and optionally validates risk with an RBF network. We show implementation details in the Optimize method and compare results with the inbuilt Size-Optimized class to assess latency and risk control benefits.
Price Action Analysis Toolkit Development (Part 67): Automating Support and Resistance Monitoring in MQL5
This article implements a complete MQL5 Expert Advisor that monitors manually drawn support and resistance levels in real time. It synchronizes horizontal lines, detects approaches, touches, breakouts, reversals, and retests, and adds optional candlestick pattern checks. Alerts and on‑chart markers provide clear, repeatable feedback, allowing you to keep manual analysis while automating the surveillance of key price levels.
MQL5 Trading Tools (Part 29): Step-by-Step Butterfly Animation on Canvas
In this article, we expand our butterfly animation program with a four-stage animation pipeline: sequential curve drawing, smooth wing fill fading, detailed body rendering, and continuous flight. We implement a timer-driven state machine, four oscillators for wing flapping, vertical bobbing, horizontal sway, and tilt, as well as a neon glow around the wing outlines and a cyclical color change based on hue. You will learn how to structure these effects on the MetaTrader 5 canvas for clean and controlled playback.
Trading Options Without Options (Part 1): Basic Theory and Emulation Through Underlying Assets
The article describes a variant of options emulation through an underlying asset implemented in the MQL5 programming language. The pros and cons of the chosen approach are compared with real exchange options using the example of the FORTS futures market of the MOEX Moscow exchange and the Bybit crypto exchange.
Building a Trade Analytics System (Part 2): How to Capture Closed Trades and Send JSON in MQL5
We build a lightweight bridge that captures closed trades in MetaTrader 5 and sends them to an external backend over HTTP as JSON. It uses OnTradeTransaction for event detection, reads details from deal history, assembles a JSON payload, and posts it via WebRequest. A local Flask API is used to test the flow, delivering a working path to move trade data outside the terminal.
Automating Trading Strategies in MQL5 (Part 48): Order Blocks, Inducement, Break of Structure
We implement an MQL5 expert advisor that detects order blocks formed after consolidation breakouts and confirms them with fair value gaps. Each zone is validated by a break of structure and a preceding inducement, then filtered by the higher-timeframe trend. The program adds mitigation tracking, risk-based lot sizing, and two trailing stop modes, providing clear on-chart visuals and backtest-ready trade execution logic.
Neural Networks in Trading: Detecting Anomalies in the Frequency Domain (CATCH)
The CATCH framework combines Fourier transform and frequency patching to accurately identify market anomalies beyond the reach of traditional methods. Let us examine how this approach reveals hidden patterns in financial data.
Neural Networks in Trading: Adaptive Detection of Market Anomalies (Final Part)
We continue to build the algorithms that form the basis of the DADA framework, which is an advanced tool for detecting anomalies in time series. This approach enables effective distinguishing random fluctuations from significant deviations. Unlike classical methods, DADA dynamically adapts to different data types, choosing the optimal compression level in each specific case.
From Novice to Expert: Automating Base-Candle Geometry for Liquidity Zones in MQL5
This article implements an MQL5 module that analyzes the lower‑timeframe bars inside each liquidity‑zone base candle. It detects swing points and applies objective rules to classify the internal structure as an ascending, descending, or symmetrical triangle; a rectangle; M; W; or undefined. The indicator displays geometry labels on the chart and adds the pattern to alerts, reducing manual lower‑timeframe inspection.
Engineering Trading Discipline into Code (Part 4): Enforcing Trading Hours and News Disabling in MQL5
An MQL5 control system that blocks orders outside scheduled trading hours and during scheduled news releases, converting time rules into executable restrictions. It combines a permissions management mechanism, a transaction-level expert advisor, and a visual dashboard for real-time status and upcoming restrictions. Configuration is accomplished using editable files, with caching and a CSV audit log for traceability.
MQL5 Trading Tools (Part 28): Filling Sweep Polygons for Butterfly Curve in MQL5
We expand the capabilities of the MetaTrader 5 butterfly curve canvas by adding multi-layered wing fills, vein lines, scale dots, and a full body (abdomen, thorax, head, eyes, antennae). This article implements polygon fills with vertical and radial gradients, as well as filled circles and ellipses, all using supersampling antialiasing. You will also receive reusable MQL5 helper functions and a rendering order that transforms a simple curve into a customizable, detailed chart illustration.
Self-Learning Expert Advisor with a Neural Network Based on a Markov State-Transition Matrix
Self-training EA with a neural network based on a state matrix. We combine Markov chains with a multilayer neural network MLP developed using the ALGLIB MQL5 library. How can Markov chains and neural networks be combined for Forex forecasting?
Price Movement: Mathematical Models and Technical Analysis
Forecasting the movements of currency pairs is an important factor in trading success. This article explores various price movement models, analyzes their advantages and disadvantages, and explores their practical application in trading strategies. We will consider approaches that allow us to identify hidden patterns and improve the accuracy of forecasts.
Markov Chain-Based Matrix Forecasting Model
We are going to create a matrix forecasting model based on a Markov chain. What are Markov chains, and how can we use a Markov chain for Forex trading?
How to Detect Round-Number Liquidity in MQL5
The article presents an MQL5 method for detecting psychological round numbers by converting prices to strings and counting trailing zeros (ZeroSize). It outlines the theory of institutional liquidity at integers, explains the GetZeroCount logic with tick-size normalization to avoid floating‑point errors, and details hierarchical visualization. Case studies across forex, metals, and crypto, plus timeframe filters and inputs, show how to use confluence and basic risk controls in practice.
Price Action Analysis Toolkit Development (Part 66): Developing a Structured Head and Shoulders Scanner in MQL5
Head and Shoulders patterns are difficult to identify consistently in live market data due to noise and structural ambiguity. This article presents a structured, triangle-based MQL5 indicator that isolates pattern components, constructs the neckline, and validates formations using ATR, symmetry, and slope constraints. The system detects and draws standard and inverse patterns, assigns a quality score, and confirms breakouts with optional alerts, enabling consistent and rule-based chart analysis.
Building a Trade Analytics System (Part 1): Foundation and System Architecture
We design a simple external trade analytics pipeline for MetaTrader 5 and implement its backend in Python with Flask and SQLite. The article defines the architecture, data model, and versioned API, and shows how to configure the environment, initialize the database, and run the server locally. As a result, you get a clean base to capture closed-trade records from MetaTrader 5 and store them for later analysis.
Integrating Computer Vision into Trading in MQL5 (Part 2): Extending the Architecture to 2D RGB Image Analysis
Computer vision for trading: how it works and how to develop it step by step. We create an algorithm for recognition of RGB images of price charts using the attention mechanism and a bidirectional LSTM layer. As a result, we obtain a working model for forecasting the EURUSD price with the accuracy of up to 55% in the validation section.
Camel Algorithm (CA)
The Camel Algorithm, developed in 2016, simulates the behavior of camels in the desert to solve optimization problems, taking into account temperature, supply, and endurance. This article also presents a modified version of the algorithm (CAm) with key improvements: the use of a Gaussian distribution in generating solutions and the optimization of the oasis effect parameters.
Automating Market Entropy Indicator: Trading System Based on Information Theory
This article presents an EA that automates the previously introduced Market Entropy methodology. It computes fast and slow entropy, momentum, and compression states, validates signals, and executes orders with SL/TP and optional position reversal. The result is a practical, configurable tool that applies information-theoretic signals without manual interpretation.
MQL5 Trading Tools (Part 27): Rendering Parametric Butterfly Curve on Canvas
In this article, we explore the butterfly curve, a parametric mathematical equation, and render it visually on a MQL5 canvas. We build an interactive display with a draggable, resizable canvas window, supersampled curve rendering, gradient backgrounds, and a color-segmented legend. By the end, we have a fully functional visual tool that plots the butterfly curve directly on the MetaTrader 5 chart.
Overcoming Accessibility Problems in MQL5 Trading Tools (Part III): Bidirectional Speech Communication Between a Trader and an Expert Advisor
Build a local, bidirectional voice interface for MetaTrader 5 using MQL5 WebRequest and two Python services. The article implements offline speech recognition with Vosk, wake‑word detection, an HTTP command endpoint, and a text‑to‑speech server on localhost. You will wire an Expert Advisor that fetches commands, executes trades, and returns spoken confirmations for hands‑free operation.