In MetaTrader 5 build 6230, we have significantly expanded the capabilities of AI Assistant for interacting with the platform. New tools have been added for working with Expert Advisors, scripts, and indicators, preparing parameters before testing, and retrieving Economic Calendar data.
The agent can now independently perform even more complex sequences of actions β from preparing a trading robot for testing to analyzing the market in the context of macroeconomic events.
For developers, MQL5 capabilities have also been expanded. Vectors and matrices now feature a new sorting method, while complex matrices and vectors support additional mathematical operations, including products and methods for solving systems of equations. A Print method has also been added for matrices.
In addition, a number of issues related to interface rendering, chart operation, and connections to trading accounts have been fixed in the desktop and web terminals.
Read more...
The agent can now independently perform even more complex sequences of actions β from preparing a trading robot for testing to analyzing the market in the context of macroeconomic events.
For developers, MQL5 capabilities have also been expanded. Vectors and matrices now feature a new sorting method, while complex matrices and vectors support additional mathematical operations, including products and methods for solving systems of equations. A Print method has also been added for matrices.
In addition, a number of issues related to interface rendering, chart operation, and connections to trading accounts have been fixed in the desktop and web terminals.
Read more...
β€21π7π2π¨βπ»1
Bitmap-based CCanvas UIs in MQL5 suffer from startup overhead, blurred scaling, and theme duplication. This article replaces embedded .bmp resources with a procedural vector icon system that renders crisp at any size and recolors directly from the active palette.
The core is a small set of anti-aliased primitives (strokes, discs, rings, rounded rectangles, and polygons) using per-pixel coverage blending. Complex icons are then composed from these primitives using fractional positioning, keeping proportions consistent across header/sidebar sizes.
Logos and glyphs (MQL5 wordmark, layered orb, X, sun/moon, search, new chat, clear, history, toggle) are wired into existing render functions via icon IDs, removing all image-loading and resize code. Practical gains: simpler distribution, cleaner visuals, and reliable light/dark/hover rendering without extra assets.
π Read | AlgoBook | @mql5dev
The core is a small set of anti-aliased primitives (strokes, discs, rings, rounded rectangles, and polygons) using per-pixel coverage blending. Complex icons are then composed from these primitives using fractional positioning, keeping proportions consistent across header/sidebar sizes.
Logos and glyphs (MQL5 wordmark, layered orb, X, sun/moon, search, new chat, clear, history, toggle) are wired into existing render functions via icon IDs, removing all image-loading and resize code. Practical gains: simpler distribution, cleaner visuals, and reliable light/dark/hover rendering without extra assets.
π Read | AlgoBook | @mql5dev
β€19π₯4
An adaptive Fibonacci volatility band indicator for MT5 replaces fixed offsets with volatility-aware distances. It centers bands on a smoothed moving average of the chosen price and scales band width with a smoothed ATR, so levels expand in fast markets and contract in quiet ones.
Implementation focuses on clean MQL5 structure: multiple plot/buffer mappings for three upper/lower Fibonacci levels, a direction-colored middle line, and filled outer zones. Data handling uses an ATR(200) handle, CopyBuffer(), lookback limits, warm-up logic for SMMA initialization via an initial SMA, and incremental recalculation to stay efficient.
Result: dynamic volatility zones that help spot evolving support/resistance and provide a solid base for strategy rules and further indicator work.
π Read | AlgoBook | @mql5dev
Implementation focuses on clean MQL5 structure: multiple plot/buffer mappings for three upper/lower Fibonacci levels, a direction-colored middle line, and filled outer zones. Data handling uses an ATR(200) handle, CopyBuffer(), lookback limits, warm-up logic for SMMA initialization via an initial SMA, and incremental recalculation to stay efficient.
Result: dynamic volatility zones that help spot evolving support/resistance and provide a solid base for strategy rules and further indicator work.
π Read | AlgoBook | @mql5dev
β€20π7π2π¨βπ»2π€©1π1
StrategyTester5 targets a common MT5 Python workflow issue: live trading uses the MetaTrader5 package, while backtesting often requires a separate tester API and duplicated strategy logic.
The framework adds VirtualMetaTrader5, a shadow implementation that mirrors MT5 methods, constants, and properties, caching terminal/account/symbol state for simulation use.
A single mt5 variable swap switches environments, keeping one EA-style main() / on_tick callback for both live execution and historical replay.
Backtests run via run_backtesting(), which handles data prep, modeling modes (ticks/open/1m OHLC), optional Flask-SocketIO dashboard, and a lighter optimization mode.
Results return as a TesterStats object with MT5-style metrics. Historical inputs can come from parquet via HistoryManager or optionally from the terminal to reduce file I/O overhead.
π Read | Signals | @mql5dev
The framework adds VirtualMetaTrader5, a shadow implementation that mirrors MT5 methods, constants, and properties, caching terminal/account/symbol state for simulation use.
A single mt5 variable swap switches environments, keeping one EA-style main() / on_tick callback for both live execution and historical replay.
Backtests run via run_backtesting(), which handles data prep, modeling modes (ticks/open/1m OHLC), optional Flask-SocketIO dashboard, and a lighter optimization mode.
Results return as a TesterStats object with MT5-style metrics. Historical inputs can come from parquet via HistoryManager or optionally from the terminal to reduce file I/O overhead.
π Read | Signals | @mql5dev
β€19π₯5π4π€©2π€―1
This part advances an automated MT5 optimization pipeline that stores sequential Strategy Tester jobs in an SQLite database, turning manual multi-currency EA research into repeatable projects. The βproject creationβ EA behaves like a script: it generates stage-specific tasks, writes them to the DB, then exits.
Focus shifts to stage 2: combining top stage-1 passes into strategy groups and re-optimizing them with a chosen criterion (often a custom normalized annual profit) and an optional time cap to cut wasted tester runtime.
Key controls include filters on minimum custom metric, trade count, and Sharpe ratio, plus group size (2β16). The article also shows why iterative dry runs matter: a detected bug and missing symbol history can mark tasks βdoneβ while preventing the pipeline from producing the final EA, so DB inspection becomes part of debugging.
π Read | Signals | @mql5dev
Focus shifts to stage 2: combining top stage-1 passes into strategy groups and re-optimizing them with a chosen criterion (often a custom normalized annual profit) and an optional time cap to cut wasted tester runtime.
Key controls include filters on minimum custom metric, trade count, and Sharpe ratio, plus group size (2β16). The article also shows why iterative dry runs matter: a detected bug and missing symbol history can mark tasks βdoneβ while preventing the pipeline from producing the final EA, so DB inspection becomes part of debugging.
π Read | Signals | @mql5dev
β€17π₯6π€©5π4
This stage makes the replay/simulation framework usable without rewriting the Expert Advisor or position indicator. A small addition to C_InServer enables correct handling of symbols used on hedging accounts, keeping server vs simulator execution transparent.
The focus shifts to C_Orders, where trade requests are decoded. Error handling is refactored so messages look consistent across real and simulated servers, with symbol-tagged output to trace request origin.
TRADE_ACTION_DEAL is implemented incrementally, since it must behave differently on netting vs hedging: update an existing position (including average price logic) or create a new one. The simulator also introduces an optional server-response delay hook, and fixes ticket generation to prevent duplicates.
Result: market opens and SL/TP edits can be tested end-to-end in replay; full closing ...
π Read | NeuroBook | @mql5dev
The focus shifts to C_Orders, where trade requests are decoded. Error handling is refactored so messages look consistent across real and simulated servers, with symbol-tagged output to trace request origin.
TRADE_ACTION_DEAL is implemented incrementally, since it must behave differently on netting vs hedging: update an existing position (including average price logic) or create a new one. The simulator also introduces an optional server-response delay hook, and fixes ticket generation to prevent duplicates.
Result: market opens and SL/TP edits can be tested end-to-end in replay; full closing ...
π Read | NeuroBook | @mql5dev
β€11π€©10π9π₯4π1π1
This article proposes a reusable MQL5 Expert Advisor template that separates strategy rules from platform plumbing. Instead of mixing signals, execution, and risk logic inside OnTick, the framework standardizes recurring tasks: history loading, new-bar detection, order management, spread checks, commission/swap handling, and UI updates.
Core architecture: a Virtual Chart (cached OHLC/time), a Robot class (state + trading operations), and a single Simulated() loop. Live trading uses a 1-second timer for stability with sparse ticks; the Strategy Tester runs on ticks, but both share the same entry point.
Trading logic plugs into one method that sets two variables: entry direction and close direction. Built-in modules cover auto lot sizing, risk controls, additional entries, martingale, and timed βwaiting out losses,β with inputs grouped for safer testing and o...
π Read | Signals | @mql5dev
Core architecture: a Virtual Chart (cached OHLC/time), a Robot class (state + trading operations), and a single Simulated() loop. Live trading uses a 1-second timer for stability with sparse ticks; the Strategy Tester runs on ticks, but both share the same entry point.
Trading logic plugs into one method that sets two variables: entry direction and close direction. Built-in modules cover auto lot sizing, risk controls, additional entries, martingale, and timed βwaiting out losses,β with inputs grouped for safer testing and o...
π Read | Signals | @mql5dev
β€19π10π₯8π€©3
Average True Range (ATR) is derived from True Range (TR), defined as max(High-Low, abs(High-Close[1]), abs(Low-Close[1])). Initialization typically computes TR over Length bars, then uses the SMA of those values as the first ATR.
RMA uses alpha=1/Length and updates as: rma = alpha*TR + (1-alpha)*prev_rma. SMA mode recalculates the simple average of TR over the last Length bars on each candle. EMA uses alpha=2/(1+Length) with: ema = alpha*TR + (1-alpha)*prev_ema. WMA applies linear weights: sum = N*TR[0] + (N-1)*TR[1] + β¦ + 1*TR[N-1], then wma = sum / (N*(N+1)/2).
Common validation setup: XAUUSD on H1, comparing RMA, EMA, SMA, and WMA outputs side by side.
π Read | Docs | @mql5dev
RMA uses alpha=1/Length and updates as: rma = alpha*TR + (1-alpha)*prev_rma. SMA mode recalculates the simple average of TR over the last Length bars on each candle. EMA uses alpha=2/(1+Length) with: ema = alpha*TR + (1-alpha)*prev_ema. WMA applies linear weights: sum = N*TR[0] + (N-1)*TR[1] + β¦ + 1*TR[N-1], then wma = sum / (N*(N+1)/2).
Common validation setup: XAUUSD on H1, comparing RMA, EMA, SMA, and WMA outputs side by side.
π Read | Docs | @mql5dev
β€9π7π€©5π₯3π¨βπ»1
The article shows how MQL5 operator overloading can be used to express data-structure operations with stream-style syntax similar to C++ input/output, improving readability when done with clear intent.
A pointer-based queue is rebuilt using overloaded operators, where a small header-only change switches behavior between LIFO (stack) and FIFO without rewriting the calling code. This demonstrates separating policy (order) from usage.
The same idea is extended to a linked list: adding a subscript operator enables array-like access, then the implementation is revised so assignments append new nodes instead of overwriting existing values. The final design uses a doubly linked list and avoids traversal by maintaining links during insertion, making updates predictable for trading utilities like event queues and order pipelines.
π Read | Quotes | @mql5dev
A pointer-based queue is rebuilt using overloaded operators, where a small header-only change switches behavior between LIFO (stack) and FIFO without rewriting the calling code. This demonstrates separating policy (order) from usage.
The same idea is extended to a linked list: adding a subscript operator enables array-like access, then the implementation is revised so assignments append new nodes instead of overwriting existing values. The final design uses a doubly linked list and avoids traversal by maintaining links during insertion, making updates predictable for trading utilities like event queues and order pipelines.
π Read | Quotes | @mql5dev
β€15π₯6π5
This update finalizes the MT5 replay/simulation system for training by aligning simulated pricing with live-server behavior. A small fix removes hardcoded SYMBOL_DIGITS side effects, and a new config option lets users set per-symbol decimal precision so the position indicator formats prices correctly (e.g., instruments with 0.5 ticks).
Database stability is improved by moving table-creation SQL into an external script embedded as a resource and adding constraints to prevent invalid or duplicate records, reducing corruption risks without extra application logic.
Take Profit and Stop Loss become functional by adding a close-price check inside the position indicator and firing a custom event to the EA to close positions. The same event-driven pattern can be adapted to simulate pending orders by changing the trigger conditions and emitting the appropri...
π Read | Freelance | @mql5dev
Database stability is improved by moving table-creation SQL into an external script embedded as a resource and adding constraints to prevent invalid or duplicate records, reducing corruption risks without extra application logic.
Take Profit and Stop Loss become functional by adding a close-price check inside the position indicator and firing a custom event to the EA to close positions. The same event-driven pattern can be adapted to simulate pending orders by changing the trigger conditions and emitting the appropri...
π Read | Freelance | @mql5dev
β€15π€©8π4π₯3
PDF generation in MQL5 can work without DLLs when the format is treated as plain text plus a bottom index.
A minimal PDF has five regions: header, numbered objects, xref table, trailer, and %%EOF. Only the object list grows; most of the file is boilerplate.
The body is a flat set of indirect objects referenced by βN 0 Rβ. Pages do not embed content or fonts directly; they reference a content stream and resource objects.
PDF values are limited to eight types, with names (/Helvetica) distinct from strings ((Hello)). Streams require an exact /Length byte count.
A single page typically needs Catalog, Page Tree, Page, Contents stream, and Font. Correct xref byte offsets and startxref are critical; a one-byte shift breaks the file.
Content streams use postfix operators (BT, Tf, Td, Tj, ET). Multi-line layouts rely on relative Td moves and can switch fonts mid-s...
π Read | Docs | @mql5dev
A minimal PDF has five regions: header, numbered objects, xref table, trailer, and %%EOF. Only the object list grows; most of the file is boilerplate.
The body is a flat set of indirect objects referenced by βN 0 Rβ. Pages do not embed content or fonts directly; they reference a content stream and resource objects.
PDF values are limited to eight types, with names (/Helvetica) distinct from strings ((Hello)). Streams require an exact /Length byte count.
A single page typically needs Catalog, Page Tree, Page, Contents stream, and Font. Correct xref byte offsets and startxref are critical; a one-byte shift breaks the file.
Content streams use postfix operators (BT, Tf, Td, Tj, ET). Multi-line layouts rely on relative Td moves and can switch fonts mid-s...
π Read | Docs | @mql5dev
β€19β‘3π3π3π€©2
SAGDFN targets noisy, redundant market data by keeping only neighbors that measurably influence the system. After implementing Significant Neighbors Sampling in OpenCL, the focus shifts to Sparse Spatial Multi-Head Attention to extract structure from the selected links while staying compute-efficient.
A key optimization avoids per-pair embedding concatenation. By splitting the first linear layer into separate query/key projections computed once per node, pair logits become simple vector additions, cutting complexity from O(NMhd) to O(Nhd)+O(NMh) and reducing memory pressureβwell-suited to GPU execution in MQL5+OpenCL.
For attention normalization, iterative Ξ±-Entmax is replaced with Sparse-SoftMax to keep sparsity without expensive Ο searches. The OpenCL forward kernel computes head-wise sparse weights with local reductions, NaN/Inf guards, bounds-che...
π Read | Calendar | @mql5dev
A key optimization avoids per-pair embedding concatenation. By splitting the first linear layer into separate query/key projections computed once per node, pair logits become simple vector additions, cutting complexity from O(NMhd) to O(Nhd)+O(NMh) and reducing memory pressureβwell-suited to GPU execution in MQL5+OpenCL.
For attention normalization, iterative Ξ±-Entmax is replaced with Sparse-SoftMax to keep sparsity without expensive Ο searches. The OpenCL forward kernel computes head-wise sparse weights with local reductions, NaN/Inf guards, bounds-che...
π Read | Calendar | @mql5dev
β€9π₯2π1π¨βπ»1
Dragonfly Algorithm (DA), proposed by Seyedali Mirjalili in 2015, models two swarm modes: static hunting and dynamic migration. These map directly to exploitation and exploration in population-based optimization.
Each agent applies five terms per iteration: separation, alignment, cohesion, attraction to the current best (Food), and repulsion from the current worst (Enemy). Velocity is updated as a weighted sum plus inertia, then position is advanced and clamped to bounds.
When an agent has insufficient neighbors and Food is out of range, DA switches to LΓ©vy flight using Mantegna sampling to generate heavy-tailed steps.
Adaptive control drives convergence: neighborhood radius increases over epochs, inertia drops from 0.9 to 0.4, and s/a/c/e decay to zero mid-run, leaving Food attraction dominant. Population size is the main external parameter.
π Read | Signals | @mql5dev
Each agent applies five terms per iteration: separation, alignment, cohesion, attraction to the current best (Food), and repulsion from the current worst (Enemy). Velocity is updated as a weighted sum plus inertia, then position is advanced and clamped to bounds.
When an agent has insufficient neighbors and Food is out of range, DA switches to LΓ©vy flight using Mantegna sampling to generate heavy-tailed steps.
Adaptive control drives convergence: neighborhood radius increases over epochs, inertia drops from 0.9 to 0.4, and s/a/c/e decay to zero mid-run, leaving Food attraction dominant. Population size is the main external parameter.
π Read | Signals | @mql5dev
β€3