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
Creating a Traditional Renko Overlay Indicator in MQL5

Creating a Traditional Renko Overlay Indicator in MQL5

Create a traditional Renko indicator in MQL5 that converts candlestick closing prices into fixed-size blocks displayed on the main chart. We calculate the movement from the closing price of the last block, create new blocks of a user-defined size, confirm reversals using the two-block rule, manage block closing prices in a dynamic array, and display rectangles for visualizing the trend in real time.
preview
MetaTrader 5 Machine Learning Blueprint (Part 13):  Implementing Bet Sizing in MQL5

MetaTrader 5 Machine Learning Blueprint (Part 13): Implementing Bet Sizing in MQL5

We build a production MQL5 bet‑sizing toolkit: utilities, snippets, and user‑level functions that mirror the Python originals. The methods cover probability‑to‑size mapping with overlap correction, dynamic forecast‑price sizing (calibrated sigmoid/power with limit price), occupancy‑based budgeting, and mixture‑model reserve sizing (EF3M). The result is a signed [−1, ..., 1] position plus diagnostics you can plug directly into order logic.
preview
MQL5 Trading Tools (Part 28): Filling Sweep Polygons for Butterfly Curve in MQL5

MQL5 Trading Tools (Part 28): Filling Sweep Polygons for Butterfly Curve in MQL5

We expand the capabilities of the MetaTrader 5 butterfly curve canvas by adding multi-layered wing fills, vein lines, scale dots, and a full body (abdomen, thorax, head, eyes, antennae). This article implements polygon fills with vertical and radial gradients, as well as filled circles and ellipses, all using supersampling antialiasing. You will also receive reusable MQL5 helper functions and a rendering order that transforms a simple curve into a customizable, detailed chart illustration.
preview
Engineering Trading Discipline into Code (Part 4): Enforcing Trading Hours and News Disabling in MQL5

Engineering Trading Discipline into Code (Part 4): Enforcing Trading Hours and News Disabling in MQL5

An MQL5 control system that blocks orders outside scheduled trading hours and during scheduled news releases, converting time rules into executable restrictions. It combines a permissions management mechanism, a transaction-level expert advisor, and a visual dashboard for real-time status and upcoming restrictions. Configuration is accomplished using editable files, with caching and a CSV audit log for traceability.
preview
From Novice to Expert: Automating Base-Candle Geometry for Liquidity Zones in MQL5

From Novice to Expert: Automating Base-Candle Geometry for Liquidity Zones in MQL5

This article implements an MQL5 module that analyzes the lower‑timeframe bars inside each liquidity‑zone base candle. It detects swing points and applies objective rules to classify the internal structure as an ascending, descending, or symmetrical triangle; a rectangle; M; W; or undefined. The indicator displays geometry labels on the chart and adds the pattern to alerts, reducing manual lower‑timeframe inspection.
preview
Deterministic Oscillatory Search (DOS)

Deterministic Oscillatory Search (DOS)

Deterministic Oscillatory Search (DOS) algorithm is an innovative global optimization method that combines the advantages of gradient and swarm algorithms without the use of random numbers. The fitness oscillation and slope mechanism allows DOS to explore complex search spaces in a deterministic manner.
preview
Neural Networks in Trading: Adaptive Detection of Market Anomalies (Final Part)

Neural Networks in Trading: Adaptive Detection of Market Anomalies (Final Part)

We continue to build the algorithms that form the basis of the DADA framework, which is an advanced tool for detecting anomalies in time series. This approach enables effective distinguishing random fluctuations from significant deviations. Unlike classical methods, DADA dynamically adapts to different data types, choosing the optimal compression level in each specific case.