MQL5 Algo Trading
507K subscribers
3.36K photos
3 videos
3.36K 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
DoEasy library tick support moved from single tick objects to per-symbol tick series lists, with default retention set to the current day and an option to store multiple days. Lists are intended for faster search, comparison, and repeated access than ad-hoc CopyTicks calls.

Core updates include new library messages, a retention-days constant, and a fix in the timeseries code path to delete bar objects when insertion fails to prevent leaks. Select.mqh gained tick-oriented search/sort helpers and overloads to fetch ticks by index, time, or millisecond timestamp.

A new tick series class builds an array-backed list of tick objects, loads history via CopyTicksRange() from the computed day boundary, and supports queries such as highest Ask and lowest Bid. Next step is a multi-symbol tick collection with real-time list updates.

πŸ‘‰ Read | Docs | @mql5dev

#MQL5 #MT5 #AlgoTrading
❀39πŸ‘4πŸŽ‰2πŸ‘Œ2
An updated Moving Average Bands variant has been published with clearer, signal-oriented behavior. The extension adds a practical ruleset that derives trade signals directly from band values, making the use case more explicit than the earlier release.

The recommended workflow uses band color changes as an actionable state indicator. These transitions can be mapped to initial entries, re-entries after pullbacks, and early exit candidates when conditions reverse.

This approach keeps the logic on-chart and reduces reliance on external filters, while remaining transparent enough to audit and adjust for different instruments and timeframes.

πŸ‘‰ Read | Freelance | @mql5dev

#MQL5 #MT5 #Indicator
❀65πŸ‘13πŸ‘Œ5🀝2
Raw forex and futures prices are non-stationary, so standard regression/classification models trained on levels tend to produce spurious relationships and look-ahead issues. Integer differencing forces stationarity but removes much of the dependence structure that ML features often rely on.

Fixed-width fractional differencing (FFD) uses a non-integer order d in (0, 1) to reach stationarity while retaining as much memory as possible. Weights follow the recurrence w[0]=1, w[k]= -w[k-1]*(d-k+1)/k and stop once |w[k]| falls below a threshold, then apply a reversed dot product over a log-price lookback window.

A production-focused MQL5 implementation is provided: a header-only CFFDEngine with Init(), Compute(), and ComputeBuffer() with prev_calculated optimization, plus an indicator wrapper supporting all applied price types. No dynamic allocation occurs after ...

πŸ‘‰ Read | Signals | @mql5dev

#MQL5 #MT5 #Indicator
❀34πŸ‘6πŸ‘Œ6πŸŽ‰1
Seasonality is measurable recurring price behavior driven by calendar effects and market structure. It is most visible in commodities, but it also appears in FX and equity indices. A practical implementation in MetaTrader 5 uses MQL5 to score seasonality quality for a single symbol or a two-instrument spread.

Spread trading combines long/short exposure on related instruments to target relative price moves. The SpreadMultiYearComparison indicator computes a spread as the difference of the two opens, with optional weighting coefficients to align tick values and quote scales.

Methodology relies on 10–15+ years of D1 history, analyzing one selected month across years. A pattern is treated as actionable when direction repeats in ~70–75% of years and results are not dominated by outliers. The tool outputs year-by-year month returns, an average curve, and a...

πŸ‘‰ Read | VPS | @mql5dev

#MQL5 #MT5 #Indicator
❀30πŸ‘Œ4✍2πŸ‘2
Part 2 extends the defensive foundation with long-memory measurement on NQ M1 using a robust Hurst workflow.

Three estimators are implemented and blended: classical R/S (Hurst 1951, with Lo 1991 bias considerations), aggregated variance, and absolute moments. Each produces H plus a confidence weight based on valid log-log regression points; low-confidence outputs are excluded.

Four functions are added to MicroStructure_Foundation.mqh: HurstExponentRS(), AdvancedHurstExponent(), HurstExponentRobust(), and PopulateHurstAnalysis(). Results write into RobustFractalAnalysis without new includes. HurstProfile.mq5 plots H*(t), confidence, and a regime buffer.

An empirical run over 133 NQ Globex sessions (Nov 2025–May 2026) shows H*(t) near 0.47–0.50, requires ~40 post-open bars to activate, and breaks if pre-open/post-open data are mixed. Predictive power ...

πŸ‘‰ Read | VPS | @mql5dev

#MQL5 #MT5 #Indicator
❀24πŸ‘10πŸ‘Œ2
Live trading controls often split across symbol filters, session rules, news blackouts, and daily limits. When manual orders and multiple EAs share a terminal, inconsistent enforcement becomes likely.

A unified discipline framework centralizes validation in CDisciplineEngine.mqh. It acts as a single gate for IsTradeAllowed(), synchronizes rule state, and exposes monitoring data shared by both EA and dashboard.

Architecture is layered: external configuration files, the engine, a chart dashboard, and EA integration. The engine checks whitelist, trading hours, news state, and daily trade counts, then records executed trades for accurate limits.

The dashboard visualizes engine state only. The enforcement EA uses timers to keep positions compliant and avoids duplicating rule logic.

πŸ‘‰ Read | AlgoBook | @mql5dev

#MQL5 #MT5 #AlgoTrading
❀41πŸ‘8πŸ‘Œ3😁2πŸŽ‰2
A custom MACD indicator adds a full three-part view in a separate window: a color-coded histogram plus the MACD and Signal lines. This differs from common default layouts that emphasize the histogram only, improving visibility of momentum shifts and line crossovers.

Histogram coloring reflects the zero level: Green when MACD is above 0 and Salmon when below 0. This makes bias changes and zero-line transitions easier to spot at a glance.

Key components include the MACD line (Fast EMA minus Slow EMA), the Signal line (moving average of MACD), and the histogram. Inputs cover Fast/Slow periods (12/26), Signal period (9), selectable Signal MA method (SMA, EMA, SMMA, LWMA), and applied price (default Median).

Typical use cases: zero-line changes for momentum regime shifts, MACD/Signal crossovers for entries/exits, and classical divergence detection. Suitable ...

πŸ‘‰ Read | Freelance | @mql5dev

#MQL5 #MT5 #Indicator
❀25πŸ‘6✍5πŸ‘Œ2
A signal-generation library is available for detecting when market price reaches predefined channel boundaries, rather than triggering on subjective β€œnearby” conditions.

The engine tracks two quantified phases: percentage proximity to a channel line, followed by a percentage reversal from the extreme boundary. A state machine enforces these rules consistently to reduce discretionary interpretation.

Signals do not forecast direction. They flag a boundary-touch event that often marks a decision point, where price either respects the level (validating it as support/resistance) or breaks through with momentum.

The approach is channel-agnostic and can be applied to any channel definition. A common implementation uses the Donchian channel.

πŸ‘‰ Read | VPS | @mql5dev

#MQL5 #MT5 #AlgoTrading
❀18πŸ”₯7πŸ‘3πŸ‘Œ3
When strategy optimization exceeds 10+ parameters, tester reports become high-noise datasets. Tables, flat charts, and 2D heatmaps stop scaling, and correlations across period, stop-loss, volatility, and drawdown become hard to validate.

MetaTrader 5 uses DirectX 11 in MQL5 via CDXCanvas and CChartObjectDX. Shaders and textures load from Files\DX\ without external libraries, C++ wrappers, or dependency management. The goal is analytical reduction of cognitive load, not decoration.

3D is justified when a metric depends on two or more continuous variables and geometry matters. Typical cases include optimization landscapes (plateaus vs narrow maxima), regime clustering as a rotatable point cloud, and stress tests mapping parameter vs stress level vs robustness metric.

Core implementation points include canvas initialization, projection setup, vertex...

πŸ‘‰ Read | CodeBase | @mql5dev

#MQL5 #MT5 #AlgoTrading
❀22πŸ‘8πŸ‘€3
Part 3 ported Python get_time_features into MQL5 as CTimeFeatures.mqh, producing a flat double array with Python-identical feature order and names for direct OnnxRun input.

Key MQL5 issues addressed: broker time vs UTC, incremental rolling volatility, and a timeframe-driven frequency gate that must match the feature-name registry. UTC is derived once at init via TimeCurrent()-TimeGMT(); this fixes systematic session misclassification but cannot track mid-run DST shifts.

Architecture: CTimeFeatures exposes Initialize/Update/Calculate, backed by CRingBuffer for population std (ddof=0) and forward-filled session/calendar vol. Session detection handles cross-midnight Sydney via OR logic. Day-of-week and day-of-year are re-indexed to match pandas conventions.

Frequency gating uses PeriodSeconds to support custom periods; calendar flags appear only for D...

πŸ‘‰ Read | Quotes | @mql5dev

#MQL5 #MT5 #AITrading
❀20πŸ‘5πŸ‘Œ2
Part 11 replaces a single-file, chart-object news panel with a canvas-rendered dashboard split into four modules: core data/state, logic (loading/filtering/row planning and trade candidate scans), render (draw-only), and interaction (mouse/scroll/resize). This separation makes new features safer to add and keeps redraws fast: one bitmap pass for the entire UI.

The layout becomes runtime-resizable with bounded width/height, and table columns are recomputed every render, shrinking the Event column only when space is tight. Scrolling switches from row-based to pixel-based, enabling smooth thumb dragging, partial-row movement, and cleaner hit-testing from a single scroll-state struct.

Event display improves with metadata-driven formatting: values show correct units, multipliers (K/M/B/T), and precision, and unpublished fields render as dashes. Remaining-ti...

πŸ‘‰ Read | CodeBase | @mql5dev

#MQL5 #MT5 #AlgoTrading
❀22πŸ‘6πŸ‘Œ1
A practical remote voice-command bridge for MetaTrader 5 is built by combining Telegram voice notes with a pull-based HTTP polling EA. A Python middleware (Telegram bot + local HTTP server) transcribes voice audio, parses a small command grammar into JSON, and queues requests; the EA polls every 2 seconds, executes via CTrade, then POSTs a JSON result that the bot relays back to Telegram.

The architecture stays low-bandwidth and tolerant of mobile connectivity: small GET polls (<1 KB) plus a short voice download, with typical end-to-end latency under a few seconds. Key engineering details include local-only HTTP on 127.0.0.1, simple in-memory synchronization, and stripping the MQL5 null terminator before POST to avoid Python JSON parse errors.

The approach is modular: Google STT can be swapped for offline speech later, while the EA remains a minimal WebRequ...

πŸ‘‰ Read | AppStore | @mql5dev

#MQL5 #MT5 #EA
❀23πŸ‘5πŸ‘Œ2
MQL5 trailing stops still default to linear, sequential updates in CExpertTrailing. This design adds O(n) work per update and becomes fragile during non-contiguous quotes, where gaps force execution at the next available price and increase slippage.

A skip list-based trailing model replaces sequential search with probabilistic, layered traversal targeting O(log n). Different modes can range from baseline linear search to fixed-skip, probabilistic promotion via random level selection, and an extreme hybrid that jumps directly to the highest tier for high-volatility regimes.

Noise handling is added with a Hopfield network used as an associative stability filter. Its energy function acts as a veto: when energy indicates instability, trailing updates are paused; when stable, the skip list computes the next stop. Integration is designed to fit the MQL5 ...

πŸ‘‰ Read | Freelance | @mql5dev

#MQL5 #MT5 #AlgoTrading
❀27πŸ‘8πŸ‘Œ1πŸ‘€1
Article code becomes easier to maintain when moved from a ZIP attachment into an MQL5 Algo Forge repository. MetaEditor handles the core Git workflow, while README.md defines what the project is, what files it includes, and how to run it.

The guide walks through creating a project under Shared Projects, choosing the correct template (or Empty for multiple independent build targets), naming it predictably, and importing all required assets: MQ5/MQH, presets, resources, and data files.

Before publishing, verify UTF-8 encoding, compile successfully (compile each executable separately when needed), then Git add/commit with meaningful messages and sync with pull/push.

Finally, switch the repository to public and, for article series, publish sequential versions as releases to preserve an accurate development history.

πŸ‘‰ Read | Quotes | @mql5dev

#MQL5 #MT5 #AlgoForge
❀22πŸ‘5πŸŽ‰2πŸ‘Œ1
This article upgrades a visual MT5 flag-pattern detector into a reliable signal source for automated trading. Chart objects are kept for human readability, but breakouts are published through indicator buffers so an EA can consume them deterministically via CopyBuffer().

The indicator outputs three buffers: buy, sell, and pole height. Buy/sell stay EMPTY_VALUE until a candle closes beyond the flag boundary; the pole-height buffer records the measured structure size on the same bar for proportional SL/TP sizing. Signals are written only once, using prev_calculated logic to avoid repainting and to keep backtests consistent.

The EA becomes a thin execution layer: load the indicator with iCustom(), read the latest closed bar on new-bar events, apply optional trend/volume filters, and place trades once per confirmed signal. A one-time startup scan capt...

πŸ‘‰ Read | Quotes | @mql5dev

#MQL5 #MT5 #AlgoTrading
❀27πŸ‘8⚑2πŸ‘Œ1
This article replaces a compile-time CSV and in-memory state with a single SQLite database shared by live charts and Strategy Tester agents via the terminal common folder. Live mode upserts calendar events from the MQL5 Calendar API into disk, while the tester loads the same events by time-window queries with no mode-specific code paths.

The schema uses an events table keyed by calendar value_id (so revisions overwrite cleanly) and a triggered table keyed by event_id to persist trade deduplication across restarts. Time-based indexing accelerates window queries; old rows are pruned to keep the store bounded.

Historical ranges can be downloaded on demand without recompiling, with a canvas progress bar showing population status. On startup, the EA restores triggered IDs from the last 24 hours to prevent duplicate orders after terminal reboots.

πŸ‘‰ Read | NeuroBook | @mql5dev

#MQL5 #MT5 #AlgoTrading
❀36πŸ‘8πŸ’―3
Markets behave less like Gaussian random walks and more like noisy fractal systems: heavy tails, volatility clustering, and scale invariance make linear risk metrics unreliable. Fractal tools model this β€œwild randomness” and explain why similar structures appear across timeframes.

The Hurst exponent quantifies long-memory (trend persistence vs mean reversion) and links directly to fractal dimension, giving a practical switch for trend-following or counter-trend logic. Multifractal methods (MF-DFA and variants) extend this by measuring how small and large moves scale differently; spectrum width can proxy complexity and tail risk.

Chaos and fractal market ideas frame prices as constrained by attractor-like regimes, with structure breaking during crises. For MT5 developers, these metrics can drive regime filters, adaptive stops/position sizing, and ML f...

πŸ‘‰ Read | VPS | @mql5dev

#MQL5 #MT5 #Strategy
❀20πŸ‘4πŸ‘Œ2πŸ”₯1
Part 3 extends the MT5 microstructure foundation with ARFIMA diagnostics by estimating the fractional differencing parameter d using the Geweke–Porter–Hudak log-periodogram regression. This complements the Hurst exponent: H signals persistence direction, while d quantifies how much differencing is actually needed to reach stationarity.

Two additions to MicroStructure_Foundation.mqhβ€”GPHEstimator() and PopulateARFIMAAnalysis()β€”compute d from validated M1 log returns, store arfima_d and arfima_confidence, and cross-check consistency via H = d + 0.5. Disagreements beyond 0.1 are flagged to isolate short-range autocorrelation or session-mixing effects.

On 72 US100 M1 NY sessions, pooled d is ~0 (βˆ’0.006) with near-zero regression fit, implying standard log returns are the right default. Session-level d varies widely, enabling regime tagging for trend, mean...

πŸ‘‰ Read | NeuroBook | @mql5dev
❀23πŸ‘9πŸ‘Œ3
MetaTrader 5 lacks a built-in way to automatically detect broadening β€œmegaphone” formations, so the article builds an MQL5 indicator that turns the pattern into a repeatable, testable workflow.

The design starts with swing-high/low extraction over a configurable lookback window, using a confirmation depth to filter noise. Detected swings are then refined to true extremes within each leg, improving anchor accuracy before any lines are drawn.

Validation rejects patterns where candles close across either expanding trend line before the structure completes, and applies a proportional range cap (example: max 150%) to avoid distorted setups. After the 4th swing, the indicator waits for a close beyond the boundary to confirm breakout.

Trade levels are derived from geometry: SL at the structure midpoint near breakout, TP projected by the pattern’s height, b...

πŸ‘‰ Read | Quotes | @mql5dev
❀26πŸ‘12πŸ‘Œ4⚑3πŸ”₯2
The article shows how to convert BOS/CHOCH market-structure concepts into reliable MQL5 code, focusing on precise swing-high/low detection, break validation, and filtering conditions that reduce false signals.

The β€œMarket Structure Sentinel” indicator runs event-driven: it processes only on new candles, checks closes beyond the active swing for BOS/CHOCH, then confirms new pivots using left/right bar comparisons. Trend state is derived from the latest valid swing pair, adapting to imperfect real markets instead of relying on a single swing type.

It also prioritizes clean chart UX: standardized enums/structures, reusable drawing utilities, midpoint time normalization for label placement, and a toggleable mini dashboard (double-click H/S). Initialization scans history via a single MqlRates array for faster synchronization and consistent startup context.

πŸ‘‰ Read | Forum | @mql5dev
❀44πŸ‘12πŸ‘Œ3
Arithmetic volume profiles and common moving averages rely on arithmetic means. In markets with heavy-tailed volume, a single spike can dominate the window and keep levels biased long after order flow has moved on. That creates stale support and resistance zones that no longer reflect active liquidity.

Institutional tooling often uses harmonic math to estimate mass, density, and flow. Applying the harmonic mean to tick execution density produces a gravity-center line tied to where trading frequency actually balanced, with reduced sensitivity to outliers.

Typical components include a harmonic central tendency line, reversion targets when price deviates too far, and symmetric deviation bands derived from harmonic variance to mark zones where liquidity thins. Implementations usually optimize reciprocal operations (1/x) with vectorized arrays to minim...

πŸ‘‰ Read | NeuroBook | @mql5dev
❀26πŸ‘5πŸ‘Œ4