MQL5 Algo Trading
542K subscribers
3.89K photos
6 videos
3.89K 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
Gold FVG Finder detects fair value gaps (FVG) as market imbalance zones and marks the first retest with an arrow. Designed for liquid instruments including XAUUSD and major FX pairs, covering M5 to H4.

An FVG is formed when price moves quickly, leaving a gap between the wicks of the first and third candles that is not covered by the middle candle body. These areas are treated as unfilled liquidity, with the primary signal generated on the first return to the zone.

Chart output includes green bullish zones and red bearish zones, each with a 50% Consequent Encroachment level. Arrows trigger on the first touch only to prevent repeated entries. A panel shows current RSI and active zone count.

Options include an RSI filter (period, overbought/oversold thresholds), alerts, colors, and max history depth. M15 is cited as the preferred balance for XAUUSD, wi...

πŸ‘‰ Read | Calendar | @mql5dev
❀35πŸ‘11πŸ‘Œ3⚑2
V1N1 LONNY is a multi-symbol Asian Range Breakout day-trading EA focused on London session breakouts. It places BuyStop/SellStop pending orders, anchored to the latest Parabolic SAR swing plus an ATR-based buffer.

The pre-London Asian range, measured on real H1 bars, defines a strict no-trade zone. Buy stops are only valid above the Asian high and sell stops only below the Asian low. Trade qualification combines PSAR, MACD direction, and Stochastic to avoid overbought/oversold entries. An ADR-based filter ignores Asian ranges that are too small or too large.

Stops are set at the opposite PSAR swing and bounded by ADR-derived limits. Take profit is calculated from stop distance using a fixed ratio. Management includes MACD reversal exits, trailing, break-even, scheduled flattening near New York close or symbol session close, plus daily profit/loss shutdown. ...

πŸ‘‰ Read | Calendar | @mql5dev
❀27πŸ‘8πŸ‘Œ3
Algorithmic trading optimization continues to shift toward metaheuristics when parameter counts make grid search impractical. A recent implementation review covers the Artificial Atom Algorithm (A3), proposed in 2018, with atoms as candidate solutions and electrons as decision variables, using covalent and ionic bond operators.

The reference paper leaves key operators underspecified, including bonding mechanics and any meaningful way to β€œsort electrons”. A pragmatic implementation resolves gaps with conventional population-optimizer structure: random initialization, iterative position updates, and strict range/step discretization.

Core design uses a C_AO base plus S_AO_Agent state (current/previous/best/worst coordinates and fitness). A3 adds Moving() with a covalent subset biased toward global best and a remaining subset sampling interactions, plu...

πŸ‘‰ Read | Docs | @mql5dev
❀26πŸ‘8⚑2πŸ‘Œ2πŸ‘€1
Part II extends the stateful supply/demand zone framework with persistence and event-driven synchronization in MetaTrader 5.

Polling-based chart scans are replaced by OnChartEvent(), reducing per-tick overhead and routing user actions only when object lifecycle events occur. Market processing remains in OnTick(), while manual chart interactions are handled independently to avoid accidental overwrites.

The synchronization layer is decomposed into focused handlers: RegisterHybridZone() for onboarding new rectangles, UpdateZoneCoordinates() for coordinate sync and promotion from engine-managed to user-managed on manual edits, and RemoveZoneByName() for safe retirement, reverse-iteration deletion, blacklist protection, and final lifecycle capture.

A structured routing layer classifies inbound platform events and dispatches them to dedicated processors, ...

πŸ‘‰ Read | NeuroBook | @mql5dev
❀31πŸ‘7πŸ‘Œ3⚑2🀣1
This article turns a Takens-embedded price point cloud and distance matrix into a computable Vietoris–Rips filtration, ready for persistent homology. It enumerates simplices up to dimension 2 (vertices, edges, triangles), assigns filtration values (0, pairwise distance, max edge in a triangle), and sorts by filtration with dimension tie-breaks so faces always precede cofaces.

CTDARips focuses on performance: single-pass construction, amortized O(1) appends, then a global sort. Post-sort lookup tables map vertices and edges to global simplex indices in O(1), avoiding costly scans during boundary construction.

CTDABoundary builds a sparse boundary matrix over Z/2 using packed buffers and per-column offsets. Each column stores face indices in ascending order so pivots are cheap to read during reduction. A small square example and combinatorial counts va...

πŸ‘‰ Read | Calendar | @mql5dev
❀17πŸ‘17⚑3πŸ‘Œ1
Part 38 extends the MQL5 object editor from a floating ribbon to a full tabbed settings window for complete property coverage.

A new CSettingsWindow (derived from CRibbon) opens from the ribbon’s Settings button, binds to the selected chart object, and reuses the existing descriptor list, engine get/set API, and shared popovers (color, width, style).

The UI is organized into Style, Text, Coordinates, and Visibility tabs with a scrollable body. Level lists expand into per-level rows with visibility, ratio, color, width, and style fields. Coordinates adds exact price/time entry for anchors, plus bounded numeric chip editing.

Edits preview live via a property snapshot. Closing commits by discarding the snapshot, or cancels by restoring it and redrawing the object set.

πŸ‘‰ Read | Signals | @mql5dev
❀30πŸ‘6✍2⚑2πŸ‘Œ2
Monolithic OnTick() handlers often accumulate nested conditionals that encode strategy phases as scattered boolean combinations. The result is mixed responsibilities: determining the current phase and selecting the action on every tick, with higher regression risk and unnecessary branching cost.

A finite state machine makes phases explicit: idle, entry, in-trade, exit. Each tick runs a single dispatch to the active state, limiting execution to relevant logic and producing a predictable control path.

In MQL5, the design typically uses IState with OnEnter/Evaluate/OnExit, plus a CStrategyContext that owns state instances and mediates transitions via SetState(). Circular includes are handled by splitting declarations, state definitions, and context implementations across three files to enforce compilation order.

πŸ‘‰ Read | Calendar | @mql5dev
❀46πŸ‘6πŸ‘Œ6✍1
We're introducing a new beta version of MetaTrader 5 with built-in support for the Model Context Protocol (MCP) and agentic AI.

The built-in AI Assistant helps you analyze markets. It can explain current market conditions for a symbol, review your open positions, analyze your trading history, answer questions about financial instruments, and provide context on recent market events.

The AI Assistant in MetaEditor is now a full-featured development assistant. It can:

β€’ Generate new MQL5 programs
β€’ Analyze existing code
β€’ Detect errors and suggest fixes
β€’ Explain complex algorithms
β€’ Assist with refactoring and further development of projects

The integration of MCP and agentic AI introduces an entirely new way to interact with the trading platform. We will continue to expand these capabilities and invite traders and MQL5 developers to help us test them.

Read more...
❀237πŸ”₯34πŸ‘20πŸ’―17⚑15πŸ€”13πŸ‘10
A research-grade Expert Advisor is available for testing day-of-week market patterns. It reads the prior daily candle and opens the next day either as continuation or reversal, with configurable weekday combinations to measure calendar effects across Forex, commodities, and indices.

Trades can be force-closed at a specified hour to isolate the pure weekday effect, or managed with optional Stop Loss, Take Profit, and an ATR-based volatility filter to compare raw patterns versus rule-based management.

Key parameters include fixed or risk-based sizing, day selection, direction mode, Daily ATR period, minimum range filter, ATR-multiple Stop Loss, RR-based Take Profit, CloseHour, and MagicNumber. Logic is evaluated only on new D1 bars, with one position per symbol. If SL is disabled, risk sizing is not available.

Backtests (2016–2026) covered EURUSD, XAUUSD, an...

πŸ‘‰ Read | Calendar | @mql5dev
❀47πŸ‘9πŸ‘€4πŸ‘Œ2
DI crossover signals (+DI 14 vs -DI 14) work in trends but fail in ranges, where repeated crossings occur inside a tight band and cannot cover spread and slippage. Wilder’s ADXR filter reduces this, but a single threshold misses key context such as ADX slope, DI separation, dominance duration, and volatility state.

A two-layer setup addresses this. Layer 1 replaces fixed ADXRβ‰₯25 with an Optuna-optimized gate over ADXR threshold, DI lookback, and minimum DI separation, maximizing precision on a validation split. Layer 2 adds a Random Forest meta-label that scores each gated signal using 11 ADX-derived features, then sizes positions by confidence.

Tested on 7 years of EURUSD H1 (MT5), the approach targets higher precision by suppressing low-quality crossover trades rather than adding new entries.

πŸ‘‰ Read | AlgoBook | @mql5dev
❀34πŸ‘7✍4πŸ‘Œ2
Market nonstationarity creates volatility and liquidity regimes where fixed-parameter systems break. A static SMA crossover with fixed periods and a point threshold tends to overtrade in high volatility and miss signals in low volatility, forcing reactive manual re-optimization.

A practical adaptive approach is to re-fit the decision boundary on each new bar using MQL5 solvers.mqh. CNlEq (Levenberg–Marquardt) can update a volatility-scaled threshold using ATR and a rolling window least-squares objective with light regularization.

Implementation centers on an EA class with NewBar detection, Optimize() using the reverse-communication loop (m_needf, m_needfij), numerical residual/Jacobian evaluation, and CTrade execution with ATR-based SL/TP constrained by SYMBOL_TRADE_STOPS_LEVEL.

Typical convergence is a few iterations per bar with sub-millisecond ...

πŸ‘‰ Read | Freelance | @mql5dev
❀39πŸ‘10πŸ‘Œ3πŸ†1
Bollinger Bands and Donchian Channels describe past price behavior but don’t provide model-based coverage. A fixed β€œ2σ” Bollinger width is a convention, and Donchian width is driven by realized extremes.

The article replaces heuristics with a rolling OLS regression channel and computes confidence intervals (mean uncertainty) and prediction intervals (future observation range) using Student’s t with nβˆ’2 degrees of freedom. It also distinguishes an in-window edge band from a true one-step-ahead forecast at x=n.

Key implementation notes for MT5: interval widening at window edges comes from OLS leverage, not data scarcity; t-values matter for typical window sizes; and MT5 DRAW_FILLING limitations make five line plots (fit + 4 bounds) the most reliable rendering.

πŸ‘‰ Read | Signals | @mql5dev
❀31πŸ‘7✍2πŸ‘Œ2
The article completes a Gaussian Process library for MQL5 by formalizing three core extension points: IKernel (covariance + analytic hyperparameter derivatives), ILikelihood (noise/class model with gradients and Hessians), and IInference (pluggable posterior inference returning NLML, gradients, and cached matrices for prediction).

It implements RBF, Linear, and Periodic kernels plus Sum/Product composites that correctly route or combine derivatives (including product rule for gradients). Likelihoods cover Gaussian regression and logit binary classification, with numerically stable sigmoid/softplus and higher-order derivatives where needed.

Inference is split into ExactInference for Gaussian likelihood (fast NLML + analytic gradients via Cholesky-based cho_solve) and LaplaceInference for non-Gaussian cases (Newton updates, GPML-style gradient computation, optimize...

πŸ‘‰ Read | VPS | @mql5dev
❀45πŸ‘8✍2πŸ‘Œ2
RealCost Spread P95 Logger for MT5 is an open source utility for monitoring spread behavior on the active chart symbol. It samples the live spread and shows a compact panel with current and average spread, p50/p90/p95/p99, maximum spread, sample count, alert state, and the share of samples above a configured threshold. Optional logging writes local CSV output for later review.

p95 is useful because average spread can mask short spikes around rollover, news windows, session transitions, or low-liquidity periods. p95 approximates the spread level covering most observations while reducing the impact of a single worst outlier. p99 and max provide additional tail context.

The EA is read-only by design: no trading, no order changes, no position management, no external data transmission, and no signals. Configuration includes sampling cadence, in-memory sample cap, ...

πŸ‘‰ Read | VPS | @mql5dev
❀29πŸ‘7πŸ‘Œ3πŸ†2
Spread Meter by Fox Wave is a single-symbol spread dashboard for the active chart. It shows the current live spread in real time and retains the historical extremes with exact timestamps.

The panel maintains separate MAX (widest) and MIN (tightest) spread records. Values change only when a new extreme is set, preserving a stable reference for best and worst spread conditions. A visual flash highlights record updates at the moment they occur.

Configuration includes panel position, color scheme, and refresh rate. The design uses a modern dark panel and is intended to be lightweight enough to run across multiple charts with minimal CPU load.

This setup helps identify spread spikes during news events and thin-liquidity sessions, and provides an at-a-glance view of pricing consistency for the monitored symbol.

πŸ‘‰ Read | AlgoBook | @mql5dev
❀17πŸ‘13πŸ‘Œ2πŸ‘1πŸŽ‰1
Swap Meter provides a live monitor of BUY and SELL swap rates for the active chart symbol, presented in a compact color-coded panel with continuous refresh.

Positive values render in green, negative in red, and zero in neutral gray to make overnight financing impact visible at a glance. A change-detection layer triggers alerts as soon as the broker updates either swap rate.

Notifications can be enabled independently via popup, terminal log, or mobile push, with an adjustable threshold to reduce rounding noise. Each detected update can also trigger a brief visual highlight.

The panel supports configurable colors, placement, and refresh interval, with low CPU overhead and a dark UI aligned with FoxWave Spread Meter. Suitable for carry and swing workflows where swap changes affect holding costs.

πŸ‘‰ Read | CodeBase | @mql5dev
❀24πŸ‘10πŸ‘Œ2
FoxWave Daily Range Tracker provides a real-time view of today’s price range versus the symbol’s Average Daily Range (ADR), helping assess whether current movement is still within normal bounds or nearing exhaustion.

The panel shows today’s high and low for the active chart symbol and calculates the current range in pips with correct handling for 3/5-digit pricing and JPY pairs. ADR is computed over a configurable lookback (default 14 days) using only fully closed daily candles.

A β€œRange Used %” indicator adds a color-coded progress bar: green below 60%, yellow 60–90%, red above 90%. The tool runs as a single-symbol panel with customizable colors, position, and refresh rate, designed for low CPU use across multiple charts.

πŸ‘‰ Read | VPS | @mql5dev
❀25πŸ‘7⚑2πŸ‘Œ2πŸ‘¨β€πŸ’»2
As an MQL5 neural-network library grows to include more classes and OpenCL kernels, understanding object relationships and inheritance becomes harder than following individual code paths. The article shows how to regain architectural visibility by generating structured API docs directly from annotated source.

Doxygen is presented as a practical fit for MQL5 due to its C++-like syntax and support for hyperlinks and MathJax formulas. Key techniques include marking doc comments, building navigable groups/subgroups, creating cross-references, documenting kernel indices and parameters, and describing classes, methods, and interfaces with clear input/output and return semantics.

It also covers wiring Doxygen to parse .mqh and .cl files, mapping extensions, enabling MathJax, and producing a main page plus hierarchy and file viewsβ€”useful for team coordination, m...

πŸ‘‰ Read | Forum | @mql5dev
❀38πŸ‘13πŸ‘¨β€πŸ’»4⚑3πŸ‘Œ3
Confirmed Swing Points Helper is an educational indicator for MetaTrader 5 that plots confirmed swing highs and swing lows on-chart, with optional HH, HL, LH, and LL labeling.

A pivot is accepted only after the current bar’s high/low is validated against a configurable number of bars on both the left and right side. This produces confirmed, non-predictive signals and introduces an expected delay due to the right-side requirement.

The implementation tracks the most recent accepted high and low pivots. Each new high is compared to the prior high and classified as HH or LH. Each new low is compared to the prior low and classified as HL or LL.

Key inputs include depth per side, optional minimum distance between same-type pivots, label visibility, colors, font size, and an object-name prefix. This is not a trading system and provides no buy/sell output.

πŸ‘‰ Read | Calendar | @mql5dev
❀48πŸ‘9✍2πŸ‘Œ2🀯1
Maximum drawdown is commonly used as a single risk figure, but it omits frequency, time spent below prior peaks, and recovery speed. Equity curves with identical maximum drawdown can still produce very different holding risk.

DrawdownDNA processes a daily equity series and analyzes the full drawdown structure. It rebuilds equity and underwater curves, segments the underwater curve into distinct drawdown episodes, and aggregates multiple risk metrics into a resilience grade.

Each run prints to the Experts tab: a text underwater curve; an episode table with depth, drawdown duration, recovery time, and underwater length; max and average drawdown, episode count, longest underwater period, and total time underwater; Ulcer Index, Pain Index, and Recovery Factor; plus a composite score (depth, recovery, stability) graded from A+ to F with recommendations.

Inp...

πŸ‘‰ Read | NeuroBook | @mql5dev
❀44πŸ‘13πŸ‘Œ4πŸ‘€3