MQL5 Algo Trading
551K subscribers
3.96K photos
6 videos
3.96K 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
Wolfe Wave Dashboard v1.25 is a MetaTrader 5 indicator built for multi-symbol, multi-timeframe monitoring. It scans up to 20 symbols across configurable timeframes from M1 to MN1 and flags the newest valid Wolfe Wave setups using strict geometric constraints, including alternating pivots, 1-3 and 2-4 convergence, tolerance controls, and pattern width limits.

The scanning engine is optimized and processes only newly closed bars to keep CPU load predictable at scale. The dashboard lists Symbol, Timeframe, Direction, Pattern, Age (bars since point 5), historical Average Time-To-Target, and an Open action.

Chart opening draws the full layout automatically, with 1-3 and 2-4 lines, filled triangle, numbered points, entry arrow, and optional 1-4 target line. Alerts support popup, sound, email, and push notifications. Time-To-Target statistics persist to CSV...

πŸ‘‰ Read | Freelance | @mql5dev
❀72πŸ‘9😁4πŸ‘Œ4πŸ‘€4πŸ‘¨β€πŸ’»3✍1
A SuperTrend indicator implementation for MetaTrader 5 built from first principles, using an ATR-scaled envelope, a ratcheting band that only tightens in the active trend direction, and a binary trend state that flips only after a confirmed close beyond the opposite band.

Recursive state is stored in indicator calculation buffers (upper band, lower band, trend flag) instead of manually-managed arrays. This delegates sizing and persistence to the terminal, reducing continuity issues that often surface in backtests when state resets or desynchronizes.

The logic uses consistent series indexing and a deterministic seeding step from the oldest usable bar. Reversal arrows are plotted only after confirmation on a bar that will not be recalculated, avoiding transient signals that appear and disappear on subsequent ticks.

πŸ‘‰ Read | Calendar | @mql5dev
❀35πŸ‘6πŸ‘Œ3πŸ‘¨β€πŸ’»3🀣2πŸ‘€1
A complete Fisher Transform oscillator for MetaTrader 5 built from statistical first principles. It reshapes bounded price-derived values into a near-normal distribution, producing sharper turning points than many averaging-based oscillators.

Computation is performed in three stages: normalize price to a fixed range from recent highs/lows, smooth the normalized series with a clamp near the boundary to keep the logarithm well-behaved, then apply the Fisher log transform and recursively blend with the prior output. Recursive state uses registered indicator buffers, with the main output serving as its own continuous memory.

The output is a single oscillator line without built-in trade arrows. Typical interpretation combines level and behavior: readings beyond about Β±1.5 to Β±2 indicate extremes, while the usable event is the turn back toward zero after t...

πŸ‘‰ Read | Calendar | @mql5dev
❀26πŸ‘5πŸ‘¨β€πŸ’»4πŸ‘Œ1
Hurst Exponent Regime Switch is a regime filter that estimates a rolling Hurst exponent (H) from price using classic rescaled-range (R/S) analysis, then plots it as a 0–1 oscillator with threshold-based state changes.

Per bar, the lookback series is split into multiple chunk sizes. For each chunk, the range of cumulative mean-adjusted deviation is scaled by its standard deviation. Average R/S per chunk size is regressed in log-log space; the slope is clamped to [0,1] as H and optionally smoothed with a short EMA.

Interpretation is straightforward: H near 0.5 implies random-walk behavior, above the trend threshold (default 0.55) indicates persistence, and below the reversion threshold (default 0.45) signals anti-persistence. Primary inputs: lookback 200, min chunk 8, chunk steps 6, smoothing 5, applied price close. Best behavior typically appears on ...

πŸ‘‰ Read | AlgoBook | @mql5dev
❀26πŸ‘7πŸ‘Œ3πŸ‘€3
Prop-firm style daily loss rules often fail in real EAs because checks run per bar, ignore floating P&L (and swap), or don’t hard-block new orders. This module fixes that with an on-tick circuit breaker that measures combined daily P&L using server-midnight as the reset boundary.

CDailyPnlCalculator sums realized exits from deal history plus current position profit and swap, giving a true β€œtoday” exposure number every tick. When the limit is breached, the breaker closes all positions and removes all pending orders (using MqlTradeRequest actions), then enters a HALTED state until next server midnight.

A small API (Init/OnTick/IsHalted/GetStatus/ForceReset) makes integration predictable: gate every OrderSend with IsHalted. A chart dashboard and a verification script validate the math, reset timing, and formatting before deployment.

πŸ‘‰ Read | CodeBase | @mql5dev
❀30πŸ‘9πŸ‘Œ1
Bollinger Band mean-reversion works in ranges but fails systematically in trend formation. When ADX rises above 25 and bandwidth expands, band touches often precede breakouts, creating clustered losses under a fixed-rule strategy.

Meta-labeling splits direction from trade selection. A primary Bollinger signal provides side; a secondary classifier outputs {take, skip} plus a probability used for position sizing, with calibration required before bet sizing.

Secondary features include %B and normalized bandwidth, plus bandwidth momentum and a percentile-based regime flag with one-bar lag to prevent leakage. Deployment targets MQL5 via ONNX, using a two-EA file-bus and strict feature-order parity between Python and terminal.

πŸ‘‰ Read | Forum | @mql5dev
❀33πŸ‘12πŸ‘Œ3πŸ‘¨β€πŸ’»2
This EA turns a moving-average crossover into a staged setup rather than an immediate entry, reducing whipsaws by requiring follow-through before committing. Direction is set by a confirmed cross on closed bars, then a momentum candle must appear within a short bar window, and only the next bar may validate an immediate retracement (inside bar and/or directional pullback depending on mode).

A finite-state machine enforces the sequence: crossover β†’ momentum β†’ retracement β†’ pending-order/position management, with explicit resets when any step fails. Indicator handles are created once (iMA) and read via CopyBuffer, avoiding intrabar crossover noise and stale data.

Execution uses a pending stop at the retracement breakout, stop loss beyond the momentum extreme with a buffer, and take profit derived from the final broker-valid risk distance (default 2R). Orders ...

πŸ‘‰ Read | AppStore | @mql5dev
❀22πŸ‘13πŸ‘Œ4
Standard deviation bands quietly assume symmetric, well-behaved residuals. This channel avoids that by fitting conditional quantiles directly: 0.1, 0.5, and 0.9 lines over a rolling window, allowing asymmetry and reducing sensitivity to extreme bars.

Quantile lines are estimated by minimizing pinball loss, solved with iteratively reweighted least squares. A key implementation detail is a relative convergence test so iteration counts remain stable across instruments with very different price scales, plus epsilon flooring to prevent infinite weights.

The solution is packaged as reusable MT5 classes and two indicators: a chart channel and a separate gauge exposing Spread (distribution-free dispersion) and Skew (upside vs downside width). Validation scripts confirm the fitted lines split window samples close to the intended quantile proportions, making...

πŸ‘‰ Read | CodeBase | @mql5dev
❀63πŸ‘15πŸ‘¨β€πŸ’»5⚑2
A MACD Candles Alert utility for MT5 highlights momentum shifts by repainting candles when the MACD line crosses the zero level. Bullish conditions are marked with one candle color after an upward cross, while bearish conditions switch to a separate color after a downward cross.

Alerting is typically tied to the confirmed bar close to reduce noise: pop-up, push notification, email, and sound can be triggered on the crossing event, with options to limit repeated alerts per bar and per symbol. Common parameters include MACD fast/slow EMA periods, signal period, applied price, candle color selection, and minimum distance filters to avoid marginal crosses. This setup supports fast visual scanning across multiple charts.

πŸ‘‰ Read | Quotes | @mql5dev
❀31πŸ‘7πŸ‘Œ3πŸ‘¨β€πŸ’»3
DoEasy extends its indicator framework by adding concrete classes for each MT5 standard indicator (38 planned). Each descendant wraps metadata (type, symbol, timeframe, names) plus a structured parameter list, enabling consistent creation and access to indicator handles and properties.

The base indicator class is upgraded with an ENUM_INDICATOR type property, searchable/sortable in collections, and a readable type description derived from values like IND_MACD.

A new IndicatorsCollection centralizes lifecycle management: factory-style creation by indicator type, typed helpers (e.g., AC, Alligator), and retrieval of indicator lists filtered and sorted by type, symbol, and timeframe. Pointers to this collection are injected into Engine, TimeSeriesCollection, and BuffersCollection, preparing unified data updates and future event tracking across all indic...

πŸ‘‰ Read | NeuroBook | @mql5dev
❀55πŸ‘11πŸ‘4πŸ†4πŸ‘¨β€πŸ’»4πŸŽ‰3πŸ‘Œ1
Utility for MT5 that closes a defined basket of positions as soon as floating loss reaches a configured limit. The limit can be fixed money, percent of balance, or percent of equity; percent-based limits remain consistent as account size and basket costs change.

Basket scope is selectable: all positions, current chart symbol, or a magic-number list. Magic 0 includes manual trades. Optional basket take-profit is supported in money or percent of balance and is disabled by default.

On trigger, it snapshots the basket and closes only those tickets, preventing interference with trades opened later by other EAs. Close attempts are retried on a 500 ms timer without blocking, using the correct filling mode per symbol and validating server return codes. Retries pause during disconnects, market closure, or disabled autotrading; persistent rejection stops after 40 swe...

πŸ‘‰ Read | Quotes | @mql5dev
❀37πŸ‘9πŸŽ‰2πŸ‘Œ2
A lightweight chart indicator implements a candle countdown using a 1-second timer plus calculation refresh. Initialization sets EventSetTimer(1) and creates a single OBJ_TEXT object with configurable color, font, size, and anchor, while keeping it non-selectable and hidden from the objects list.

The countdown is derived from iTime(symbol, period, 0) and PeriodSeconds(period), then compared with TimeCurrent() to compute remaining seconds. Output is formatted as mm:ss or hh:mm:ss and updated on every tick and timer event.

Text placement is tied to the current bar time and live Bid via ObjectMove, followed by ChartRedraw. Deinitialization cleans up by killing the timer and deleting the object, avoiding orphaned UI artifacts.

πŸ‘‰ Read | AppStore | @mql5dev
❀16⚑6πŸ‘4πŸ‘Œ2πŸ”₯1
Drawdown analysis is often reduced to a single worst-case depth, but that is the least actionable metric. A practical view tracks three dimensions: depth, duration (time from prior peak to a new peak), and frequency (how often episodes occur). Duration is typically what breaks execution, even when depth is unchanged.

A history-only script is available to measure these on closed P/L. It does not place or modify trades and does not require algorithmic trading to be enabled. InpStartBalance switches reporting between currency and percent from the equity peak. InpTopN limits listed episodes. InpExportCSV saves DrawdownEpisodes.csv to MQL5\Files. The CURRENT line indicates whether a new peak is in place or an episode remains open and how it ranks versus past episodes.

Two implementation points affect results: commissions are included at the deal where charge...

πŸ‘‰ Read | NeuroBook | @mql5dev
❀26πŸ‘6πŸ‘¨β€πŸ’»3πŸ‘Œ2
An MT5 Expert Advisor applies Chaos Theory with quantitative momentum logic to gate entries by market regime.

A real-time Largest Lyapunov Exponent (LLE) is computed from reconstructed phase space using configurable lookback, embedding dimension, and projection steps. Nearest-neighbor divergence is tracked to classify conditions as structured versus high-entropy, with trading disabled when instability rises.

Execution is limited to EMA fast/slow crossovers that pass the chaos filter. Risk controls include balance-based position sizing by risk percentage, ATR-driven stop placement, and ATR-derived profit targets. Signal evaluation runs once per bar at the new open to reduce churn and avoid intra-bar noise.

Positioned as a regime-filtering component for systematic portfolio deployment.

πŸ‘‰ Read | Forum | @mql5dev
❀30πŸ‘4πŸ‘Œ2πŸ‘¨β€πŸ’»2
An on-chart risk management and execution panel for MT5 focuses on reducing position-size errors and improving execution speed during fast price moves.

It includes an equity-based risk calculator that derives lot size from a configurable risk percent and the current Stop Loss distance in pips. Buy/Sell actions place orders with Stop Loss and Take Profit attached at entry.

Management functions include Close All for positions filtered by Magic Number, plus a breakeven action that shifts Stop Loss to entry for winning trades. An optional trailing stop engine updates stops using configurable distance and step values.

Key inputs cover risk percent, default SL/TP pips, trailing stop settings, and panel X/Y placement. Usage is straightforward: attach to a chart, verify calculated sizing, then execute or manage positions via the panel.

πŸ‘‰ Read | Forum | @mql5dev
πŸ‘20❀14πŸ‘Œ3⚑1
Aggregate metrics like win rate and profit factor miss conditional risk: whether loss probability changes based on the previous trade’s outcome or sizing decision.

Neural Loss-Pattern Auditor runs that check directly on closed-deal history. It builds an eight-feature dataset per deal and prints diagnostics to the Experts tab: validation accuracy uplift versus a majority-class baseline, a calibration table by probability bins, and permutation feature importance ranked by accuracy loss after shuffling each feature. Results are summarized into an A–F composite grade with recommendations.

With InpUseDemoData=true, 480 synthetic deals are generated with an injected β€œlarger size after loss” pattern for immediate visibility. Set InpUseDemoData=false to analyze real history via HistorySelect() and HistoryDealGet*() with no files.

Network, validation split, calibration, ...

πŸ‘‰ Read | AlgoBook | @mql5dev
❀12πŸ‘7πŸ”₯3✍2πŸ‘Œ2
Financial time series remain unstable, with trends, cycles, noise, and structural breaks. Classic linear baselines often miss regime changes, while large neural models add overfitting risk and weak interpretability.

KΒ²VAE combines Koopman linearization in latent space, a stabilized Kalman correction step, and a VAE for probabilistic forecasts. The output is a distribution over latent states with uncertainty estimates, not a single trajectory.

In an Actor–Director–Critic stack, KΒ²VAE acts as an environment-state encoder. The pipeline includes normalization, extended patching with derivative features and timestamps, adaptive per-channel convolutions, RoPE positional encoding, and tensor reshaping for sequence processing.

A TimeMoEAttention layer aggregates latent samples to keep end-to-end gradients. Multi-horizon forecast heads map latent dynamics...

πŸ‘‰ Read | Forum | @mql5dev
❀20πŸ‘11πŸ‘Œ2πŸ”₯1🀩1
MQL5 ships without unit testing tools, so many EAs rely on manual log inspection. That approach misses β€œcorrect-looking” math bugs that only appear with specific inputs, quietly skewing risk and sizing over time.

The article builds a native, zero-dependency test framework as a script: assertion macros capture file/line via __FILE__/__LINE__, suites are isolated behind an ITestSuite interface, and a central runner aggregates STestResult records and prints a clean pass/fail report to the Experts tab.

It targets common utility failures: floating-point comparisons (ASSERT_NEAR with tolerance), lot-step normalization direction, symbol/digit edge cases, and silent overflow/underflow via sentinel flags (ASSERT_THROWS). The design keeps production math utilities separate from tests, making regression checks practical for traders and MT5 developers.

πŸ‘‰ Read | Calendar | @mql5dev
❀18πŸ‘8πŸ‘Œ2πŸ”₯1
Manual Oops gap reversal marking breaks down when gap size, time validity, and first-fill-only rules must be tracked across long histories. The article implements a custom MQL5 indicator that enforces those rules consistently on completed bars, plotting bullish and bearish arrows via two output buffers.

Detection starts with a β€œgap bar” opening outside the prior bar’s range by a configurable minimum (points scaled by _Point). Confirmation requires a bar close back through the prior boundary; intrabar touches are ignored. Signals can confirm on the gap bar or within a max validity window, but only the first qualifying fill is accepted to prevent duplicates.

The indicator architecture separates an initial historical scan that maps all past signals from an incremental update that recalculates only the latest closed bar, avoiding full-history recomputati...

πŸ‘‰ Read | NeuroBook | @mql5dev
❀17πŸ‘5πŸ”₯4⚑2πŸ‘Œ2🀑2
News spikes can make an MT5 EA fire dozens of OrderSend calls per second, hitting undocumented broker rate limits and causing silent delays or retcode failures. A fixed cooldown avoids this but also suppresses legitimate signals.

CTradeThrottle addresses the problem with a token-bucket limiter: allow short bursts up to a configured capacity, then cap sustained flow by a refill rate. When tokens run out, requests are queued instead of discarded, then released via OnTimer() as tokens return, using priority ordering with FIFO tie-breaks.

The design exposes a clear interface (Submit/Cancel/GetStatus) and separates pacing from execution concerns. It also handles broker-specific filling modes by selecting a supported FOK/IOC/RETURN mode per symbol, while leaving validation, price refresh, and fill tracking to a dedicated execution layer via OnTradeTransaction().

πŸ‘‰ Read | NeuroBook | @mql5dev
❀17πŸ‘7πŸ”₯3🀩3🀑3πŸ‘Œ2
The indicator search panel is extended from β€œfind and attach” to β€œconfigure then attach,” removing the detour into MetaTrader’s properties window. After selecting an indicator, a parameter dialog appears first, then the indicator is created with those inputs.

The core design is metadata-driven: each input is described by a parameter definition (name, type, defaults, ranges, enum text/codes). A centralized repository maps ENUM_INDICATOR values to arrays of these definitions, covering 30+ built-ins and cleanly handling indicators with zero inputs.

A single dynamic dialog builds controls at runtime from metadata, reads user edits, validates ranges, and converts values into an MqlParam array. The chart launcher is updated with an AttachIndicator overload that accepts MqlParam, preserving existing default behavior and improving workflow for traders and MT...

πŸ‘‰ Read | Calendar | @mql5dev
❀61πŸ‘16✍5πŸ‘¨β€πŸ’»5πŸ‘€4πŸ”₯2πŸ€”1