Detecting Structural Breakpoints in Price Series Using CUSUM in MQL5 (Part 1): From Statistical Theory to a Working MQL5 Indicator
Detecting Structural Breakpoints in Price Series Using CUSUM in MQL5 (Part 1): From Statistical Theory to a Working MQL5 Indicator
This article builds a sequential CUSUM breakpoint detector for MetaTrader 5, starting from the statistical construction and ending with a working indicator. It explains standardized log-returns, dual accumulators, the role of k and h, and the ARL₀ baseline from Siegmund. The code walkthrough covers buffer persistence, recalculation handling, idempotent chart objects, and a three-pass engine, so you can compile, attach, and use the detector to flag structural regime shifts earlier than fixed-window smoothers.
Building an Interactive AnchorFlow Volume Profile Indicator (MTF) in MQL5
Building an Interactive AnchorFlow Volume Profile Indicator (MTF) in MQL5
We implement an interactive, anchored multi-timeframe volume profile in MQL5 for MetaTrader 5. The indicator draws the current-timeframe profile on the main chart and a higher timeframe profile in a subwindow, both aligned by a draggable anchor and the visible range. You will learn keyboard-driven bin editing (E/S double-click), robust timeframe validation, viewport-aware updates, and object restoration to build a reliable, synchronized volume workflow.
Entropy-Based Market Efficiency Indicator in MQL5: Measuring Randomness in Price Returns Using Approximate Entropy
Entropy-Based Market Efficiency Indicator in MQL5: Measuring Randomness in Price Returns Using Approximate Entropy
A rolling-window Approximate Entropy oscillator for MQL5, built without external dependencies. Covers the full mathematics of template matching, Chebyshev distance, and the Phi-function derivation before presenting a reusable CApEnCalculator class and a color-zoned subwindow indicator. Includes a synthetic-data verification script and an honest discussion of bias, parameter sensitivity, and computational cost.
From Option Chain to 3D Volatility Surface in MetaTrader 5
From Option Chain to 3D Volatility Surface in MetaTrader 5
This article walks through creating an MT5 indicator that ingests option chains from native symbols or CSV, inverts prices to implied volatility via a hybrid Newton–Raphson/bisection method, and assembles a clean strike–expiry grid. It then renders a shaded, rotatable 3D surface with the platform's DirectX layer, enabling clear, in-terminal analysis of skew and term structure using live or file-based data.
Building an Object-Oriented Order Block Engine in MQL5
Building an Object-Oriented Order Block Engine in MQL5
The article presents a production-oriented Order Block engine for MQL5 packaged as an include class, it validates zones via displacement and market structure break, maintains mitigation state only on closed bars, and avoids heavy copies by passing data by reference. A diagnostic indicator plots zones, and an EA gates logic to new bars for stable performance and reproducible tests.
Analyzing the Hourly Movement of Trading Symbols and Their Spreads in MetaTrader 5
Analyzing the Hourly Movement of Trading Symbols and Their Spreads in MetaTrader 5
The ProSpread seasonality index indicator with a Moving Average is a technical analysis tool that identifies seasonal patterns in price movements, analyzes price behavior during specific trading hours and is able to work with either a single instrument or a spread between two assets. It also visualizes the statistical probability of directional movements.
MQL5 Trading Tools (Part 40): Adding SQLite Persistence and Per-Timeframe Visibility to the Canvas Drawing Layer
MQL5 Trading Tools (Part 40): Adding SQLite Persistence and Per-Timeframe Visibility to the Canvas Drawing Layer
We add SQLite persistence to the canvas tools, saving every drawing and the entire UI session per symbol, then restoring them on startup so the workspace resumes exactly where you left it. The article builds versioned object serialization, a load/save lifecycle with dirty writes, and a timeframe-visibility editor that drives render-time filtering. The toolkit also runs as an indicator, so it can sit alongside other indicators or an Expert Advisor.
Building a Traditional Daily Pivot Point Indicator in MQL5
Building a Traditional Daily Pivot Point Indicator in MQL5
This article develops a rule-based daily pivot point indicator in MQL5 that uses the previous trading day's high, low, and close values to generate pivot, support, and resistance levels. It details historical data retrieval, pivot computation, chart object management, configurable label rendering, and automatic level updates as new trading days begin. The completed indicator displays multiple historical pivot sessions on the main chart for technical analysis on daily and lower timeframes.
Beyond GARCH (Part VIII): The MMAR Library And Putting it to Work in an Expert Advisor
Beyond GARCH (Part VIII): The MMAR Library And Putting it to Work in an Expert Advisor
This article finalizes the MMAR project with a CMMAR facade class and a demo Expert Advisor for MetaTrader 5. The facade exposes a compact API—configure, Fit(), Forecast()—that wraps partition analysis, spectrum fitting and Monte Carlo simulation. You will learn how to load data, fit the model and obtain a volatility forecast, with diagnostics and status handling for robust use in EAs.
Building a Divergence System (Part II): Adaptive SuperTrend Custom Indicator
Building a Divergence System (Part II): Adaptive SuperTrend Custom Indicator
The article upgrades SuperTrend by integrating a divergence engine (MPO4 or RSI) the dynamically reduces the ATR multiplier during weakening momentum. It covers the shrinking formula, non-repainting state propagation with dedicated buffers, and a step-by-step MQL5 implementation on the price chart. You will learn how to interpret arrows and line flips, adjust inputs, and apply the indicator for disciplined trailing and earlier confirmations.
Reimagining Classic Strategies (Part 22): Ensemble Mean Reverting Strategy
Reimagining Classic Strategies (Part 22): Ensemble Mean Reverting Strategy
This article will illustrate to the reader how to implement a mean-reverting strategy for the EURUSD pair. The strategy follows contrarian trading rules. Our strategy implements a weekly moving average channel, with one moving average on the high-price feed and the latter on the low-price feed. We enter short positions when the price falls beneath the low moving average and long positions when the price rises above the high moving average. Additionally, we will export daily market data to build a simple ONNX model of the market to provide an additional filter for our entries. This provides the reader with a reproducible template for strategy development and backtesting.
Extreme Value Theory in MQL5: Building a Tail-Risk Crash Gauge Beyond Monte Carlo VaR
Extreme Value Theory in MQL5: Building a Tail-Risk Crash Gauge Beyond Monte Carlo VaR
Standard MQL5 risk tools read risk from recent history and miss how heavy the downside tail can be. We implement Extreme Value Theory in MetaTrader 5: a Peaks‑Over‑Threshold fit of the Generalized Pareto Distribution via ALGLIB, a live indicator that reports EVT VaR/ES and tail shape, and an EA that sizes positions from the tail estimate. A controlled backtest illustrates reduced drawdown for unchanged entries.
Custom Indicator Workshop (Part 3): Building the UT Bot Alerts Indicator in MQL5
Custom Indicator Workshop (Part 3): Building the UT Bot Alerts Indicator in MQL5
This article demonstrates how to build the UT Bot Alerts indicator in MQL5 using a clear, step-by-step approach. The tutorial explains how to implement an ATR-based trailing stop system, compute a custom EMA for signal detection, and generate buy and sell signals without repainting. The final indicator provides well-structured buffers that enable easy integration with Expert Advisors, automated trading systems, and other algorithmic tools within the MetaTrader 5 platform.
Detecting and Visualizing Outlier Bars in MQL5 Using Modified Z-Score on OHLCV Features
Detecting and Visualizing Outlier Bars in MQL5 Using Modified Z-Score on OHLCV Features
Abnormal bars inflate mean and standard deviation estimates, distorting ATR, Bollinger Bands, and moving averages. We implement a native MQL5 indicator that detects such bars with the Modified Z-Score applied to four features: body, upper wick, lower wick, and tick volume. The indicator marks flagged bars on the chart and plots a composite score in a separate subwindow, helping you diagnose contamination in rolling-window indicators.
Building an Internal and External Market Structure Indicator
Building an Internal and External Market Structure Indicator
The article presents a structured approach to external and internal market structure in MQL5, from swing identification to CHoCH/BoS validation within an established trend. It explains refining true highs/lows, enforcing “first internal signal” logic, and rendering lines, labels, and markers on the chart. The outcome is a consistent indicator that converts price structure into defined entries, stop losses, and 1.5R targets.
Creating an EMA Crossover Forward Simulation (Culmination): Interactive Synthetic Candles
Creating an EMA Crossover Forward Simulation (Culmination): Interactive Synthetic Candles
This article finalizes the Forward Simulation Engine for MetaTrader 5 by calibrating synthetic candles to recent market volatility instead of using slope-only sizing. It samples average body, upper wick, and lower wick from closed bars, applies a sine-envelope with decay, proportional wicks, gaps between candles, and periodic counter-trend injections. The result is a live projection that advances one bar ahead, with code you can reuse for calibrated, anchor-based forward rendering and automatic cleanup.
MQL5 Wizard Techniques you should know (Part 100): Sliding Window Median and Bidirectional LSTM for a Custom Trailing Stop
MQL5 Wizard Techniques you should know (Part 100): Sliding Window Median and Bidirectional LSTM for a Custom Trailing Stop
CTrailingSlidingMedianBiLSTM is a custom MQL5 Wizard trailing module that combines robust median/MAD outlier filtering with a BiLSTM context score in the range [-1, 1]. Four algorithm modes (standard, bands, RSI, adaptive) target noise, mean-reverting bursts and liquidity spikes, reducing premature stop adjustments. This module is intended for side-by-side evaluation with diverse entry signals and money management settings.
Beyond GARCH (Part VII): Monte Carlo Volatility Forecasting in MQL5
Beyond GARCH (Part VII): Monte Carlo Volatility Forecasting in MQL5
We implement the CMonteCarlo module that turns the fitted MMAR parameters into a volatility forecast via Monte Carlo. It runs N independent simulations over a chosen horizon and reports mean, median, standard deviation, and a percentile-based 95% confidence interval, with access to per-run values if needed. Adaptive cascade depth selects the minimal k such that b^k covers the horizon, keeping the run fast and consistent.
Heatmap Visualization of Intraday Return Patterns in MQL5 Using CCanvas
Heatmap Visualization of Intraday Return Patterns in MQL5 Using CCanvas
MetaTrader 5 provides no native tool for visualizing intraday return patterns across time dimensions simultaneously. This article implements a custom indicator that aggregates historical bar returns into a 5×24 matrix indexed by weekday and hour of day, then renders the result as a color-interpolated heatmap inside an indicator subwindow using CCanvas. Green cells represent positive average returns, red cells negative, with color intensity encoding return magnitude.
Market Microstructure in MQL5 (Part 7): Regime Classification
Market Microstructure in MQL5 (Part 7): Regime Classification
We integrate eleven one-minute microstructure measurements from Parts 2–6 into a composite regime label with confidence and direction. A rule-based RegimeClassifier() assigns one of six regimes—Normal, Stressed, Noisy, Informed, Trending, Mean-Reverting—using empirically derived thresholds from 514 NQ M1 sessions (May 2024–May 2026). The deliverable includes MARKET_REGIME, RegimeAnalysis, and PopulateRegimeAnalysis(), enabling position sizing, stop placement, and signal filtering from a single call.
Feature Engineering for ML (Part 8): Entropy Features in MQL5
Feature Engineering for ML (Part 8): Entropy Features in MQL5
An MQL5 port of four entropy estimators — Shannon, Plug-In, Lempel-Ziv, and Kontoyiannis — operating on the intrabar tick-rule sequence. CopyTicksRange() limits data to the broker's cached tick window, so features apply to recent bars only. The implementation encodes bid-direction ticks from MqlTick, replaces NumPy-dependent steps with array-based methods, and ships CEntropyFeatures.mqh and EntropyViewer.mq5 for EA and indicator use.
Forecasting in Trading Using Grey Models
Forecasting in Trading Using Grey Models
The article discusses the application of Grey models to forecasting financial time series. We will consider the operating principles of Grey models and the specifics of their application to financial series. We will also discuss the advantages and limitations of using these models in trading.
Linear Regression Prediction Channels in MQL5: Constructing Statistically Grounded Confidence and Prediction Bands
Linear Regression Prediction Channels in MQL5: Constructing Statistically Grounded Confidence and Prediction Bands
The article implements rolling OLS regression channels in MQL5 and computes confidence and prediction bands with Student's t critical values instead of a fixed standard-deviation multiplier. It explains the leverage-driven widening at window edges, contrasts the result with Bollinger and Donchian channels, and reviews OLS assumptions on price data. A five-line rendering is documented to ensure reliable display in MetaTrader 5.
Market Microstructure in MQL5 (Part 6): Order Flow
Market Microstructure in MQL5 (Part 6): Order Flow
This article adds six order-flow functions and a new OrderFlowAnalysis struct to MicroStructureFoundation.mqh: VPINOHLC, signed flow imbalance, trade intensity versus a 20-session baseline, a late-minus-early smart-money index, flow momentum, and a wrapper that outputs a confidence weight. Flow confidence is gated by noise and jump intensity from Parts 5 and 4. Calibrated on 602 NQ M1 NY sessions, it provides ready-to-use intraday flow signals with documented thresholds.
Beyond GARCH (Part VI): Fractional Brownian Motion And The Multiplicative Cascade in MQL5
Beyond GARCH (Part VI): Fractional Brownian Motion And The Multiplicative Cascade in MQL5
This article implements the MMAR Simulation Engine that turns fitted parameters (H, distribution, coefficients, sample volatility) into synthetic price paths. It builds multifractal trading time via a multiplicative cascade, synthesizes fractional Brownian motion with Davies–Harte or Cholesky, scales it to target volatility, and composes the process by time deformation. Readers get a reusable MQL5 class, method choices by path length, and validation steps for scenario testing and Monte Carlo use in the next part.
Building a Traditional Point and Figure Indicator in MQL5
Building a Traditional Point and Figure Indicator in MQL5
This article implements a custom Point and Figure indicator in MQL5 that maps price movement into X/O columns using a fixed box size and three-box reversal logic. We define the base price, convert prices into box intervals, manage trends and reversals, auto-scale the indicator window, and render symbols with objects, providing a clean, time-independent view of trends, breakouts, and support/resistance.
Rolling Sharpe Ratio with Statistical Significance Bands in MQL5
Rolling Sharpe Ratio with Statistical Significance Bands in MQL5
This article presents a custom MetaTrader 5 indicator that computes a rolling annualized Sharpe ratio and plots configurable z-score significance bands based on Lo's asymptotic standard error. It uses a circular return buffer with incremental variance to keep O(1) updates. We explain the n^(-1/2) uncertainty scaling, the inflation of intervals at high Sharpe values, and how to set per-instrument annualization for correct deployment.
A Practical Kalman Filter Price Smoother in MQL5: Adaptive Noise Estimation Without External Libraries
A Practical Kalman Filter Price Smoother in MQL5: Adaptive Noise Estimation Without External Libraries
Fixed-weight moving averages introduce regime-insensitive lag. This work presents an adaptive scalar Kalman filter indicator in native MQL5 that estimates process noise Q from rolling return variance and measurement noise R from rolling price variance, with floor clamps for stability, and recomputes the Kalman Gain on every bar. The chart-overlay output is benchmarked against a 20-period EMA using MAE, RMSE, lag, and smoothness metrics to quantify tracking and noise suppression.
Quantum Neural Network in MQL5 (Part II): Training a Neural Network with Backpropagation on ALGLIB Markov Matrices
Quantum Neural Network in MQL5 (Part II): Training a Neural Network with Backpropagation on ALGLIB Markov Matrices
The article presents an innovative quantum neural network architecture for algorithmic trading that combines the principles of quantum mechanics with modern machine learning methods. The system includes quantum effects (resonance, interference, decoherence), multi-level memory of different time scales, Markov chains with the ALGLIB library, and adaptive parameter control. The full implementation is done in MQL5 using the built-in matrix/vector types, which removes implementation barriers in MetaTrader 5.
MQL5 Wizard Techniques you should know (Part 97): Using Convex Hull and a miniature GRU Network in a Custom Trailing Stop Class
MQL5 Wizard Techniques you should know (Part 97): Using Convex Hull and a miniature GRU Network in a Custom Trailing Stop Class
For this article we look at a custom MQL5 Wizard class for Trailing Stops. Our implemented custom class ‘CTrailingConvexHullGRU’, is built from merging the Convex Hull algorithm with a GRU network. As always we seek to develop a model that is testable with MQL5 Wizard-Assembled Expert Advisors and can be tuned with various Money Management and entry Signals classes. Our testing is with the 'Envelopes' and the RSI classes for Signal.
Beyond the Clock (Part 3): Building an Indicator Window for Alternative Bars in MQL5
Beyond the Clock (Part 3): Building an Indicator Window for Alternative Bars in MQL5
AlternativeBarsViewer is a subwindow indicator that renders all ten alternative bar types as color‑coded candles using the same CBarConstructor hierarchy as BarBuilderEA, ensuring identical bars. It supports three data sources (real ticks, synthetic OHLC ticks, or the EA's CSV) and two render modes (TIME and INDEX) toggleable at runtime. Degenerate bars are highlighted and summarized on a compact panel, enabling live calibration without leaving the terminal.
Building a Divergence System: Creating the MPO4 Custom Indicator
Building a Divergence System: Creating the MPO4 Custom Indicator
We introduce MPO4, a pressure-based oscillator that emphasizes the body and direction of candles in the context of current volatility. The article details its mathematics, normalization into a bounded range, and the EMA smoothing, then builds a pivot-driven divergence module designed not to repaint. You get complete MQL5 implementation and practical guidance for interpreting signals, including a comparison with RSI as an alternative source.
Price Action Analysis Toolkit Development (Part 73): Building a Weekend Gap Trading Signal System in MQL5
Price Action Analysis Toolkit Development (Part 73): Building a Weekend Gap Trading Signal System in MQL5
We extend the weekend gap toolkit with an indicator that turns gap structure into tradeable signals. When price confirms back into the gap, the indicator issues buy/sell arrows, sets TP at the opposite edge, and places SL using current-week extremes. It maintains non-repainting behavior, reconstructs historical signals, updates live, and provides EA-ready buffers for entry markers and TP/SL to support automation.
From Static MA to Adaptive Filtering (Part 2): Implementing the SAMA_NLMS Indicator in MQL5
From Static MA to Adaptive Filtering (Part 2): Implementing the SAMA_NLMS Indicator in MQL5
This article implements the NLMS-based Self-Adaptive Moving Average as a working MQL5 indicator. It provides the complete source code and explains the key design choices, including inline execution, uniform weight seeding, closed‑bar updates, and stability bounds, along with installation, usage, and limitations. The result is a compiled, chart‑ready SAMA_NLMS indicator and a clear basis for subsequent EA benchmarking.
Price Action Analysis Toolkit Development (Part 72): Building a Gap Fill Indicator in MQL5
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.
From Static MA to Adaptive Filtering (Part 1): Introducing SAMA with NLMS in MQL5
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.
A Generic Object Pool in MQL5: Eliminating Heap Fragmentation in High-Frequency Indicators
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().