From Option Chain to Risk-Neutral Density: The Market's Own Probability Distribution
The article builds an MQL5 indicator that recovers the risk-neutral density from an option chain via the Breeden–Litzenberger identity. Quotes are inverted to implied volatilities, the smile is smoothed and priced back to arbitrage‑free calls, and the second derivative yields the density. The tool reports probabilities above any level, the expected move, skew and kurtosis, and overlays the realized-return distribution for comparison.
Neural Networks in Trading: Heterogeneity-Informed Meta-Parameter Learning (Key Components)
In this article, we take a detailed look at the algorithms used to implement the key components of the HimNet framework. We demonstrate how, with a minimal number of trainable components, a high degree of consistency and controllability can be achieved throughout the entire system. The presented implementation is compact and transparent, which makes it easier to adapt to real-world market tasks.
Building a News Filter Engine in MQL5 Using a Local Economic Calendar File
A file-based news filter for MQL5 reads a pre-downloaded Forex Factory CSV from MQL5/Files, avoiding fragile web scraping and paid APIs. It provides a modular CNewsFilter with a quote-aware CSV parser, suffix-robust currency extraction, an inclusive time-window checker with clear block reasons, and chart zones for today's events. A demo EA and assertion tests help you integrate and verify offline filtering around scheduled releases.
Automating Classic Market Methods in MQL5 (Part 8): Ed Seykota's Trend Following System
The article presents a full MQL5 implementation of a multi-symbol trend system: dual EMA crossovers for entries, ADX to avoid ranges, ATR to normalize position size, and a heat monitor to cap total portfolio risk. We explain the architecture, calculation details, and entry/exit logic on daily bars. The result is a practical EA template for systematic, risk-aware portfolio trading.
Developing a Multi-Currency Expert Advisor (Part 31): Secrets of the Optimization Project Creation Step (I)
The article examines two practical aspects of the Adwizard-based optimization pipeline: diagnostics and recovery after failures when generating the final Expert Advisor database, as well as preliminary selection of strategy parameter ranges before project creation. It is shown how analyzing the stages/jobs/tasks tables in SQLite and restarting stages based on their statuses help restore the process, while trial optimization narrows the search space, eliminates redundant parameters, and reduces the risk of getting stuck at local maxima.
From Basic to Intermediate: Queues, Lists, and Trees (VIII)
In this article, we will examine how to implement a tree balancing algorithm. Here, I will present my own version of an implementation of this algorithm. There are many other algorithms that serve the same purpose. Nevertheless, each of them has its own advantages and disadvantages. You, my dear reader, will need to explore them and find the one that best suits your needs.
Market Simulation: Position View (XVIII)
In this article, I have shown—in the clearest possible way—how to modify and improve code capable of handling specific tasks while making as few changes as possible to the existing code. We will add a volume display and, at the same time, ensure that users or traders cannot effectively remove objects created by the position indicator.
Neural Networks in Trading: Heterogeneity-Informed Meta-Parameter Learning (HimNet)
We invite you to explore the HimNet framework, which combines the flexibility of spatio-temporal adaptation with high computational efficiency, enabling accurate and stable forecasts for financial time series. The article explains in detail how its key components interact with one another, transforming complex algorithms into a manageable architecture.
Beetle Swarm Optimization (BSO)
We consider a BAS+PSO (BSO) hybrid, where BAS provides a local direction signal and PSO facilitates the exchange of best solutions within the swarm. The article presents a mathematical model, pseudocode, an implementation of the class in MQL5, and test results from a standard test bench. This material allows reproducing the algorithm, configuring its parameters, and understanding how three objective-function evaluations per iteration affect efficiency.
Machine Learning in Pure MQL5 (Part 1): Logistic Regression from Scratch with SGD
The series develops machine learning in 100% native MQL5 with no external dependencies. Part 1 delivers logistic regression from first principles: a CLogReg class with standardization, a stable sigmoid, SGD training, and model persistence, plus a script that builds ATR-normalized features, labels the next bar, and tests out-of-sample against a baseline. Readers get a compact include file and a clear template for leakage-free evaluation.
Automating Classic Market Methods in MQL5 (Part 7): The Nicolas Darvas Box System
This article implements the Darvas Box method as a complete MQL5 Expert Advisor. We code box detection with a three-session hold, volume contraction during consolidation, and volume-confirmed breakouts, plus a staircase pyramid with a shared, rolling stop at the latest box floor. The EA uses a state machine to run box scanning and trade management in parallel, providing a ready-to-compile system with configurable inputs and clear on-chart diagnostics.
From Basic to Intermediate: Queues, Lists, and Trees (VII)
In this article, we will clearly and simply demonstrate and explain how to remove a node from a tree. This process usually confuses beginners rather than helping them understand how it's done and why it needs to be done that way.
Market Simulation: Position View (XVII)
In the previous article, we configured the indicator to display the financial result. However, not everyone likes using this display mode. The reasons differ from one trader to another, although in some cases they seem quite reasonable and justified to me. Adapting the code to provide this capability is by no means one of the most difficult tasks. It's actually pretty simple. In this article, we'll look at how to do this.
Designing a Multi-EA Communication Bus Using Named Pipes in MQL5
This article implements a typed message bus over Windows named pipes to replace MetaTrader's untyped GlobalVariables for inter‑EA communication. A broker EA manages the server and registry, serves multiple slave EAs, and responds with a live, per‑symbol‑attributed portfolio risk measure. It also explains the non-blocking accept pattern that preserves terminal responsiveness, and includes a dashboard and a test script.
Defining your Edge (Part 5): Using GARCH Variance and Volatility-Scaled LSTM in an Expert Advisor
We merge GARCH(1,1) variance projections with ATR plus Bollinger-Bands patterns to form an algorithm that could optionally be used with volatility-scaled LSTM within LSTM Wizard-ready signal class. We cover feature scaling, mode scoring, thresholds, and safety checks. Readers can replicate backtest/forward test results to verify if the recurrent layer gives incremental discrimination over our deterministic baseline.
Neural Networks in Trading: The Temporal Query Model (Conclusion)
We are pleased to present the final stage of the TQNet framework’s development and testing, where theory meets real-world trading practice. We will move from historical training to a stress test using recent market data, evaluating the model's robustness and accuracy. The final results are not just dry statistics, but also a clear demonstration of the practical value of the proposed approach.
The ZeroMQ Message Transfer Protocol in MQL5: Implementing the REQ/REP pattern
This article presents a native MQL5 implementation of the ZeroMQ Message Transfer Protocol (ZMTP) built on raw MQL5 sockets. It explains the REQ/REP pattern via the CZmqReqSocket class, including framing, handshake, and strict send/receive alternation. A practical pipeline shows an MQL5 script streaming returns to a Python/R server running MS‑GARCH and receiving regime probabilities, enabling integration without DLLs.
Native Isolation Forest for Execution-Quality Anomaly Detection in MQL5
A step-by-step guide to a native Isolation Forest in MQL5 focused on execution metrics rather than price. It details five features, tree construction and path‑length scoring, rolling‑window training, CSV logging, and FILE_COMMON persistence, all integrated into OnTradeTransaction(). The resulting circuit breaker flags unusual fills in real time and applies controlled responses to stabilize live trading under changing execution conditions.
The MQL5 Standard Library Explorer (Part 16): Building a Regime-Adaptive Expert Advisor
We convert the Part 15 decision‑forest classifier into a regime‑adaptive Expert Advisor that decouples statistical inference from trading authority. The EA trains on completed bars, scores each new completed bar, and confirms stable bullish, neutral, or bearish regimes before acting. It then applies spread, ownership, risk, and execution checks to authorize opening, holding, closing, or blocking a position.
MetaTrader 5 as a Kafka Producer: Event-Bus Architecture for Multi-Terminal Signal Fan-Out
The article details a native MQL5 Kafka producer that speaks the wire protocol over raw TCP. It implements RecordBatch v2 encoding, varints, and CRC32C, and adds batching, acks, and retry logic, all without a sidecar or DLL. Use it to publish JSON-structured trading signals from a single terminal to Kafka, where dashboards and other services subscribe independently.
Monte Carlo Simulation and Analysis for MetaTrader 5 Backtest Reports
This article explains Monte Carlo simulation and analysis for trading and guides you through a Python tool that ingests MetaTrader 5 HTML reports. It generates many randomized equity paths, then summarizes them with max drawdown, bust/profit rates, and percentile envelopes around the mean curve. The workflow helps you assess uncertainty, separate normal behavior from outliers, and size positions accordingly.
Development and Forward Testing of an Autonomous LLM Agent for Trading with SEAL
A hybrid architecture based on Llama 3.2 and SEAL is being tested on eight currency pairs (M15), with forward-period data isolation and information leakage control. The methodology combines adversarial self-play, curriculum learning, and class balancing to ensure stable training. The experiments confirm the gap between forecast accuracy and actual returns, providing readers with practical guidelines for testing strategies and accurately assessing their generalizability.
Butterfly Optimization Algorithm (BOA)
The article discusses the Butterfly Optimization Algorithm, which is based on modeling foraging using the sense of smell. We will analyze the original formulas, identify and correct errors in motion equations, add a mechanism for maintaining population diversity, and present the test results.
Neural Networks in Trading: The Temporal Query Model (TQNet)
The TQNet framework opens up new possibilities for modeling and forecasting financial time series by combining modularity, flexibility, and high performance. The article explores the possibility of implementing complex mechanisms for handling global correlations, including advanced parameter initialization methods.
Developing a Multi-Currency Expert Advisor (Part 30): From Trading Strategy to Launching a Multi-Currency Expert Advisor
The article outlines the complete process of creating a multi-currency Expert Advisor using the Adwizard library for MetaTrader 5: from setting up the environment for creating optimization projects to obtaining the final multi-currency Expert Advisors, which combine multiple instances of a simple trading strategy. We will walk through setting up the necessary input parameters, conventions for convenient file names, and launching three instances of the final Expert Advisors on different trading accounts with different parameters.
Measuring What Matters (Part 4): Reading the Spectrum — What Eigenvalues Tell You About Risk
We turn eigenvalues from a covariance matrix into a normalized spectral‑entropy score that measures how evenly variance is spread across factors. SpectralEntropyCalculator.mq5 compares two portfolios in one run, using native vector summation, ArraySort()-based ordering, element‑wise division, and the Shannon entropy formula. The report makes dominant factors visible and enables quick, repeatable checks of diversification quality.
Building Your Personal Expert Advisor (Part 6): Risk Management V — Portfolio and Correlated Risk
This part implements PortfolioRisk.mqh, a shared library that shifts risk management to the account level. It scans positions and pending orders, computes margin and floating results, counts symbols, and decomposes pairs into currencies to detect concentration, then validates each new trade against portfolio limits. The Series EA example illustrates configuring scope (account-wide or magic-filtered), registering magics, and integrating the pre-trade gate.
Expectancy and Trade Quality Score Dashboard in MQL5
We present an MQL5 script that converts closed trade history into comparable metrics: expectancy in currency, pips, and R-multiples, plus a sample-aware win rate via the Wilson interval. These inputs form a conservative, dimensionless Trade Quality Score. The tool draws a CCanvas panel, prints an Experts-tab report, and supports an hour-based session filter to analyze a defined trading window alongside full-history results.
Defining your Edge (Part 4): Applying Isotonic Regression and PNN Price-Forecasting in an Expert Advisor
We consider the methods with which Isotonic Regression calibrates raw RSI, Stochastic and price-action signal scores into probabilities that are sorted, while a separate Probability based Neural Network evaluates similar historical market states. This article uses both approaches in a ready-made MQL5 custom signal class that is compatible with MQL5 Wizard and provides up to 7 selectable entry modes. Reproducible tests compare isotonic-only signals with the combined Isotonic-PNN model to assess whether the network adds useful information beyond the simpler baseline.
Market Simulation: Position View (XVI)
In this article, we will make the necessary changes so that the position indicator displays the financial result. This way, the trader will be able to get an idea of the financial result of an open position. In addition, I will tell you something that many people do not know, even those who have been using MQL5 for a long time: how to use static variables to share memory and avoid declaring a global variable in the main code.
From Basic to Intermediate: Queues, Lists, and Trees (VI)
In this article, we will return to the tree implementation. Now that we are familiar with the basic principles of constructors and destructors, we can finally fix the code presented in the previous article. Get ready for a real adventure in MQL5 programming.
Enhanced Colliding Bodies Optimization (ECBO)
The article discusses the Colliding Bodies Optimization (CBO) algorithm, which is based on the physics of one-dimensional collisions between bodies. The basic version of the algorithm does not include any configurable parameters, which makes it simple. Therefore, the enhanced ECBO version — supplemented with Colliding Memory and a crossover mechanism — was used as the basis for the implementation, allowing the algorithm to achieve respectable results and earn a place in the ranking table.
Market Simulation: Position View (XV)
In this article, I will try to explain as simply as possible how messaging between applications can be used. The goal is to enable you to create something workable in the simplest and most efficient way possible whenever you can. I am not sure if I will be able to convey the idea behind this concept, since it is not that easy to understand for someone encountering it for the first time. In addition, I will take this opportunity to show you how to modify the replay/simulation system so you can debug an Expert Advisor or any other code you are developing. And all of this is just as simple and straightforward.
From Basic to Intermediate: Classes (III)
In this article, we will explore the best ways to manage code when working with object-oriented programming. Although we are just beginning to learn about object-oriented programming, what we will cover here will help you understand its various aspects. This will also help dispel any doubts that may arise later.
Honest Backtesting of Swing Strategies on Index CFDs: Financing Costs, Swap Modes, and What the Strategy Tester Cannot Model
Financing drives multi‑day index‑CFD results: in one full‑history test, swap consumed 44% of gross profit and all profit on one symbol. We convert swaps to annualized rates, contrast four brokers and two financing models with a read‑only script, and quantify a Strategy Tester issue where a single current swap is used for all history, inflating implied rates by up to seven times. The piece provides a repeatable cost‑audit method.
How to Create and Adapt an RL Agent with an LLM and Quantum Encoding for Algorithmic Trading in MQL5
The article proposes a hybrid approach to algorithmic trading based on quantum encoding of market states, Double DQN with a prioritized experience replay buffer, and an LLM acting as a contextual EA. The SEAL methodology enables asynchronous continued training of the agent without halting trading. A lightweight Q-learning filter (USE/SKIP/REDUCE) controls signal execution at the meta-level. Practical details are provided on integrating the system with the MetaTrader 5 trading platform, along with a scheme for adapting it to market regime shifts.
Market Simulation: Position View (VI)
In this article, we will implement a number of improvements to ensure that the position indicator accurately reflects the actual state on the trading server in terms of open positions and their current state. I should point out that the applications shown here are in no way intended to replace any of the elements available in MetaTrader 5. They should also not be used without due caution and a balanced approach, since their purpose is to provide educational code—that is, code intended solely for learning how the system works. The reason I call this code “educational” is that, in some cases, using messages is not the best way to implement certain functions.
The MQL5 Standard Library Explorer (Part 15): Building a Market-Regime Classifier with dataanalysis.mqh
This part focuses on practical data analysis in MQL5 with dataanalysis.mqh. We prepare a labeled dataset from bars, apply normalization, explore redundancy with PCA, and train a decision forest to classify future bar regimes. The article shows how to obtain out-of-bag estimates and permutation importance, helping you validate the model and understand which inputs matter most.
Building a Prop-Firm Compliance Monitor in MQL5 (Part 1): Account Rules and Persistent Settings
Establishes the persistence foundation for a prop-firm compliance EA in MetaTrader 5. It introduces rule inputs and status enums, separates live account state from stored settings, validates percentages and thresholds, and implements SQLite open/close, schema creation, and prepared save/load operations. Using the account login and server as a composite key, the EA restores existing settings and updates them when inputs change.
Neural Networks in Trading: Decomposition Instead of Scaling (Conclusion)
We invite you to learn about an algorithm for decomposing a time series into meaningful layers and using them to build a parsimonious model. We systematically present the architecture, the practical implementation in MQL5/OpenCL, and real-world tests using historical market data.