MQL4 and MQL5 Programming Articles

icon

Study the MQL5 language for programming trading strategies in numerous published articles mostly written by you - the community members. The articles are grouped into categories to help you quicker find answers to any questions related to programming: Integration, Tester, Trading Strategies, etc.

Follow our new publications and discuss them on the Forum!

Add a new article
latest | best
preview
Building a Dynamic and Customizable Table in MQL5

Building a Dynamic and Customizable Table in MQL5

This article presents a reusable CTable class for building chart-based tables in MQL5. It covers table architecture, creation and destruction of objects, coordinates and sizing, cell properties, horizontal/vertical headers, dynamic row/column edits, object naming, index conversion, and efficient refreshing. You will be able to assemble consistent, aligned on-chart dashboards for market data, indicators, and signals with minimal boilerplate.
preview
Neural Networks in Trading: The Adaptive Graph Diffusion Model (Conclusion)

Neural Networks in Trading: The Adaptive Graph Diffusion Model (Conclusion)

In this article, we conclude our work on building the SAGDFN framework using MQL5, summarizing the development process and presenting the results of its practical testing. Let's combine the modules we've already implemented into a single system, highlight the strengths of this approach, point out its weaknesses, and discuss possible ways to improve it.
preview
Testing for Residual Autocorrelation with the Ljung-Box Portmanteau Test in MQL5

Testing for Residual Autocorrelation with the Ljung-Box Portmanteau Test in MQL5

A complete MQL5 implementation of the Ljung-Box test helps verify independence in trading data and fitted-model residuals. It computes sample autocorrelations, the Q statistic over selected horizons, degrees of freedom with user-controlled adjustments, and right-tail p-values via the regularized incomplete gamma function. Run it on returns, deal outcomes, or external residuals and review decisions directly in the Experts tab.
preview
Drawdown Duration Analysis Indicator in MQL5

Drawdown Duration Analysis Indicator in MQL5

We build a drawdown analytics dashboard that derives the equity curve from deals and finds every episode's depth and recovery duration. Results appear on a CCanvas timeline spaced by point index with alternating bold annotations, and in a terminal table sorted by duration, allowing you to prioritize risk by time spent underwater rather than depth alone.
preview
Random Matrix Theory: Denoising the Correlation Matrix for Multi-Symbol EAs

Random Matrix Theory: Denoising the Correlation Matrix for Multi-Symbol EAs

Sample correlation matrices can look precise yet be mostly noise. This article implements a dependency-free RMT cleaner in MQL5: Jacobi eigendecomposition, Marchenko–Pastur eigenvalue screening, and average-noise reconstruction that preserves the matrix trace and unit diagonal. It explains integration into a basket EA so the denoised matrix improves stability of hedge ratios and weights between rebalances, while keeping the code portable and auditable.