MQL5 Algo Trading
574K subscribers
4.45K photos
7 videos
4.46K 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
Most trend-following indicators trade responsiveness for smoothness, typically via a fixed moving-average length. A scalar Kalman Filter makes the trade-off explicit by tracking uncertainty and computing the Kalman gain from two user-set variances: process noise Q and measurement noise R. The gain converges to a steady-state level driven by Q/R.

Applied to price, the local-level model treats each close as a noisy observation of an underlying true price. Each bar runs a predict step (state carried forward, variance grows by Q) and an update step (state corrected using gain and R). Correct recursion and initialization matter; wrong startup often looks plausible but is incorrect.

A practical signal uses two independent filters with different Q values and shared R. Example: Q=1.000,R=0.200 yields gain ~0.854; Q=0.005,R=0.200 yields ~0.146. In MT5/MQL5, ...

๐Ÿ‘‰ Read | Signals | @mql5dev
โค17๐Ÿ‘10๐Ÿ”ฅ9๐Ÿคฉ5๐Ÿ‘Œ1
Gaussian Process forecasting is sensitive to feature design. A rolling-window bar index input keeps the kernel geometry nearly constant, producing near-constant predictive variance and turning the horizon step into extrapolation rather than a market forecast.

The described MQL5 engine uses previous-bar log return as x and horizon-ahead log return as y, with input/target standardization to keep length-scale and likelihood scoring stable across regimes.

Implementation details include a symmetric kernel matrix, adaptive-jitter Cholesky, and explicit separation of latent variance from observed variance by adding noise only for realized forecasts. Hyperparameters are searched in log-space with a pure log marginal likelihood routine that avoids mutating fitted state mid-search.

Validation is framed as a calibration check: log forecasts and verify 1-sigma and 2-sig...

๐Ÿ‘‰ Read | Quotes | @mql5dev
โค16๐Ÿ‘9๐Ÿ”ฅ6๐Ÿคฉ6๐Ÿ‘Œ2
STE-FlowNet reframes sequence modeling as adaptive perception: each new event updates internal representations instead of averaging history like typical LSTM/GRU, improving responsiveness to regime shifts, volatility bursts, and rare patterns.

The pipeline treats data as event streams. Events are split into equal-count chunks and reweighted by temporal concentration using a Gaussian fit, so dense bursts get amplified rather than diluted by aggregation. This preserves short-lived, high-impact microstructure signals.

Architecturally, it uses an encoderโ€“decoder with skips, residual blocks, multi-scale intermediate outputs, and ConvGRU at multiple resolutions to retain local detail while building global context. A correlation step aligns features to prior estimates, then iterative residual refinement updates predictions with shared weights for stability.

Trai...

๐Ÿ‘‰ Read | CodeBase | @mql5dev
โค12๐Ÿ‘11๐Ÿ”ฅ4๐Ÿคฉ3๐Ÿ‘Œ2
Comparing two forecasters with equity curves is unreliable when losses are heteroskedastic and serially correlated. A formal alternative is the Dieboldโ€“Mariano test on the loss-differential series, with HAC long-run variance and the Harveyโ€“Leybourneโ€“Newbold small-sample adjustment.

An MQL5 implementation runs natively with Neweyโ€“West variance correction and an internal Student-t CDF/quantile to avoid library dependencies. Verdicts include significant A/B outperformance, no significant difference, and explicit rejects for insufficient sample, invalid horizon, or invalid variance.

The EA and a subwindow indicator compute rolling DM statistics live. Two fixed forecasters run side by side (ONNX vs EMA slope), validated feature vectors prevent NaN/Inf contamination, and a manifest controls horizon, window, alpha, and loss type without recompilation.

๐Ÿ‘‰ Read | Quotes | @mql5dev
โค7๐Ÿ‘7๐Ÿ”ฅ4๐Ÿคฉ3๐Ÿ‘Œ2
This article builds a Hyperdimensional Computing library for MetaTrader 5 that replaces heavy retraining with fast online learning. Models are binary hypervectors; learning becomes integer accumulation, enabling per-bar updates in ~337 ยตs while reproducing full refits bit-for-bit when corrections are disabled.

Core algebra is minimal and testable: bind via XOR (distance-preserving), bundle via per-bit majority with a deterministic tie-breaker, and permute via bit-rotation to encode order. Dimension controls collision risk and provides a closed-form noise floor, so similarity thresholds are derived analytically rather than via expensive resampling.

Feature values are encoded with an exact โ€œlevel ladderโ€ where distances between quantized levels are guaranteed by construction. Bars are encoded by binding feature roles to quantized levels then bundling; seq...

๐Ÿ‘‰ Read | AppStore | @mql5dev
โค10๐Ÿ‘8๐Ÿ”ฅ2๐Ÿคฉ2๐Ÿ‘Œ2
Benchmark wins can be misleading when an optimizerโ€™s step geometry accidentally matches a test functionโ€™s geometry. The article shows three failure modes: SDO scoring high because its pairwise coordinate coupling matches duplicated 2D benchmarks; DOAm showing sharp Forest/Hilly asymmetry; and HHO exploiting a โ€œdiagonal effectโ€ caused by using one scalar factor to scale all coordinates, producing correlated straight-line trajectories.

To make benchmarks fair, extrema should avoid privileged structures: not on domain boundaries (benefits clipping/overshoot), not at the center (benefits averaging/center drift), and not near main diagonals. A practical diagonal test is |x_norm โˆ’ y_norm| > 0.3 for the global maximum.

The piece provides actionable tooling: an MQL5 verifier (VerifyExtremes.mq5) to validate extrema positions and a workflow for adjusting fu...

๐Ÿ‘‰ Read | NeuroBook | @mql5dev
โค11๐Ÿ‘5๐Ÿ”ฅ3๐Ÿคฉ2๐Ÿ‘Œ2
A request surfaced around โ€œAlign Meanโ€ and identifying an optimum setup that improves overall profit visibility across all charts.

This typically means standardizing how mean/average reference lines are calculated and displayed so results can be compared between symbols and timeframes without changing parameters per chart.

Key points to validate include: consistent lookback windows, identical price sources (close vs typical), timeframe normalization, and whether the mean is fixed, rolling, or session-based. Any โ€œoptimumโ€ setting should be tested with identical inputs across charts, using the same risk model and transaction cost assumptions.

๐Ÿ‘‰ Read | CodeBase | @mql5dev
โค14๐Ÿ‘12๐Ÿคฉ2๐Ÿ‘Œ2
Quant Ultimate Momentum Pro v5.4 is a momentum indicator aimed at reducing moving-average lag by projecting short-term momentum from price-derived velocity (MACD) and acceleration (OSMA). The model applies statistical filtering to manage noisy conditions and focuses on closed-bar confirmation for reversal signaling.

Core functions include adaptive volatility control using OSMA standard-deviation bands to scale thresholds as conditions change, plus fractal dimension checks (FDI) to suppress random-walk behavior and low-quality momentum swings.

Visual output is rendered directly on the main chart via candle coloring to highlight trend state and transitions. An alert layer supports push and audio notifications on confirmed reversals.

Typical deployment targets M5, M15, and H1 across indices, FX, and crypto, with EMA defaults aligned to 12/26/9 and adju...

๐Ÿ‘‰ Read | Freelance | @mql5dev
โค19๐Ÿ‘10๐Ÿคฉ5๐Ÿ”ฅ4๐Ÿ‘€2๐Ÿ‘Œ1
Gemini AI has released Quant 2nd Model, targeting quantitative workflows that combine data preparation, model building, and evaluation. The update focuses on improved handling of time-series inputs, more consistent numerical reasoning, and better instruction adherence during multi-step tasks.

The model is positioned for analysis pipelines that require structured outputs suitable for downstream code generation and integration. Reported changes also include stronger context retention across longer prompts and fewer formatting deviations in generated results.

For engineering teams, the practical impact is expected in faster prototyping, reduced post-processing of responses, and more predictable behavior when automating research and reporting tasks.

๐Ÿ‘‰ Read | CodeBase | @mql5dev
โค23๐Ÿ‘11๐Ÿคฉ6๐Ÿ”ฅ5๐Ÿ‘จโ€๐Ÿ’ป3๐Ÿ†2โœ1
MetaTrader 4 can run indicators written in MQL4, while MQL5 indicators target MetaTrader 5 and use a different event model, data access layer, and trade API. There is no drop-in compatibility between MT4 and MT5 indicator binaries, and most non-trivial source code requires refactoring.

Porting typically involves replacing indicator buffers and OnCalculate logic differences, adapting time series access (CopyBuffer/CopyRates patterns versus direct indexing assumptions), handling symbol/period specifics, and reworking any order or position-related code. Build processes, libraries, and strict compilation settings also differ, so identical behavior requires validation on historical and live ticks.

๐Ÿ‘‰ Read | VPS | @mql5dev
โค14๐Ÿ‘11๐Ÿ”ฅ6๐Ÿคฉ6๐Ÿ‘Œ2
Point & Figure configuration supports fixed box size (points) or ATR-based sizing to adapt per symbol and timeframe. Reversal count is configurable (default 3 boxes). Price source can be Close or High/Low, with pattern names rendered directly on the chart.

Built-in pattern detection covers double/triple top breakouts, double/triple bottom breakdowns, bullish/bearish catapults, and triangles. Breakout BUY/SELL signals can be filtered by higher low / lower high rules, EMA trend, ADX minimum, trading session, and optional triggering only on direction change.

An on-chart info panel (Full/Compact/Minimal) reports signal, entry, SL, TP, risk/reward, lot sizing from risk %, spread, ATR, P&F structure, plus warnings for oversized SL, late entries, or wide spreads. R1/R2/S1/S2 support/resistance lines are derived from P&F columns. Alerts include popup, sound,...

๐Ÿ‘‰ Read | Freelance | @mql5dev
โค24๐Ÿ‘7๐Ÿ”ฅ5๐Ÿคฉ4๐Ÿ‘2๐Ÿ‘Œ2
A breakout indicator built on confirmed swing highs and swing lows. Nearby highs are grouped into resistance zones and nearby lows into support zones, with a minimum touch count required before a zone is treated as valid.

Signals trigger only on candle close. A bullish close above qualified resistance prints a blue zone rectangle and bullish arrow. A bearish close below qualified support prints a red zone rectangle and bearish arrow. Rectangles use transparent gradient fills to keep candles readable.

Directional confirmation is selectable: session VWAP (default), SMA (period configurable, default 20), SMMA, or None. A separate panel shows only the latest accepted breakout direction, not trade status.

Primary testing focus is XAUUSD on M5, with M15/M30 as cleaner but less frequent alternatives. Suggested execution is next-candle entry after confirmat...

๐Ÿ‘‰ Read | Freelance | @mql5dev
๐Ÿ‘19โค18๐Ÿ”ฅ10๐Ÿคฉ10๐Ÿ˜4๐Ÿ‘Œ4
GER40 Evening Coil is a free, open-source EA for the German 40 index on H1. It is long-only, takes one position at a time, requires four entry conditions, places a stop loss on every trade, and forces a flat book by 23:00 server time. Entries are limited to the evening session after the Frankfurt cash close.

Backtest (GER40 H1, 2022-01-01 to 2026-10-13) used a $10k start and fixed lot 5 with no compounding. Net profit: +$37,647 (+376.5%). Max equity drawdown: 10.5%. Profit factor: 2.07. Win rate: 62.6% (291/465), about 97 trades/year. Avg win/loss: $250.81 / $203.10. Longest losing streak: 5.

Signal logic: no volatility spike (10-bar vs 100-bar returns), tick volume not below its 50-bar average, a low-volume regime over 252 bars, and a recent NR7 within the last 13 bars. Execution buys next bar open, SL 3.5 ATR, TP 4.5 ATR, with time-based exits.

Robustness w...

๐Ÿ‘‰ Read | AppStore | @mql5dev
โค18๐Ÿ”ฅ12๐Ÿ‘11๐Ÿคฉ8๐Ÿ‘Œ1
USDX Trader v1.33 is a maintenance update focused on bug fixes for an MT5 EA that builds a synthetic US Dollar Index from major USD pairs already present in Market Watch.

The EA publishes the index as a custom chart symbol, so standard timeframes, indicators, and drawing tools can be used. Trading is executed as a weighted basket across the underlying pairs, with virtual take-profit and stop-loss evaluated on the index level rather than per-leg prices.

It supports multiple presets (ICE-style 6-leg USDX, broad-dollar baskets, equal-weight majors, and custom 1โ€“12 legs), automatic symbol-name detection, and a plan table showing leg sizing and rounding. Recent bars can be rebuilt from real ticks for more accurate highs/lows. Strategy Tester is supported via a virtual index with an optional EMA-crossover auto mode intended for demonstration, not optimisation.

Key c...

๐Ÿ‘‰ Read | NeuroBook | @mql5dev
๐Ÿ‘18๐Ÿคฉ13โค12๐Ÿ”ฅ11๐Ÿคฏ2๐Ÿ†2๐Ÿ‘Œ1
Modern market feeds increasingly behave like event streams where tick timing, impulse size, and inter-event gaps carry signal that OHLC bars often discard.

An event-driven pipeline aligned with STE-FlowNet is being adapted from optical event-flow to financial microstructure, targeting real-time direction inference from unfolding activity rather than post-close features.

Implementation work is moving from theory to modules: a GPU/OpenCL state stack that shifts in-kernel to support effectively infinite sequences, with gradients routed only to the current top element via de-concatenation.

Next is a correlation module: dot-product similarity between the current unit-sequence descriptor and all stacked states, preserving comparable correlations without a fixed reference frame.

๐Ÿ‘‰ Read | CodeBase | @mql5dev
โค7๐Ÿ‘6๐Ÿคฉ6๐Ÿ”ฅ4๐Ÿ‘Œ2
Traders periodically need an objective volatility estimate that is less sensitive to outliers than standard range-based measures.

One method applies a Winsorisation-like workflow to the price series. Price samples are sorted, then the successive rate-of-change between adjacent sorted values is computed and aggregated. Larger outputs indicate a wider dispersion of values, which typically aligns with higher volatility regimes.

A key limitation is direction blindness: sorting removes the path information, so trend and mean-reversion can produce similar readings. A practical adjustment is to include a time component in the value representation so that temporal ordering influences the computed differences.

๐Ÿ‘‰ Read | Signals | @mql5dev
โค7๐Ÿ‘6๐Ÿ”ฅ4๐Ÿคฉ4๐Ÿ‘Œ2
Breaking news can invalidate technical signals mid-trade, so this approach adds real-time news sentiment as a dynamic filter inside an MT5 Expert Advisor.

A REST API provides bullish/bearish/neutral labels plus a confidence score. The EA uses this to confirm entries (skip buys during strong bearish sentiment) and to trigger early exits when sentiment reverses against an open position, while ignoring low-confidence or neutral readings to avoid noise.

Implementation is straightforward in MQL5: WebRequest on an OnTimer schedule, JSON parsing into a small sentiment structure with short history, and helper functions for โ€œmeaningfulโ€ sentiment and reversal checks.

Key caveats: WebRequest wonโ€™t run in Strategy Tester, so record/play back sentiment for testing; tune confidence thresholds and update frequency; verify Yahoo Finance instrument symbols; protect API k...

๐Ÿ‘‰ Read | Forum | @mql5dev
โค13๐Ÿคฉ8๐Ÿ”ฅ7๐Ÿ‘4๐Ÿ‘Œ2
A terminal script scans all instruments currently visible in Market Watch and applies two filters to identify trend candidates on H1.

First, a linear regression is calculated over a configurable window (50 bars by default). Trend smoothness is validated via the Rยฒ coefficient; symbols with Rยฒ below 0.70 are rejected as excessively noisy.

Second, ADX values are checked to confirm trend strength. Symbols with ADX below 25.0 are excluded.

For instruments passing both filters, the output includes direction (UP/DOWN), regression fit precision, and the ADX reading. Results are printed to the Experts tab.

Usage is straightforward: attach the script to any H1 chart to trigger an immediate scan and report.

๐Ÿ‘‰ Read | Signals | @mql5dev
๐Ÿ‘7โค5๐Ÿคฉ5๐Ÿ”ฅ2๐Ÿ†2๐Ÿ‘Œ1
Part 9 adds a Trade Activity Auditor for MetaTrader 5 that captures account-level trade changes, not just actions taken by one cooperating EA. It uses OnTradeTransaction() to log distinct stagesโ€”requests, order updates, deals, position changes, and history transitionsโ€”without collapsing them into a single โ€œtradeโ€ record, preserving evidence when callbacks arrive out of order or within the same second.

When the terminal was offline, it recovers missing context by scanning a configurable history window and appending ORDERS/DEALS not already journaled, marking rows as LIVE vs RECOVERED. The design separates responsibilities into modules: typed records, CSV journal with strict validation and export, transaction/history translation, and a chart panel for period summaries.

Practical benefits: reproducible trails for debugging multi-EA accounts, clearer attribution o...

๐Ÿ‘‰ Read | Signals | @mql5dev
โค15๐Ÿ‘10๐Ÿ”ฅ7๐Ÿคฉ5๐Ÿ†3๐Ÿ‘จโ€๐Ÿ’ป2๐Ÿ‘€1
STE-FlowNet treats price action as an event stream rather than aggregated candles, preserving where/when order imbalance appears. This reduces response latency, avoids information loss from averaging, and captures spikes and underlying trend in one representation.

The article continues the implementation by adding an SEW-style residual block built for stability in spiking networks. The block is encapsulated as an OpenCL-backed class with a clean forward pass that chains submodules and merges the result with the original input for reliable gradient flow.

It then builds a full Flow Decoder as a separate component with two parallel paths (main features and flow), using transposed convolutions, skip connections, and encoder latent states (via ConvGRU) to reconstruct detailed spatiotemporal flow maps. Practical outcome: real-time micro-movement tracking that can feed ...

๐Ÿ‘‰ Read | NeuroBook | @mql5dev
๐Ÿ‘8โค7๐Ÿ”ฅ5๐Ÿคฉ3๐Ÿ‘Œ3
Renko forecasting moved from CatBoost classification to regression to predict the next barโ€™s log-return, not only direction. This yields a continuous score usable for signal filtering and a 95% interval from OOF residual variance.

The core issue is forecast bias. A two-step fix is used: a residual cascade trained on honest TimeSeriesSplit OOF errors, then conditional bias correction split by sign (bull vs bear) with an MAE degradation guard.

Daily EURUSD (2024โ€“2025) uses adaptive brick_size via 0.5ร—ATR(14) (~0.004). Features describe the last 10 Renko bars (25 fields). The cascade accepted one residual stage; OOF-MAE improved 0.001306โ†’0.001262, Rยฒ to 0.718, while direction accuracy stayed ~64โ€“65%.

A MetaTrader 5 script turns forecasts into orders with spread filtering, 2-brick SL, 3-brick TP, and 0.5% balance risk sizing, with explicit dry-run and trade...

๐Ÿ‘‰ Read | Forum | @mql5dev
โค20๐Ÿ‘8๐Ÿคฉ7๐Ÿ”ฅ5๐Ÿ‘จโ€๐Ÿ’ป2๐Ÿ‘Œ1