MQL5 Algo Trading
548K subscribers
3.93K photos
6 videos
3.94K 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
MetaTrader 5 runs EAs in a single thread; indicators get separate symbol threads. Heavy indicator work can delay tick processing, so parallel compute is typically pushed to DLLs or OpenCL. OpenCL avoids DLL permissions and keeps deployment to one EX5, with compute placed on CPU or GPU.

Neural nets allow parallelism per neuron inside a layer, while layers still run sequentially. This design uses OpenCL kernels with vector ops: FeedForward, output gradient, hidden gradient, and UpdateWeights in a 2D thread space.

Implementation centers on one-dimensional OpenCL buffers, a CBufferDouble wrapper, a COpenCLMy extension for dynamic buffer management, and a CNeuronBaseOCL layer object. Testing highlights that COpenCL::Execute queues kernels, so reads are needed to force completion.

πŸ‘‰ Read | AlgoBook | @mql5dev
❀45πŸ‘10πŸ‘Œ2
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
❀68πŸ‘9πŸ‘Œ4πŸ‘€4😁3πŸ‘¨β€πŸ’»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
❀32πŸ‘6πŸ‘¨β€πŸ’»3πŸ‘Œ2🀣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
❀22πŸ‘4πŸ‘¨β€πŸ’»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
❀23πŸ‘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
❀25πŸ‘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
❀29πŸ‘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
❀17πŸ‘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
❀52πŸ‘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
❀17πŸ‘5πŸ‘Œ2πŸ‘¨β€πŸ’»2
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
❀22πŸ‘8πŸ‘2πŸ†2πŸ‘Œ1πŸ‘¨β€πŸ’»1