MQL5 Algo Trading
534K subscribers
3.75K photos
6 videos
3.75K 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
Mapper converts a point cloud into a compact graph, but the highest sensitivity sits earlier: the lens and the cover. A lens assigns one scalar per point; a cover slices the lens range into overlapping intervals and records point membership.

Three lens options are used: eccentricity (mean distance), density (Gaussian-weighted neighborhood), and a coordinate projection. Intrinsic lenses cost O(N^2) over an existing distance matrix and can collapse on symmetric clouds, producing zero range and a single-bin cover.

The cover is controlled by resolution (interval count) and gain (overlap). With gain>0, points appear in multiple intervals and later become shared membership for edges. Practical starting values: resolution 5–15 and gain 0.2–0.5, with checks for degenerate lenses and expected double counting from overlap.

πŸ‘‰ Read | Signals | @mql5dev
❀19πŸ‘4πŸ‘€4⚑2πŸ‘Œ2✍1
False breakouts often occur during trend transitions, where velocity changes precede visible structure. A proposed approach pairs Divergence Mapping with a Temporal Fusion Transformer style attention layer to produce an alternative forecasting metric and a Trade Robot output.

The divergence engine computes a lookback slope for price and for momentum indicators, normalizes price slope by the window baseline, then takes the slope differential as a structural discrepancy. A sensitivity threshold gates signal validity rather than single-point breakout confirmation.

The TFT proxy consumes three time states and applies fixed attention weights (0.55/0.30/0.15) to form buy and sell scores with strict mutual exclusivity. An MQL5 implementation emphasizes passing arrays by reference to reduce memory churn.

RSI and DeMarker are used to separate closing consens...

πŸ‘‰ Read | Quotes | @mql5dev
❀34πŸ‘4πŸ‘Œ4πŸ‘€1
The article presents the Bison Algorithm (BIA), a population-based optimizer for single-objective continuous search, built around two behaviors: fast exploration and a defensive clustering phase that stabilizes and refines good candidates.

BIA splits the population into a swarm group (about 80%) that moves toward a target and a runner group (about 20%) that probes new regions with a slightly perturbed direction vector. If a runner outperforms the swarm’s weakest member, it is promoted into the swarm.

The MT5-style implementation exposes clear controls (population size, swarm ratio, elite size, max step). Iterations combine weighted elite-centroid tracking, bounded step updates with rollback on worse fitness, and sorting to preserve top solutionsβ€”useful for robust parameter optimization in trading systems.

πŸ‘‰ Read | Forum | @mql5dev
❀29πŸ‘6⚑4πŸ‘Œ2
A trend identification indicator is available for classifying buy-side and sell-side conditions using signals derived from the stochastic oscillator.

The logic relies on stochastic readings to determine direction and potential turning points, helping separate upward momentum phases from downward momentum phases.

Typical usage includes filtering entries to align with the detected direction, combining with a separate confirmation method, and validating behavior across multiple market regimes. Parameters such as %K, %D, smoothing, and threshold levels should be reviewed for the target instrument and timeframe.

πŸ‘‰ Read | AlgoBook | @mql5dev
❀32πŸ‘Œ2✍1πŸ‘1πŸ‘1πŸŽ‰1
Deterministic backtests produce a single realized path and can overstate risk-adjusted metrics. A validation battery addresses this by evaluating distributions, not one sequence.

Permutation testing uses sign-randomization on per-trade P&L to build a no-edge null for order-independent statistics like Sortino. Bootstrap resampling estimates metric stability via percentile and BCa confidence intervals. Monte Carlo trade-sequence shuffling keeps trade outcomes fixed but randomizes order to quantify drawdown sensitivity to sequencing.

All modules consume a trade-level CSV exported from MT5 deal history. An EA-side include writes one row per closed trade and supports multi-core optimization via a contention-safe file-open. Only Trade_Profit_USD and Indicator_Name are required; no strategy logic changes needed.

πŸ‘‰ Read | Freelance | @mql5dev
❀27πŸ‘Œ2πŸ‘1
Chart Replay Pro (MT5 Strategy Tester, visual mode) received a major update focused on manual backtesting parity with live-trading controls.

Changes include runtime lot adjustment without restarting tests, per-position trade management, and an order workflow supporting buy/sell stop and buy/sell limit orders. UI is built with bitmap-based CbmpButton plus #resource inclusion, and a read-only edit field for lots.

Key implementation notes: OnChartEvent is not processed in Strategy Tester, so entry and TP/SL are adjusted via plus/minus buttons instead of draggable lines. Global state variables are used to prevent tick-driven UI bugs and to keep selected ticket, TP, and SL stable while actions execute.

πŸ‘‰ Read | Quotes | @mql5dev
❀29πŸ‘Œ2⚑1πŸ‘1
Symbolic Aggregate approXimation (SAX) converts a price window into a short word via z-normalization, PAA segmentation, and Gaussian breakpoint discretization. The result is countable patterns with a lower-bounding distance (MINDIST) for pruning similarity search.

A practical MQL5 implementation fills missing platform primitives: probit-based Gaussian breakpoints, robust PAA for non-divisible lengths, flat-window rejection, and integer-coded symbols to keep distance math stable.

Applied to markets, normalization removes level and volatility, which can invalidate naive trading use. This is handled by evaluating forward outcomes in ATR units and enforcing a strict no-lookahead constraint when collecting precedents.

The analog search uses MINDIST as a fast filter, then computes full distances only for survivors, producing a distribution-based forecas...

πŸ‘‰ Read | Calendar | @mql5dev
❀24πŸ”₯2πŸ‘Œ2⚑1
Forex returns rarely have constant variance, so MSE-based regressors silently optimize the wrong objective. This article replaces that assumption with a probabilistic MLP that outputs both the conditional mean and a feature-dependent variance, trained via Gaussian negative log-likelihood.

The network uses a linear head for the mean and Softplus for strictly positive variance. Backprop is extended with explicit gradients for both outputs, enabling custom-loss training instead of relying on built-in MQL5 loss helpers.

Training is integrated with ALGLIB’s L-BFGS through parameter packing/unpacking plus a separate callback to log true per-iteration loss. A sample MT5 indicator trains on normalized price increments and plots forecasts with 95% confidence intervals, giving traders risk-aware signals, not just point estimates.

πŸ‘‰ Read | VPS | @mql5dev
❀28πŸ‘Œ4πŸ‘2
Stop-loss and take-profit placement often defaults to round numbers or fixed ratios. Closed trade history already contains usable measurements for where price moved against and in favor of each entry.

The MAE/MFE Excursion Analyzer EA rebuilds round-trips from MT5 deal records (optionally filtered by magic), then scans M1 candles between entry and exit to compute per-trade MAE, MFE, and efficiency (captured move divided by MFE). Output includes on-chart stats and a CSV per trade.

Key readouts come from distributions split by winners/losers: winners’ p90 MAE as a stop distance, winners’ median MFE as a target zone, and efficiency to flag premature exits. The tool reads history only and does not place orders.

πŸ‘‰ Read | Freelance | @mql5dev
❀49⚑3πŸ”₯3πŸ‘¨β€πŸ’»2πŸ‘Œ1
Nikkei 225 Gap Continuation EA is an educational MetaTrader 5 Expert Advisor implementing a cash-session opening-gap continuation model with an opening-range breakout and session VWAP confirmation. It supports bullish and bearish gaps, enforces a β€œgap less than 50% filled” invalidation rule, and limits entries to one per day with deadline and forced-exit controls.

Session timing is calculated per trading day, with automatic Japan Standard Time conversion to server time including DST, plus a manual mode for other brokers. The opening range is built from 1-minute bars; VWAP uses real volume when available and falls back to tick volume.

Risk and execution features include equity-based position sizing using OrderCalcProfit for account-currency risk normalization, fixed-lot option, broker volume-step rounding, spread filters, partial close, break-even moves, an...

πŸ‘‰ Read | Calendar | @mql5dev
❀15πŸ‘15πŸ‘Œ3πŸŽ‰1
Microstructure Matrix v5.1 targets common failure modes in retail SMC indicators: excessive per-tick recalculation, repainting, and unvalidated visual signals. The design centers on an asynchronous scanning engine that filters setups using variance measures and structural checks across multiple instruments.

The core engine uses event-driven CPU caching for high-timeframe data, limiting real-time work to lightweight price verification to reduce terminal load during multi-asset scans. An imbalance validator rejects order blocks that do not produce a measurable fair value gap. Structure is derived from swing fractals rather than candle closes, and CHOCH is confirmed only when tick volume exceeds the 50-period mean plus 1.5 standard deviations; otherwise it is flagged as a low-volatility defect.

A matrix HUD summarizes selected symbols, while validate...

πŸ‘‰ Read | CodeBase | @mql5dev
❀24πŸ‘4πŸ‘Œ1
MetaTrader 5 exposes open positions in the Trade tab, but that view stays inside the terminal and forces constant context switching in multi-monitor setups.

A practical workaround is an Expert Advisor that reads PositionsTotal() on every tick, collects each position via PositionGetTicket(), then pulls fields with PositionGetDouble/Integer/String. Live values like POSITION_PRICE_CURRENT and POSITION_PROFIT update without extra state.

The EA generates a complete HTML document in memory and writes it in one FileWriteString() call using FILE_WRITE to avoid partial renders during browser reloads. The page self-refreshes with a small JavaScript setInterval() timer.

Output is self-contained: inline CSS, no external assets, optional row tinting by profit sign, and HTML escaping for free-text comments to prevent markup breakage.

πŸ‘‰ Read | Signals | @mql5dev
❀28πŸ‘6πŸ‘Œ1
Range breakout research starts with formalization, not opinions. The key step is turning β€œtrade breakouts” into explicit rules for range construction, breakout validation, stops, exits, and position management.

A baseline model should stay minimal: build a time window range, place buy/sell stops outside bounds, then manage with trailing stop and time exit. Filters are excluded to measure whether the breakout mechanic has edge.

An effective framework separates range construction from execution. A dedicated CBoxSession module can encapsulate boundaries, timing, expiration, and breakout state, with GMT-based session inputs for broker portability and logic to skip weekend or irregular bars.

Testing should target trade count, not calendar years. Rough guidance: 300–700 trades for optimization, 50–100 for forward checks. For sizing, fixed risk per trade based on...

πŸ‘‰ Read | Freelance | @mql5dev
❀17πŸ‘15πŸ‘Œ2
The automated MT5 optimization pipeline for a multi-currency EA is refined to reduce friction in real use: cleaner project/library separation, faster iterations, and better visibility into long optimization runs.

A key fix removes hidden coupling between repositories by letting project code define default inputs (like DB name/path) via constants, while the Adwizard library provides safe fallbacks. This keeps the library reusable across strategies without edits.

Optimization tasks can now be time-boxed per stage. A new max-duration field is added to the SQLite tasks table, propagated through task creation, and enforced by checking elapsed time and forcing a stop when limits are exceeded. This trims wasted genetic runs.

Process monitoring is upgraded from Comment() to a full-chart scrollable console dialog, showing detailed current-task info and han...

πŸ‘‰ Read | AppStore | @mql5dev
❀26πŸ‘5πŸ‘Œ2πŸ‘€2✍1
This article ports Mark Minervini’s SEPA Trend Template into a rule-driven MetaTrader 5 EA, turning an 8-point discretionary checklist into a strict pass/fail filter. The core idea is structural selectivity: price and the 50/150/200 SMAs must align, the 200 SMA must be rising, and price must be both well off the yearly low and near the yearly high, filtering for sustained, leader-like trends.

For forex, the missing IBD Relative Strength condition is replaced with RSI(14) > 50, and the VCP entry is simplified to a close above the prior 20-bar high with volume at least 1.5x its 20-bar average. The EA logs exactly which condition blocks each setup, uses ATR-based stop sizing with fixed risk, and exits on a close below the 50 SMA with volume confirmation. Backtests highlight the expected behavior: few signals on D1, long idle periods, and occasional qualified tr...

πŸ‘‰ Read | Freelance | @mql5dev
❀35πŸ‘18πŸ‘¨β€πŸ’»5πŸ‘Œ3😁2
Trading plan outline based on the Asian session range (01:00–05:00 GMT). The range is defined during this window, with execution reserved for the London or New York session open to avoid low-liquidity conditions.

Entry is placed at the 60% (0.6) Fibonacci retracement of the established range. Risk is controlled with a stop loss set below the 80% (0.8) Fibonacci level to limit invalidation.

Profit taking targets a fixed 1:5 risk-to-reward multiple. This structure standardizes entries, enforces consistent risk parameters, and supports repeatable backtesting across instruments and days.

πŸ‘‰ Read | Forum | @mql5dev
❀39πŸ‘10πŸ‘¨β€πŸ’»2πŸ‘Œ1
Smart Trend Score is a lightweight MT5 indicator that reports market state in a single text line at the chart’s upper-left corner. It avoids arrows, trend lines, and extra objects, focusing on BUY, SELL, or NO SIGNAL with a confidence score and computed trade levels.

Signal logic uses multiple filters to limit false positives: fast/slow linear weighted moving averages, trend confirmation, market structure (HH/HL/LH/LL), ADX strength, ATR volatility, and price action checks. Signals are produced only after candle close, with a multi-factor score from 0 to 100 and a configurable minimum threshold.

Risk parameters are calculated automatically: entry, stop loss in points, and take profit based on the selected risk/reward ratio. Configuration includes text placement, Arial font sizing, colors, and optional popup, push, and email alerts limited to one per ...

πŸ‘‰ Read | Quotes | @mql5dev
❀29πŸ‘10😱3πŸ†2πŸ‘1πŸ‘Œ1
Adaptive optimizers address uneven feature dynamics by changing per-parameter learning rates during training, reducing stalls near local minima seen with fixed-step SGD. Common options include AdaGrad, RMSProp, Adadelta, and Adam, with Adam combining moving averages of gradients and squared gradients using typical settings Ξ²1=0.9, Ξ²2=0.999, Ξ±=0.001, plus Ξ΅.

An Adam update path was added alongside existing backprop, focusing on weight updates. The OpenCL kernel keeps weight, gradient, input, and moment buffers, uses float4 vectorization, and applies a precomputed bias-correction factor from the host to avoid per-neuron recomputation.

Code changes include training-method selection, moment buffer lifecycle management, save/load compatibility, and matching logic in non-OpenCL classes. Network construction passes the chosen optimizer through layer descriptors.

Testin...

πŸ‘‰ Read | AlgoBook | @mql5dev
πŸ‘25❀23πŸ‘€5πŸ‘Œ1πŸ‘¨β€πŸ’»1
High win rate and a smooth equity curve do not reveal whether a system is increasing size after losses or averaging into a losing move. This script derives those behaviors directly from closed-trade history.

It reads a closed-position CSV and prints a report in the Experts tab covering: volume escalation after a loss (martingale signature), overlapping same-direction exposure (grid/averaging signature), payoff asymmetry (many small wins versus an outsized loss), and a heuristic risk-of-ruin estimate at the configured risk per trade. A composite A–F grade combines all dimensions and outputs recommendations.

Input expects a CSV in MQL5\Files named via InpCsvFileName (default RuinAuditorSample.csv) with header: OpenTime,CloseTime,Symbol,Type,Volume,OpenPrice,ClosePrice,Profit. If missing on first run, a reproducible demo trade book is generated and analyzed. A...

πŸ‘‰ Read | NeuroBook | @mql5dev
❀25πŸ‘4πŸ‘Œ2
Thomas DeMark’s Sequential, as described in β€œThe New Science of Technical Analysis”, models a trend from early acceleration through a potential reversal. The pattern uses four stages: Setup start (close vs. close 4 bars back), 9-bar Setup completion, an intersection (β€œcrossover”) condition, then a 13-count Countdown with a signal arrow.

Implementation notes include MQL4/MQL5 indicators plus optional Murray-Gann or equivalent fractional levels (8 parts with Β±1/8 and Β±2/8 extensions). Levels are used to qualify where price sits inside a range rather than labeling direction only.

Practical trading rules commonly cited: stops at the most extreme candle in the full pattern; entries via next open, post-bounce open, or a 2-bar extreme break; exits on opposite Setup completion without breaking the signal extreme, or after breaking it with a new opposite signal...

πŸ‘‰ Read | Forum | @mql5dev
❀53πŸ‘11πŸ‘¨β€πŸ’»6πŸ‘Œ4⚑3πŸ‘€2✍1
Trend validation can be tightened by measuring moving-average slope instead of relying on crossovers. A Simple Moving Average is sampled against a prior value, converted to an angle via arctangent, and used as a trend-strength gate. Angles near zero indicate range conditions and block trading.

Entries are evaluated only on candle close. A trade requires three concurrent filters: angle beyond a threshold (with a secondary minimum angle check), close positioned on the correct side of the SMA, and a capped percent deviation to avoid late entries during acceleration. Position sizing supports fixed lots or equity-based risk.

Risk control applies staged stop management: move to protected break-even after a profit threshold, tighten on rising deviation levels, add extreme-deviation protection, and relocate stops when price crosses the SMA against the posi...

πŸ‘‰ Read | Freelance | @mql5dev
❀17πŸ‘5πŸ€”1πŸ‘Œ1