Articles on the MQL5 programming and use of trading robots

icon

Expert Advisors created for the MetaTrader platform perform a variety of functions implemented by their developers. Trading robots can track financial symbols 24 hours a day, copy deals, create and send reports, analyze news and even provide specific custom graphical interface.

The articles describe programming techniques, mathematical ideas for data processing, tips on creating and ordering of trading robots.

Add a new article
latest | best
preview
Money Management in MQL5 (Part 1): Kelly Position Sizing from the Strategy's Own Edge

Money Management in MQL5 (Part 1): Kelly Position Sizing from the Strategy's Own Edge

This article applies the Kelly criterion to position sizing in native MQL5. It presents a reusable CKelly class that estimates win rate and payoff from closed deals, derives the Kelly fraction, and sizes lots from a stop distance. A Monte Carlo sweep of the Kelly multiplier shows growth peaking at full Kelly while drawdown and ruin increase, motivating fractional Kelly such as half Kelly that preserves most growth with materially lower drawdown.
preview
Swing Extremes and Pullbacks (Part 5): Filtering Weak Swings Using Candle Imbalance

Swing Extremes and Pullbacks (Part 5): Filtering Weak Swings Using Candle Imbalance

This article implements an MQL5 Expert Advisor that scores each impulse leg behind a swing extreme with a 0–100 Candle Imbalance Score. The score combines four bounded components—body dominance, directional consistency, leg efficiency, and Fair Value Gap coverage—to filter weak swings before any pullback setup is armed. You will see enforced swing alternation, a state machine for first-clean-retest-only entries, and a three-mode trailing stop, enabling consistent setup selection and exit management.
preview
Self-Exciting Markets: Building a Hawkes Process from Scratch

Self-Exciting Markets: Building a Hawkes Process from Scratch

Volatility arrives in clusters: one large move makes the next large move more likely, and quiet spells stay quiet. This article builds a Hawkes self-exciting point process in pure MQL5 to measure that effect directly, ending in a single number, the branching ratio, that says how reflexive a market currently is. You get a small, tested library, an indicator that plots the fitted intensity live, and a demonstration Expert Advisor, along with the honest limits of all three.
preview
Building AI-Powered Trading Systems in MQL5 (Part 12): Giving the Assistant Chart Vision and Tool Access

Building AI-Powered Trading Systems in MQL5 (Part 12): Giving the Assistant Chart Vision and Tool Access

We give our AI chat assistant two new abilities in MQL5: sight and tool access. It can now capture the chart as a screenshot, attach it to a message, and view it in the panel, and it can call tools that read live positions, trade history, indicator values, chart objects, and the economic calendar. The assistant reasons from what it sees and queries rather than text alone.
preview
Inside MetaEditor's AI Assistant: Writing, Repairing and Testing MQL5 with an Agent

Inside MetaEditor's AI Assistant: Writing, Repairing and Testing MQL5 with an Agent

We use the MetaTrader 5 AI Assistant to execute the full workflow end to end: create an EA from a natural‑language prompt, compile it, break and watch it self‑correct from compiler output, backtest it, and compare a controlled re‑run. The article details the underlying MCP extensions, configuration and safety limits, and how to connect external AI clients. Readers get a repeatable process for building and testing EAs inside the platform.
preview
Neural Networks in Trading: From Transformers to Spiking Neurons (Key Components)

Neural Networks in Trading: From Transformers to Spiking Neurons (Key Components)

We present to the reader an implementation of the SpikingBrain framework’s approaches based on recurrent linear attention with gates, discussed in detail in this article. Forward pass, gradient propagation, and weight update algorithms ensure efficient processing of financial time series and enable the practical implementation of the framework’s key concepts.
preview
Larry Williams Market Secrets (Part 18): Automating the Greatest Swing Value Breakout Strategy in MQL5

Larry Williams Market Secrets (Part 18): Automating the Greatest Swing Value Breakout Strategy in MQL5

This article converts the Greatest Swing Value breakout rules into a configurable MQL5 Expert Advisor. It implements measurable setup conditions, failure-swing calculations, one-bar setup validity, and M1 breakout confirmation. The EA also supports broker-compatible risk management, manual or percentage-risk sizing, position control, and trade-server validation, providing a reproducible framework for independent Strategy Tester research across different markets and historical periods.
preview
Symbol Correlation Monitor with Live Heatmap in MQL5

Symbol Correlation Monitor with Live Heatmap in MQL5

This work delivers an MQL5 Expert Advisor that reads open-position symbols, builds return series, and computes a rolling Pearson correlation matrix, displayed as a CCanvas heatmap. Off-diagonal pairs that meet a warning threshold are bordered for quick scanning. The code details return processing, correlation arithmetic, and matrix indexing, with a verification script, helping you track shifting co-movements across your active book.
preview
Neural Networks in Trading: From Transformers to Spiking Neurons (Conclusion)

Neural Networks in Trading: From Transformers to Spiking Neurons (Conclusion)

Neural networks are already changing the way we analyze markets, and new architectures are opening up even more possibilities. In this article, we wrap up our work with the SpikingBrain framework, which opens up new possibilities for us.
preview
Practical Modules from Other Languages in MQL5 (Part 08): MATPLOTLIB

Practical Modules from Other Languages in MQL5 (Part 08): MATPLOTLIB

Learn how to bring advanced plotting and data visualization to the MetaTrader 5 terminal by leveraging Matplotlib, one of Python's most powerful and widely used visualization libraries.
preview
Foundation Models for Trading (Part III): Running a Generative AI Forecaster Inside MetaTrader 5

Foundation Models for Trading (Part III): Running a Generative AI Forecaster Inside MetaTrader 5

We demonstrate live forecast charting with Kronos in MQL5 and an evaluation pipeline designed to be look‑ahead‑safe. Deterministic dumps are scored per horizon against a random‑walk baseline (15,113 predictions), then fed to a simple Strategy Tester rule on EURUSD H1. The findings show no edge, and illustrate how a high threshold can yield a persuasive but low‑information backtest with very few trades.
preview
Neural Networks in Trading: Training Deep Spiking Models (SEW-ResNet)

Neural Networks in Trading: Training Deep Spiking Models (SEW-ResNet)

We invite you to explore the SEW-ResNet framework, which allows you to build deep spiking models without degradation issues and with effective gradient management. In this article, we demonstrate how to implement a basic spiking neuron and its algorithms using MQL5.
preview
Ollivier-Ricci Curvature: Reading the Shape of a Correlation Network, Not Its Level

Ollivier-Ricci Curvature: Reading the Shape of a Correlation Network, Not Its Level

The article builds an Ollivier–Ricci curvature library in MQL5 for multi‑symbol analysis. A basket becomes a correlation network, and the reading captures network geometry rather than correlation level. It includes an exact optimal transport solver with an internal certificate, a rolling fragility metric with two informative nulls, an indicator that plots the reading against its null band, and a demonstration expert that uses it as a risk gate.