Articles with MQL5 programming examples

icon

Access a huge collection of articles with code examples showing how to create indicators and trading robots for the MetaTrader platform in the MQL5 language. Source codes are attached to the articles, so you can open them in MetaEditor and run them to see how the applications work.

These articles will be useful both for those who have just started exploring automated trading and for professional traders with programming experience. They feature not only examples, but also contain new ideas.

Add a new article
latest | best
preview
Implementing Anchored VWAP Indicator in MQL5: A Step-by-Step Guide

Implementing Anchored VWAP Indicator in MQL5: A Step-by-Step Guide

A step-by-step guide to building an anchored VWAP indicator with an interactive draggable anchor line in MQL5. The article covers the complete implementation, including calculation methodology, session resets, standard deviation bands, and custom visualization. Learn the architectural design decisions behind stateless boundary detection, multi-instance support, and cross-asset volume handling to build a versatile indicator with benchmarking, technical, and analytical capabilities.
preview
From Novice to Expert: Weekend Gap Size Effect Research Using MQL5 and Python

From Novice to Expert: Weekend Gap Size Effect Research Using MQL5 and Python

The article provides a practical research setup for weekend gap analysis: MQL5 extracts precise pip‑based gaps and tracks fills, while Python performs statistical testing and visualization. You will compute fill rates by gap buckets, model fill probability with logistic regression, and assess time-to-fill via Kaplan–Meier curves. All steps are configurable and reproducible for EURUSD, GBPUSD, USDJPY and beyond.
preview
Interactive Supply and Demand Zone Manager in MQL5 (Part IV): Trading Supply and Demand Zones

Interactive Supply and Demand Zone Manager in MQL5 (Part IV): Trading Supply and Demand Zones

We extend the supply and demand framework with a strategy layer that converts zone interactions into decisions. Qualified zones pass sequential checks for interaction proximity, approach behavior, higher‑timeframe alignment, and price action before execution is handed to a dedicated trade manager. This architecture improves control, maintainability, and future extensibility without changing the underlying zone engine.
preview
How to Detect and Normalize Chart Objects in MQL5 (Part 5): Fibonacci in Focus

How to Detect and Normalize Chart Objects in MQL5 (Part 5): Fibonacci in Focus

The article bridges automated placement with manual analysis for the Fibonacci family in MQL5. It scans charts, identifies user Fibonacci objects, and normalizes their level arrays, interaction flags, and visuals per object type while preserving coordinates. With manual-priority enforcement, Expert Advisors can evaluate both human and code-generated tools reliably, without duplicates or runtime indexing issues.
preview
Interactive Supply and Demand Zone Manager in MQL5 (Part IV): Trading Supply and Demand Zones

Interactive Supply and Demand Zone Manager in MQL5 (Part IV): Trading Supply and Demand Zones

We extend the supply and demand framework with a strategy layer that converts zone interactions into decisions. Qualified zones pass sequential checks for interaction proximity, approach behavior, higher‑timeframe alignment, and price action before execution is handed to a dedicated trade manager. This architecture improves control, maintainability, and future extensibility without changing the underlying zone engine.
preview
Automating Terminal Startup for Service Tasks

Automating Terminal Startup for Service Tasks

The article explores the possibility of launching a terminal with a configuration file to perform automated routine tasks, programmatically handling such launches, and creating a fully-fledged system for auto-optimizing an EA using Windows OS tools.
preview
Measuring What Matters (Part 3): The Reconstruction Engine — Validating Risk Footprints with Matrix Algebra

Measuring What Matters (Part 3): The Reconstruction Engine — Validating Risk Footprints with Matrix Algebra

This article performs a numerical verification of MQL5 eigendecomposition for a covariance matrix using the spectral theorem A = V Λ Vᵀ. It reconstructs the matrix with Diag(), Transpose(), and MatMul(), computes the residual and its Frobenius norm, and shows that deviations remain at floating‑point precision, with results printed to the Experts journal.