MQL5 Algo Trading
541K subscribers
3.87K photos
6 videos
3.88K links
The best publications of the largest community of algotraders.

Subscribe to stay up-to-date with modern technologies and trading programs development.
Download Telegram
Parts 2–6 generate eleven one‑minute environment metrics. Acting on all of them in real time is impractical for sizing and risk controls, so Part 7 reduces the vector to a single regime label plus quality scores.

RegimeClassifier() maps the metrics into six regimes: Normal, Stressed, Noisy, Informed, Trending, Mean‑Reverting. It returns confidence in [0,1] and a composite directional score in [-1,+1]. Boundaries are percentile thresholds calibrated on 514 NQ M1 sessions (May 2024–May 2026).

Classification is rule-based with priority ordering: Stressed, Informed, Trending, Noisy, Mean‑Reverting, Normal. Reliability is the geometric mean of MFDFA fit confidence and flow_confidence; roll confidence is excluded. Deliverables include MARKET_REGIME, RegimeAnalysis, RegimeClassifier(), and PopulateRegimeAnalysis() calling Parts 2–6 sequentially.

👉 Read | Docs | @mql5dev
21👌2
Media is too big
VIEW IN TELEGRAM
In June, MetaQuotes participated as a Gold Sponsor at iFX EXPO International 2026, in Limassol, one of the major international events.

At the exhibition, we recorded a series of short interviews with representatives of brokerage companies.

They shared their experience using MetaQuotes solutions, discussed the evolution of MetaTrader 5 and new products in the ecosystem, and highlighted the opportunities these technologies create for modern brokerage businesses.

Ultency — a liquidity aggregation and order matching engine integrated with MetaTrader 5
metatrader.com — a new portal offering financial news, market analysis, trading ideas, educational content, and algorithmic trading tools
• MetaTrader Access Servers — a global network of access servers ensuring fast and stable connections to the trading platform for traders worldwide
Integrated payments, enabling traders to fund their accounts directly from MetaTrader

Discuss the video:
👉 MQL5.community for traders
👉 MetaQuotes official YouTube channel
27🔥4👀4👍2👌2
John F. Ehlers treats price as a signal with frequency components, not a chart pattern. The focus is a practical MQL5 DSP library that ports published coefficients and formulas, with indicators and an EA sharing identical code paths.

Core point: smoothing is filtering. The SMA is a weak low-pass filter: material lag plus a poor frequency response that leaks noise. A 2-pole IIR design reduces noise with less delay.

Library design uses stateful recursive filters with explicit history, warm-up handling, and a single include file as the source of truth. No iCustom dependency for the EA.

Implemented tools: Super Smoother (2-pole low-pass), Roofing Filter (2-pole high-pass cascaded into Super Smoother to isolate a tradeable band), and Even Better Sinewave, which flags non-cycling regimes by sustained railing near ±1.

👉 Read | CodeBase | @mql5dev
28👌4
Part 7 finalizes the MMAR library’s generative stack by adding CMonteCarlo, a thin orchestration layer that turns a single simulated path into a volatility forecast distribution.

The class initializes with fitted multifractal parameters, runs N independent MMAR simulations over a chosen horizon, and aggregates per-path volatilities into mean, median, standard deviation, and a percentile-based 95% confidence interval. Raw per-run outputs remain accessible for custom diagnostics.

Key implementation details include adaptive cascade depth (choosing the smallest b^k that covers the horizon), clean per-trial engine instantiation, and resilient failure handling that skips rare FBM factorization issues without aborting the run.

A full EURUSD M10 pipeline completes in ~1.3s for 100 simulations, making periodic EA recalibration practical without running o...

👉 Read | Signals | @mql5dev
27👍4
Algorithmic trading keeps running into the same constraint: higher model complexity improves backtests while increasing overfitting risk, and non-stationary markets invalidate static patterns. Full retraining also amplifies catastrophic forgetting, forcing a tradeoff between stability and adaptability.

Quantum Reservoir Computing (QRC) addresses this by keeping the reservoir fixed and training only the output layer. A four-qubit circuit maps features into a 16-state space via qubit rotations, relying on quantum nonlinearity and feature coupling.

The implementation uses Monte Carlo approximation, a 1000-sample experience buffer with decay, online plus batch updates, and adaptive learning rates. Tests on EURUSD M15 (2017–2025) reported +USD 505 on 0.01 lots from USD 1,000, Sharpe 1.22, win rate 82%, with strong sensitivity to data artifacts and news...

👉 Read | CodeBase | @mql5dev
294👏21👌1
The article shows why moving MT5/MQL projects from “code + ZIP attachment” to MQL Algo Forge becomes necessary once libraries evolve across many articles. Git-backed history removes the pain of repackaging archives, comparing versions, and supporting users with unclear change sets.

A practical workflow emerges: start projects in Shared Projects, choose a project type for executables or use empty projects for multi-file or mixed outputs, then commit frequently. For older libraries, import versions sequentially and create Releases (stable/beta) so readers can target exact published states.

Key pitfall: Algo Forge reliably tracks diffs only for UTF-8 files; MetaEditor may save as Unicode, causing files to be treated as binary and hiding history. Documentation matters too: meaningful commit messages and a clear README.md turn a repository from a file dump into m...

👉 Read | Freelance | @mql5dev
37🎉5👍3🔥1👌1
An updated MQL5 implementation of the Shved Supply and Demand indicator is available with multi-timeframe support and a history review mode.

Zones are calculated using fractals and ATR, then rendered on the chart for a selectable timeframe independent of the current chart. Zone states include weak, untested, verified, proven, and broken (broken state not used for weak zones). These classifications reflect whether price has retested and failed to break a level multiple times.

History mode can be enabled by setting the historyMode parameter to true, then double-clicking a point on the chart to display support/resistance zones for that moment.

Recent revisions address compile warnings, low-bar edge cases, alignment with the MT4 version, corrected labels in history mode, and an optional mobile notification when price enters a zone.

👉 Read | Signals | @mql5dev
28👌3👍1
Duelist Algorithm (DA) is a population-based optimizer proposed in 2015 by Biyanto’s group to reduce reliance on blind mutation and crossover. The model separates roles: losers copy parts of winners, winners apply controlled innovation, and top champions spawn new candidates while skipping duels.

An MQL5 implementation can be structured as C_AO_DA_duelist with parameters for population size, luckCoefficient, learningProbability, innovationProbability, and championsCount. Core steps: initialize population on a discrete grid, select champions, run randomized duels with a luck term, apply learning to losers, mutate winners, retrain from champions, sort by fitness, and cull to fixed size.

Benchmarks on Hilly, Forest, and Megacity functions (10,000 runs) produced an overall score of 4.34477 (48.28%). DA ranked 42nd among tested methods, with low disper...

👉 Read | NeuroBook | @mql5dev
235👍2👌2
MetaTrader 5 lacks a native volume profile, but a session-based implementation can be built entirely in MQL5 using CopyTicksRange() plus standard chart objects. The indicator pulls ticks for a defined London/New York/custom window, bins prices into a histogram, then derives POC and the 70% Value Area (VAH/VAL) by expanding outward from the highest-volume bin.

A key implementation detail for FX/CFDs: real volume fields are often zero, so tick filtering must rely on non-zero bid/ask, with each tick weighted as 1 to form a tick-density profile.

The design is modular: session rollover detection, tick collection, histogram building, POC/Value Area calculation, and renderer. Complexity stays linear in ticks, with far fewer bins than ticks in practice.

👉 Read | Docs | @mql5dev
27👌2
This article extends the MQL5 Wizard trailing-stop toolkit with a dual-engine model designed for fast, whipsawed “Z-type” markets where classic trailing stops overreact to every tick.

Engine 1 is a Hampel-style sliding window median with MAD, treating recent prices as a distribution and rejecting wick-like anomalies so stop updates follow “real” movement instead of transient spikes. Bollinger Band width can scale the rejection threshold to match volatility.

Engine 2 adds directional context via a BiLSTM that reads the same window forward and backward to produce a bounded trend score, allowing the stop to tighten aggressively when momentum is real, but stay stable during noise.

👉 Read | Signals | @mql5dev
24👍2👌2
Forward Simulation Engine for MetaTrader 5 has been extended from a static EMA-crossover projection into a live, self-updating forward sequence.

A calibration layer now samples recent closed bars to compute average body and wick sizes. Projections reuse these metrics so candle dimensions align with the current symbol/timeframe volatility, while EMA slope remains a momentum scaler.

Prediction adds a sine envelope plus decay for body sizing, proportional wicks via wick-to-body ratios, and periodic reduced counter-trend candles. Rendering keeps object-based bodies and wicks, supports configurable spacing, and advances on each bar close by deleting the oldest projected candle to stay one bar ahead.

Implementation details include modular signal/prediction/renderer separation, OnCalculate-driven updates, optional manual anchor control via OnTimer, pip-distance ...

👉 Read | AlgoBook | @mql5dev
27👍3👌3
Dream Optimization Algorithm (DOA) adapts a “sleep cycle” model for parameter tuning in trading systems, aiming to keep exploration strong while still converging reliably in non-stationary markets.

The population is split into groups with different “memory styles.” Each iteration begins by pulling agents back to the current group-best (partial retention), then applies either selective forgetting or “dream sharing.” Forgetting changes k randomly chosen dimensions using cosine-modulated steps that start large and shrink over time; dream sharing copies k dimensions from another agent to spread useful traits.

DOA runs almost entirely in exploration, then switches to a short exploitation phase where all agents reset to the global best and perform small cosine-damped refinements. The MQL5 implementation wraps this as a reusable optimizer class with clear phase co...

👉 Read | Signals | @mql5dev
23👍1
This MQL5 indicator turns market structure from manual chart reading into a deterministic, testable pipeline. It detects major external swings (S1–S4) with explicit swing-high/low functions, then refines true extremes between anchors to produce stable EXH/EXL levels and validate bullish/bearish sequences.

Once the external leg is confirmed, it scans inside that range with a smaller lookback to find the first internal shift (IH → IL → CHoCH/BOS). That first valid break becomes a complete trade blueprint: entry marker, stop at the internal low/high, and take profit projected at 1.5R.

Implementation favors reproducibility: runs once per new bar, avoids out-of-range scans, draws via chart objects with a strict prefix, prevents duplicates, and redraws only when needed for performance and clean cleanup.

👉 Read | AlgoBook | @mql5dev
38👌53👏2😈2
OnChart Candle Countdown Clock supports all timeframes and provides an on-chart timer with a minimal footprint. Configuration is handled through a small set of display parameters.

Font color and font size can be adjusted to match chart themes and readability requirements.

Horizontal and vertical offsets are available via left-right and up-down shift settings, allowing precise positioning without affecting chart content.

Placement can also be pinned to a preferred chart corner through the candle clock placement option. Installation and operation are designed to be straightforward, with no additional functional modules beyond these controls.

👉 Read | Freelance | @mql5dev
21👍9👌1👾1
A spread calculator indicator is designed to display the current spread for a currency pair directly on the chart, helping filter out entries during widened execution costs.

A configurable maximum spread threshold is used as a hard limit for trade consideration. When the live spread exceeds this limit, the display switches to red for immediate visibility. When the spread remains within the configured limit, the display switches to green.

Chart output includes both positive and negative spread states, with color-coded status for each. External parameters are labeled in plain English to keep configuration straightforward and reduce misinterpretation during live trading.

👉 Read | AlgoBook | @mql5dev
19👍7👌1
GARCH(1,1) often mis-specifies volatility persistence: either shocks decay too fast, or persistence is pushed toward IGARCH behavior with near-permanent effects. Empirical volatility clusters frequently persist for weeks, making a single exponential kernel inadequate.

Long memory can be validated on |r| or r² using Hurst R/S with partition safeguards (min 10–20 points, max N/2 or N/4, log-spaced windows) and the GPH test for fractional integration d, with alpha near 0.5 and sensitivity checks on large samples. A log-log periodogram provides a visual check at ultra-low frequencies.

Model selection follows diagnostics and operational constraints. FIGARCH fits smooth low-frequency linear spectra (hyperbolic decay, d in 0–0.5) but requires truncated infinite sums (often 1,000+ lags) in MQL5. HARCH is faster, uses explicit multi-horizon aggregation, but ...

👉 Read | AlgoBook | @mql5dev
23🏆8👍7👌2
Maximum drawdown hides the time-based reality of risk: two strategies can share the same 18% worst drop while behaving completely differently in how long they stay below a prior peak and how quickly they recover.

The article builds a native MT5 MQL5 analyzer that reconstructs an equity and underwater curve from daily closed PnL, then segments it into drawdown episodes with peak, trough, and recovery dates, plus depth, duration, and recovery time (with unrecovered episodes handled explicitly).

It reports persistence-focused metrics (time underwater, longest underwater period), Ulcer Index and Pain Index from daily underwater depths, and Recovery Factor. These are combined into a configurable resilience grade (A+ to F) with recommendations, aimed at comparing systems beyond a single headline drawdown.

👉 Read | AppStore | @mql5dev
21👍7👌2
High-frequency financial time series remain difficult to forecast due to irregular sampling, short-lived spikes, and noise amplification from HFT activity. Classic RNNs struggled with long contexts; LSTMs improved memory but still tend to overfit micro-fluctuations.

ACEFormer proposes an end-to-end pipeline combining denoising, time-interval awareness, and selective attention. Noise reduction uses a modified ACEEMD to mitigate end effects and mode mixing, then removes the first IMF to suppress high-frequency oscillations while keeping turning points.

Temporal modeling adds a time-aware module for elapsed-time handling, followed by probabilistic attention that scores queries via sampled keys and computes attention on a reduced subset. An MQL5/OpenCL implementation outlines three kernels: query importance, Top-K selection, and indexed attention for context generat...

👉 Read | Docs | @mql5dev
23👍7👌21
Structural-break features shift the focus from “what the current bar looks like” to “whether the process generating it has changed,” targeting regime transitions that often drive forced liquidation and outsized moves.

Two test families are implemented: CUSUM via Chu–Stinchcombe–White (trend detection from standardized level deviations with a time-varying critical value), and explosiveness tests (Chow-type DFC for a single unknown break and SADF for multiple switches using a supremum over expanding start points).

SADF is extended with sub/super-martingale forms and two robust variants, QADF and CADF, which reduce false explosiveness from outlier windows by replacing the supremum with a high-quantile statistic or a conditional tail mean.

The article also explains why book-style Python code fails at scale (O(T²) loops, repeated Pandas construction, and a...

👉 Read | Freelance | @mql5dev
25👍8👌42
Support/resistance detection in MQL5 is straightforward, but produces too many valid levels with no strength ranking. MetaTrader 5 has no native way to separate defended zones from incidental ones inside the current viewport.

A viewport-aware SnR volume profile addresses this by recalculating only on the visible range and adapting bin resolution to zoom level. SnR zones are detected via wick or body rules with pivot validation, then volume is accumulated into price bins and normalized for consistent scaling.

Rendering uses chart rectangles for per-bin strength and a single POC horizontal line. Updates are event-driven via CHARTEVENT_CHART_CHANGE plus new-bar handling in OnCalculate, keeping output responsive and performant.

👉 Read | Signals | @mql5dev
28👍5👀5👌2🎉1
Algorithmic trading development continues to balance interpretability against nonlinear modeling under high noise and limited samples. A two-stage design addresses this by separating stable structure from residual complexity.

Stage one uses a 25-feature linear autoregressive model to capture core statistical behavior and produce an interpretable baseline. Stage two trains a U-Transformer on the linear residuals, reducing variance and limiting overfit risk.

The U-Transformer adapts U-Net encoder-decoder with skip connections and adds Transformer attention for long-range temporal dependencies. Intraday seasonality is handled via time features rather than generic positional encoding.

Implementation targets MQL5 with fixed-size memory layouts, online training, periodic re-optimization, adaptive weighting between linear and neural outputs, and full tr...

👉 Read | Forum | @mql5dev
29👍7🔥2👌2😁1🏆1