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
Chart patterns are visually clear but hard to define in code due to ambiguous start bars, low tolerances, neckline placement, and validation timing. A practical gap is the inability to preserve the exact candle sequence behind a marked formation for later reload, measurement, and comparison.

A six-module MQL5 recorder addresses collection, not detection. The trader manually labels a double-bottom candidate via a chart rectangle. The system extracts candles by time bounds only, derives candle features, normalizes OHLC as percentage displacement from the first close, then persists each sample as CSV and reloads the library after restart.

Architecture splits responsibilities across PatternData, Extractor, Storage, Library, Panel, and a thin EA integration layer. Storage uses strict schema/version headers, UTF-8 quoted fields, non-overwriting writes, and validation...

πŸ‘‰ Read | Freelance | @mql5dev
❀19πŸ‘15πŸ”₯12🀩2πŸ‘Œ2
This article turns two built-in MT5 indicators into a single, rule-driven decision aid by giving Envelopes the missing market-state context from Alligator. It highlights a key pitfall: Envelopes are fixed-percentage bands around an average, not a volatility measure, so boundary touches can mean range noise or trend continuation.

The strategy classifies Alligator line order (Lips/Teeth/Jaws) into neutral, unconfirmed, and confirmed states using persistence across completed bars (InpTrendMinBars). Only confirmed direction or neutral can authorize an Envelope close-cross event; counter-trend crossings are filtered, repeated arrows are throttled via cooldown, and optional alerts trigger on closed bars.

Implementation-wise, Envelope_Alligator_Strategy.mq5 composes four built-in handles (iEnvelopes + three unshifted iMA) to avoid re-implementing formulas, ...

πŸ‘‰ Read | Freelance | @mql5dev
❀17πŸ‘10πŸ”₯4🀩3πŸ‘¨β€πŸ’»2πŸ‘Œ1
PropFirmAwareSizer adds two modifiers on top of budget-based sizing: derisking_factor and news_window_factor.

derisking_factor reduces exposure as phase_progress approaches the profit target. It stays at 1.0 until 80% progress, then tapers to a floor at 100%. The floor is 0.30 before min trading days are met, and 0.10 after, so day-count compliance remains possible while still cutting risk near a pass.

Both modifiers multiply, not min(). Moderate constraints compound, and identical final sizes can come from different states, so diagnostics like cal_bet_size and derisking are required.

news_window_factor is funded-stage only. It uses a UTC-normalized economic calendar and applies a 5-minute half-window around high-impact events. It is a sizing heuristic, not profit accounting, and should be symbol-aware to avoid false haircuts.

πŸ‘‰ Read | Freelance | @mql5dev
❀21πŸ‘9🀩6πŸ”₯4⚑2🀣1
A native MQL5 port of Kronos can match PyTorch outputs and still fail as a forecaster. The article separates verification (tight numeric equivalence) from market evaluation, where misleading β€œgood-looking” results are easy to generate.

KronosForecast EA runs inference once per completed bar (never using the still-forming bar), then renders predicted candles via chart objects. Missing exchange volume/amount is approximated from tick volume and typical-price turnover, introducing a distribution shift. Future timestamps are projected on a fixed grid; weekend crossings are measured and shown not to explain poor accuracy.

Evaluation is built to prevent look-ahead by design: dump deterministic greedy forecasts to file, score them offline, then backtest using only forecast columns. On EURUSD H1 (256-bar context, 16-bar horizon), Kronos underperforms a random-walk ...

πŸ‘‰ Read | NeuroBook | @mql5dev
❀19πŸ‘11πŸ”₯5πŸ‘¨β€πŸ’»3🀩2πŸ‘Œ1
Deep learning in trading hit a known limit: adding layers can stall or reduce accuracy due to optimization issues. Residual connections (ResNet) addressed this by preserving an identity path and stabilizing gradient flow.

Spiking neural networks (SNNs) better match event-driven market behavior by processing discrete spikes, with potential gains in real-time processing and efficiency. In practice, deep SNNs have been hard to train: identity mapping is non-trivial with spiking neurons, and surrogate gradients amplify vanishing or exploding gradients as depth grows.

SEW-ResNet (Spike-Element-Wise residuals) reframes residual learning for SNNs with element-wise spike-based gating that supports natural identity mapping and stable gradients. Reported results include stable training beyond 100 layers and improved accuracy versus prior deep spiking baselines, enab...

πŸ‘‰ Read | Freelance | @mql5dev
πŸ‘15❀11🀩11πŸ”₯4πŸ‘¨β€πŸ’»3πŸŽ‰1πŸ‘Œ1
Part 84 adds a structural validator to a MetaTrader 5 double-bottom recorder, turning a visually labeled sample into a testable hypothesis with deterministic rules and explainable measurements.

The validator finds swing lows via pivot-strength windows, consolidates nearby lows, then evaluates every low pair: separation, neckline (highest intervening high), depth, low similarity (depth-relative), and symmetry around the neckline. Accepted pairs are classified by the first decisive close: CANDIDATE, CONFIRMED (breakout), or FAILED (breakdown); otherwise INVALID.

Implementation isolates logic in DoubleBottomValidator.mqh, keeps CSV data unchanged, exposes thresholds as EA inputs, and reports a weighted conformity score plus key indices/prices. Traders get consistent labeling; developers get an inspectable rule engine for testing and extension.

πŸ‘‰ Read | NeuroBook | @mql5dev
❀16πŸ‘14πŸ”₯9🀩7⚑5πŸŽ‰2πŸ‘Œ1
Correlation dashboards report a level, but the level alone cannot distinguish sector structure from a single market-wide driver. Ollivier-Ricci curvature adds a geometric signal by comparing neighborhood overlap on a correlation-derived metric graph.

The implementation builds a complete graph using Mantegna distance d=sqrt(2(1-rho)), then assigns non-uniform neighborhood measures via Gaussian decay. The curvature scale requires a structureless reference (β€œpole”) that depends only on node count, so output is interpreted as a gap from that pole, not a standalone value.

Core dependency is an exact Wasserstein-1 transport solver (min-cost flow with potentials) with certificate checks. Reducing transport to the positive parts of measure differences is exact only under a true metric, making triangle-inequality validation operationally important.

Multi-...

πŸ‘‰ Read | AlgoBook | @mql5dev
❀25πŸ‘15🀩13πŸ”₯5✍4πŸ‘Œ2πŸ‘€2
Advanced trade-management panel for MetaTrader 5 focused on prop-firm style risk controls. It does not generate signals and does not open trades on live or demo accounts without user action. The panel calculates hidden support/resistance levels from pivots to suggest SL/TP and grid levels, while keeping charts clean.

Risk handling includes daily and maximum drawdown limits with a configurable buffer, optional profit target and max daily profit, and automatic position/pending cleanup plus trading lock when limits are hit. Lot sizing is derived from a risk percentage and validated against leverage and margin rules per asset class, using the stricter of broker or configured limits.

Workflow is split into MAIN (protection/settings), LIVE (market orders with draggable SL/TP), PEND (S/R-based pending orders), and GRID (2–8 level grids, optional breakeven, broker-...

πŸ‘‰ Read | Signals | @mql5dev
❀24πŸ‘19πŸ”₯12🀩3πŸ‘Œ3🀑2
Most EAs rely on the broker’s session table via SymbolInfoSessionQuote and SymbolInfoSessionTrade. Time filters, rollover rules, and session boxes assume the table matches observed pricing. This auditor compares the declared sessions with M1 history and reports where they diverge.

Over N whole server days it counts, for each minute-of-week, how often an M1 bar exists on that weekday. It then flags declared minutes that are usually empty, bars occurring outside declared sessions, mismatches between quote and trade tables, and one-off outages (gaps in normally live declared minutes).

Example run: 5 Market Watch symbols over 35 days (2026.09.01–2026.10.06 UTC), single pass in 62 ms. On an Exness demo feed, EURUSD/GBPUSD/USDJPY are declared 00:00–24:00 Mon–Thu, but history frequently has no bars after 21:00, so tester events scheduled there often never trigger....

πŸ‘‰ Read | Calendar | @mql5dev
πŸ‘27❀17πŸ”₯13🀩7πŸ‘¨β€πŸ’»7✍2😈1
CajasTF is a lightweight MT5 indicator that adds a real-time mini-chart panel on the right side of the main chart. It supports any timeframe from M1 to MN1 and updates the active candle tick-by-tick, reducing the need to switch charts or open additional windows.

The panel inherits the current chart’s visual settings, including background, grid, labels, candle bodies, wicks, dojis, and the Bid line, and adapts automatically when the template changes. An independent vertical price scale with a 5-level grid keeps proportions stable regardless of the main chart zoom.

Operational features include automatic right-margin shift to prevent overlap with current price action and restoration of original shift settings on removal. Live telemetry includes a candle countdown timer, a current Bid marker, and an OHLC footer with percent change for the active bar.

πŸ‘‰ Read | Freelance | @mql5dev
❀31πŸ‘13πŸ”₯10🀩7πŸ‘Œ2πŸ’―1
Session Levels is a chart-only indicator that plots intraday reference levels commonly used for discretionary analysis and execution planning. It does not place orders. Typical output includes Asian range boxes, previous day high/low, daily VWAP, swing highs/lows, and an on-chart info panel.

Usage is straightforward: attach to any symbol and timeframe, with M5–H1 typically preferred. Hover tooltips describe each line or box, while the top-right panel shows current values. Colors switch automatically for dark or light chart themes.

Key inputs cover session hours (broker server time), number of historical days to render, optional London and New York boxes, and extension rules for Asian highs/lows. Level options include PDH/PDL, PWH/PWL, and configurable round-number steps and density around price.

VWAP resets daily using tick volume. Swings confirm only a...

πŸ‘‰ Read | Quotes | @mql5dev
❀23πŸ‘12πŸ”₯10🀩5πŸ‘2⚑1πŸ‘Œ1
A divergence signal gains relevance when multiple oscillators disagree with the same price swing. This indicator checks ten classic oscillators against recent price pivots on every bar, draws divergences directly on price, and adds a box listing which oscillators triggered plus the total count.

Built-in calculations cover MACD and histogram (12/26/9), RSI 14, Stochastic 14/3, CCI 10, Momentum 10, OBV, VWMACD (12/26), CMF 21, and MFI 14. Each can be disabled independently; volume-based signals use tick volume.

Pivots use 5 bars on each side (close or high/low). Each oscillator compares the signal bar to up to 10 pivots within 100 bars, requiring a clean, unbroken line between points on both oscillator and price. Regular and hidden divergences are supported, with optional bar-close confirmation, confluence filtering by minimum count, and per-side alert...

πŸ‘‰ Read | Forum | @mql5dev
❀25πŸ”₯8πŸ‘7🀩7πŸ‘Œ2✍1πŸ’”1
MetaTrader derives TimeTradeServer() and TimeLocal() from the local Windows clock. When that clock drifts, any time-based logic in an EA drifts with it. Order expirations can trigger early or late, session/news filters shift, and end-of-week shutdown logic can miss the intended second. The terminal provides no warning.

A recent VPS case showed the Windows time service stopped and the clock ran 11 seconds slow. Limit orders configured to remain valid for 15 seconds were expiring after 4 seconds.

A script can measure this directly using tick timestamps. Each tick includes the server-stamped time with millisecond precision. The script compares that stamp to the local clock at tick arrival across 40 fresh ticks and uses the smallest non-negative gap, adjusted by half the current ping.

Run on an active symbol during open market hours. Output in Experts log and on...

πŸ‘‰ Read | AlgoBook | @mql5dev
❀17πŸ‘13πŸ”₯6🀩3πŸ‘€2πŸ‘Œ1
Spiking neural networks fit event-driven financial ticks but break classic ResNet behavior. Binary activations destroy shortcut identity, causing unstable or vanishing gradients in deep SNN stacks.

SEW-ResNet restores depth by moving the shortcut outside spiking activation and combining paths with configurable element-wise functions, not only addition. This makes deep spiking residual models trainable and task-tunable.

Implementation work also targets GPU efficiency. OpenCL kernels for fully connected and convolution layers add zero-input checks to skip weight reads and multiplications, and restructure FC computation across work-items with local reductions.

Next step is SEW-style blocks integrated into a spiking ResNeXt bottleneck with dynamic module construction, supporting parallel feature paths for multi-scale market structure.

πŸ‘‰ Read | Forum | @mql5dev
❀26πŸ‘13πŸ”₯7πŸ‘Œ3πŸŽ‰1🀩1
Feature neutralization separates β€œreal” signal from hidden bets on volatility or trend. The approach regresses a raw trading signal on selected confounds in a rolling window, then trades the residual, making it linearly uncorrelated with those factors inside the fitted window.

A native MQL5 library implements rolling OLS with standardized factors and a Gauss-Jordan solver. It enforces minimum observations per parameter, hard-fails zero-variance factors, and tracks failed fits so an EA can avoid trading on stale coefficients.

The EA and indicator share the same engine and use strict bar handling (only closed bars, score-then-learn) to prevent lookahead. A Python companion validates numerical correctness against SVD-based least squares, stress-tests conditioning, and can replay backtests from CSV or MT5 data.

πŸ‘‰ Read | VPS | @mql5dev
❀12πŸ‘9πŸ”₯6🀩3✍1πŸ‘Œ1
This article shows a robustness check for MT5 backtests: vary the bar-opening grid and measure how indicators and trades change, even when using the same M1 history. For an M15 target, it enumerates all 15 integer-minute boundary offsets and runs an otherwise identical Strategy Tester pass per offset, focusing on dispersion rather than β€œbest” profitability.

Shifted M15 bars are rebuilt causally from completed M1 bars, with careful handling of startup warm-up, gaps (missing minutes), and end-of-test clipping where the final partial bucket may never publish. Controls isolate warm-up and common-end effects, and a validation series repeats all offsets using real ticks.

The deliverables include a reusable shifted-bar builder, an EA that profiles boundary sensitivity, a synthetic self-test for deterministic correctness, and an audit tool exporting gap and session...

πŸ‘‰ Read | Quotes | @mql5dev
❀12πŸ‘10πŸ”₯6🀩5πŸ‘Œ3
Single-symbol EAs often hardcode pip value, contract size, tick size, and min lot. In multi-asset portfolios (EURUSD, XAUUSD, US30, USDJPY), those assumptions fail and produce incorrect position sizing.

A robust approach is a runtime metadata layer fed by SymbolInfo* calls, deriving usable quantities such as account-currency tick value, tick-to-point scaling, and volume normalization (min/max/step with round-down). Tick value must be refreshed periodically because cross rates move.

The framework loads a symbol universe from an ANSI plain-text file, validates symbols via SymbolSelect and market watch, then centralizes specs in a registry struct with timestamps for staleness control. Agents consume registry data for lot limits and pip/point conversion, avoiding scattered SymbolInfo calls and preventing ERR_INVALID_VOLUME.

Known gaps include non-FX pip conven...

πŸ‘‰ Read | Calendar | @mql5dev
❀13πŸ‘13πŸ”₯6🀩6πŸ‘Œ1
Part 85 adds a visual review layer for a double-bottom validator so indices and statuses can be checked directly on the historical chart, without re-deriving structure. SHOW ON CHART navigates to the stored interval and draws the range boundary, L1/L2, neckline, outcome marker (breakout/failure), status, and score; INVALID results keep their explanation but are intentionally not drawn.

The renderer enforces context: symbol/timeframe must match, and chart history is verified against stored OHLC within tolerance. It pauses auto-scroll during review, uses a strict object-name prefix for safe cleanup, and restores scrolling on Clear(), leaving unrelated drawings untouched.

Panel and renderer stay separated: the panel retains the sample plus validation result, while the renderer owns chart objects, navigation, defensive contract checks, and error reporting. This cre...

πŸ‘‰ Read | Forum | @mql5dev
❀15πŸ‘12πŸ”₯4🀩4πŸ‘¨β€πŸ’»2πŸ‘Œ1πŸ†1
Prop firms often close accounts immediately when a daily loss cap is hit. A chart indicator can reduce manual tracking by calculating key thresholds directly from account history and current equity.

It displays the day’s starting balance, the equity level where the daily loss limit is reached, loss used so far in currency and as a percentage of the limit, and remaining room before violation. An optional line can show the maximum loss limit level. Panel colors shift from green to orange to red as risk increases, with one popup warning per day at a configurable level (80% by default).

Inputs include daily and maximum loss limits (percent), challenge starting balance, server-time day start hour, warning level, and panel position. The tool is read-only and does not place or manage orders. Daily definitions vary by firm, so settings should match the firm’...

πŸ‘‰ Read | VPS | @mql5dev
πŸ‘9❀3🀩3πŸ‘¨β€πŸ’»3πŸ‘Œ2
This article proposes an MT5 trading architecture where strategy logic evolves in production: 20 Grok-powered LLM agents run with different system prompts, and a genetic algorithm selects winners every 20 trades. The bottom 25% are removed, the top 25% are cloned with controlled prompt mutations, and a chart leaderboard tracks fitness.

Fitness avoids naive PnL ranking by using Sharpe Γ— sqrt(trades), with a minimum of 3 personal trades to reduce statistical noise. Agent selection blends exploitation (softmax roulette) with exploration (quota for under-tested mutants).

Implementation focuses on practical MT5 reliability: Grok is called via plain REST + requests (no SDK), JSON output is made unambiguous, EVOLVE is handled synchronously with socket locking to prevent corrupted replies, and MQL5 attributes results using DEAL_POSITION_ID. Backtest on EU...

πŸ‘‰ Read | Forum | @mql5dev
πŸ‘14❀5πŸ”₯5πŸ‘2🀩2πŸ‘Œ2
Session filters in EAs are defined in server time, and brokers use different time zones and DST rules. A fixed β€œ10:00–13:00” window only stays aligned with London or New York while the server offset stays stable, which fails during the US/EU DST gap weeks.

A clock-audit tool can infer the server offset from symbol history instead of relying on broker notes. The weekly FX/CME close is 17:00 America/New_York; comparing that instant (converted to UTC with US DST rules) to the last H1 bar before each weekend/holiday gap yields one offset measurement per week. Over ~60 weeks this produces a sequence that detects clock moves, dates the switch between closes, and classifies the regime as fixed, US, EU, mixed, or untested.

Output includes irregular closes (for example early US holiday metals closes), counts of Sunday bars (relevant for D1 candles), and projections ...

πŸ‘‰ Read | Freelance | @mql5dev
πŸ‘9❀7πŸ”₯4🀩2πŸ‘Œ2