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.
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.
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.
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.
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.
From CPU to GPU in MQL5: A Practical OpenCL Framework for Accelerating Research, Optimizations, and Patterns
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 candlestick patterns illustrates the practical benefit of the approach.
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.
Python + MetaTrader 5: Fast Research Framework for Data, Features, and Prototypes
The article demonstrates how Python and MetaTrader 5 integration combines research flexibility and trade execution into a single workflow. Python is used for data analysis, feature selection and model training, while MetaTrader 5 is used for testing and trading automation. This approach simplifies the transfer of solutions into practice, increases reproducibility, and makes the development of trading systems faster and more structured.
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.
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?
Recurrence Quantification Analysis (RQA) in MQL5: Building a Complete Analysis Library
This article builds a complete Recurrence Quantification Analysis (RQA) toolkit for MetaTrader 5 in pure MQL5. We cover phase-space reconstruction, time-delay embedding, distance and recurrence matrix construction, RQA metric extraction, automatic epsilon selection, and rolling-window computation through a modular library design. The article concludes by applying the library in a practical indicator that plots RR, DET, LAM, ENTR, and TREND directly on the chart, providing a solid foundation for nonlinear time-series analysis in MQL5.
Building a Liquidity Spectrum Volume Profile Indicator in MQL5
Build a Liquidity Spectrum Volume Profile in MQL5 that allocates volume to equal price bins over a chosen lookback using candle close prices. The guide covers data retrieval with copy functions, binning and normalization, and drawing rectangles and POC lines with chart objects and time offsets to reveal high-activity liquidity zones on the chart.
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.
Developing a Multi-Currency Advisor (Part 27): Component for Displaying Multi-Line Text
If there is a need to display text on a chart, we can use the Comment() function. But its capabilities are quite limited. Therefore, in this article, we will create our own component - a full-screen dialog window capable of displaying multi-line text with flexible font settings and scrolling support.
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.
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.
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.
How to connect AI agents to MetaTrader 5 via MCP
This article shows how to connect AI agents directly to MetaTrader 5 by building a complete MCP (Model Context Protocol) server in Python. It details the architecture, MetaTrader 5 client wrapper, market data and order handlers, and tool registration over stdio, with testing via MCP Inspector and connections to clients like Claude Desktop or OpenClaw. The result is a standardized bridge for natural-language queries, live data retrieval, and safe order execution in MetaTrader 5.
CAPM Model Indicator for the Forex Market
Adaptation of the classical CAPM model for the Forex currency market in MQL5. The indicator calculates expected return and risk premium based on historical volatility. The indicators rise at peaks and bottoms, reflecting the fundamental principles of pricing. Practical application for counter-trend and trend-following strategies, taking into account the dynamics of the risk-reward ratio in real time. The article includes mathematical apparatus and technical implementation.
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.
File-Based Versioning of EA Parameters in MQL5
This article explains how to implement parameter versioning in MQL5 using binary files and packed structures. It shows how to write and read fixed-size records with FileWriteStruct and FileReadStruct in FILE_BIN mode, including version numbers, timestamps, and a checksum. You will also see how to detect changes via checksums, append records safely, and load the latest configuration without overwriting prior settings.
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.
Using the MQL5 Economic Calendar for News Filter (Part 4): Accurate Backtesting with Static Data
This article implements a static, CSV-based news source for the Strategy Tester, so historical economic news events can be preloaded and queried during backtesting. It replaces live calendar calls in tester mode with a fast in-memory search, preserves the live logic for trading, and delivers deterministic, repeatable results with explicit control over included events, enabling reliable validation of news-aware filters, stop suspension, and trade-blocking rules.
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.
Deterministic Oscillatory Search (DOS)
Deterministic Oscillatory Search (DOS) algorithm is an innovative global optimization method that combines the advantages of gradient and swarm algorithms without the use of random numbers. The fitness oscillation and slope mechanism allows DOS to explore complex search spaces in a deterministic manner.
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.