MQL5 Algo Trading
560K subscribers
4.15K photos
6 videos
4.16K 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
Running multiple MQL5 Expert Advisors in one terminal means no shared state beyond GlobalVariables. That namespace is untyped, schema-free, and cannot distinguish stale from current values.

A named-pipe message bus provides explicit message framing and a fixed, typed schema agreed by all participants. The broker EA owns the pipe server, message registry, risk aggregator, and a chart dashboard. Slave EAs connect as clients, report per-magic position state, and receive a centrally computed portfolio risk figure plus the symbol identified as the cause.

Implementation details matter: kernel32.dll imports, message-mode pipes, non-blocking accept via PIPE_NOWAIT, and connection confirmation via PeekNamedPipe due to unreliable last-error reads in MQL5. Messages serialize to a fixed 52-byte little-endian layout, with doubles copied bit-exact.

Limits remain expl...

πŸ‘‰ Read | CodeBase | @mql5dev
❀13πŸ‘4πŸ”₯2🀣2
Supertrend MTF Indicator is a free multi-timeframe trend tool for MT4. It plots bullish and bearish conditions on the chart using colored Supertrend lines and signal arrows.

Key capabilities include multi-timeframe trend confirmation, Buy/Sell arrow signals, and parameter controls for adapting sensitivity. It can be applied to Forex, Gold, indices, and other MT4 instruments, across different chart timeframes.

This is a visual indicator only and does not place or manage orders. An Expert Advisor based on the same Supertrend MTF logic is available separately for automated execution, while the indicator source is suited to manual analysis, education, and custom modifications.

Any trading tool should be validated on a demo account before live use.

πŸ‘‰ Read | Signals | @mql5dev
πŸ‘11❀9πŸ”₯5🀩3πŸŽ‰2πŸ‘¨β€πŸ’»2🀣1
A Renko indicator for MT5 that renders fixed-size bricks using BID ticks and outputs only completed bricks. Reversal logic follows the classic two-brick rule, with square, equal-width brick rendering.

The chart window is used only as a host. Visible brick count is calculated automatically, the Renko range is vertically centered, and the real price scale remains on the right.

Implementation avoids offline charts, custom symbols, DLLs, and external libraries. A single primary input is used: Brick Size. Original chart visual settings are restored after removal.

Published as a CodeBase example aimed at studying Renko construction and MQL5 Canvas rendering.

πŸ‘‰ Read | Calendar | @mql5dev
❀19πŸ‘6πŸ”₯2🀣2πŸ‘¨β€πŸ’»2🀩1
Incoming BID ticks are routed to a classic Renko builder using a two-brick reversal rule. ADX, +DI, and -DI update only after a brick is completed. ADX acts as a strength gate, while +DI/-DI restrict trade direction. Entries require the newest completed brick to confirm direction and meet the configured Renko run. Exits can be requested by opposite DI, plus virtual TP/SL and a maximum holding time.

Default demo profile: brick size 16, ADX(14) threshold 8.5, min DI separation 2.5, entry run 3 bricks, TP 9.5 bricks, SL 42 bricks, max hold 1060 minutes, cooldown 6 bricks, max spread/brick 0.35, lot 0.01.

Real-tick test: XAUUSD M1, 2026-05-01 to 2026-09-08, 100% quality, 48,458,994 ticks. 46 trades, net +$1,095.53, PF 3.14, max equity DD 1.36%. Educational backtest only; outcomes depend on symbol specs, tick data, spread, execution, and broker conditions....

πŸ‘‰ Read | Forum | @mql5dev
❀21πŸ‘5πŸ‘Œ2πŸ”₯1🀣1
A Renko + Bollinger EA design ships with four modes enabled by default: Breakout (brick close beyond outer band), Re-entry/mean reversion (outside then back inside), Midline Cross (state change on middle line cross), and Squeeze Breakout (band-width filter before accepting breakout). Each mode has its own demonstration profile: brick size, Bollinger period/deviation, entry run, TP/SL in bricks, max hold time, and cooldown.

Portfolio controls allow per-mode enable/disable, one position per mode on hedging accounts, and an effective single net position per symbol on netting accounts. An optional conflict filter skips entries when modes signal opposite directions on the same tick. Separate magic numbers identify which mode opened a position after restarts.

A historical educational run on XAUUSD M1 (2026-05-01 to 2026-09-08, real ticks) reported 108 trades wit...

πŸ‘‰ Read | AppStore | @mql5dev
❀21πŸ‘6✍1πŸ”₯1🀣1
New CodeBase indicator example demonstrates custom Renko brick rendering with a causal Bollinger Bands overlay.

Parameters include Brick Size in price units, Bollinger lookback measured in completed Renko bricks, and the standard-deviation multiplier.

Rendering uses cyan up bricks and red down bricks, with blue outer Bollinger bands and a gold middle band. Bricks are square with automatic scaling. Drawing is handled through a single Canvas bitmap layer rather than large sets of rectangle objects, with automatic redraw on chart resize.

No DLLs, custom symbols, offline charts, or external indicators are required. Intended for education and implementation reference only, with no trading signals and no performance claims.

πŸ‘‰ Read | Docs | @mql5dev
❀17πŸ”₯5πŸ‘3🀩2🀣1
A Renko statistics panel is available for monitoring recent price action using only completed bricks and the classic two-brick reversal rule.

Displayed metrics include up/down brick counts with percentages, directional balance, reversal rate, average and maximum run length, current run direction with length, bricks formed per hour, and average minutes per completed brick.

Key inputs are Brick Size (fixed Renko brick size in price units) and Lookback Bricks (number of recent completed bricks used to compute statistics).

Implementation does not create offline charts or custom symbols and requires no DLLs or external indicators. The tool is intended for educational and statistical use, provides no BUY/SELL signals, and makes no claims of predictability or future profitability.

πŸ‘‰ Read | Signals | @mql5dev
❀18πŸ‘4🀩4πŸ”₯2🀣1
Renko charting is rendered on a sequence axis rather than time. The internal Renko builder consumes incoming BID ticks and applies the classic two-brick reversal rule.

The Donchian Channel is calculated causally. On each newly completed brick, upper and lower bounds are derived only from the previous N completed Renko bricks. The active brick is excluded from its own channel window. Inputs include fixed Brick Size in price units and Donchian Period as the lookback in completed bricks.

Implementation details include an internal fixed-size Renko, square bricks, and stepped Donchian boundaries with a midpoint. Rendering uses a single CCanvas bitmap layer instead of many chart objects, with no offline chart, custom symbol, DLL, or external indicator dependencies.

Provided as an educational visualization, not a trading system or a recommendation to trade br...

πŸ‘‰ Read | Signals | @mql5dev
❀14πŸ‘9πŸ”₯5🀩5🀣2⚑1
This update to the MT5 replay/simulation position indicator adds switchable display modes so traders can avoid focusing on monetary P/L while still monitoring risk during volatile periods.

A scoped enum inside the position structure defines modes (money, ticks, points, percent), letting the ViewValue routine format output via a clean switch and scope resolution. An extra β€œticks-to-price” support value is computed once and passed into the class to keep formatting fast and consistent.

Mode changes are triggered by clicking the OBJ_EDIT field: a custom event cycles the enum and forces a refresh of all indicator segments (entry, SL, TP) to prevent mixed units. On hedging accounts, updates are isolated per position via a ticket check, with an easy path to broadcast changes if desired.

πŸ‘‰ Read | NeuroBook | @mql5dev
❀15πŸ‘8🀩6πŸ”₯4⚑2🀣1
This article digs into a practical pain point in MQL5 data structures: deleting nodes in a binary tree without corrupting links.

It starts by showing how traversal output (pre-order and post-order) can be used to reconstruct the tree shape, and why a small change in traversal logic produces different sequencesβ€”so reading output without checking the traversal code is unreliable.

A search routine is added by adapting the existing insertion-walk to return a node address. The article also highlights how seemingly equivalent loop conditions can trigger crashes due to compiler/short-circuit behavior, reinforcing the need for precise pointer checks.

Deletion is introduced with the simplest case: removing a leaf. The key rule is updating the parent’s child pointer before freeing memory; otherwise later traversals follow dangling pointers. An iterative de...

πŸ‘‰ Read | Calendar | @mql5dev
πŸ‘10🀩8❀6πŸ”₯4πŸŽ‰1
Nicolas Darvas’ box method can be coded with clear rules, but automation tends to fail on two mechanics: rolling box replacement and staircase pyramiding with a shared stop.

This EA confirms a box after a new N-bar extreme, three consecutive sessions without exceeding the top, contracted average volume, and a minimum height filter. Entry triggers only when the close breaks the box boundary with breakout volume above the box average by a configurable multiplier.

Trade management is state-driven. Each subsequent breakout adds a new unit, moves all stops to the latest box floor, and closes all units together on a stop violation. A stall timer exits if no new box forms within a set bar count.

Known constraints include repeated top resets on tight ranges, tick-volume calibration per broker, and premature exits in strong trends when no new box forms.

πŸ‘‰ Read | Forum | @mql5dev
❀13🀩6πŸ”₯3πŸ‘€3πŸ†1
Pure MQL5 logistic regression built from scratch: no Python bridges, ONNX, DLLs, matrix classes, or external libraries. The core is a single-neuron classifier that maps a standardized feature vector to a probability via a numerically stable sigmoid, trained with stochastic gradient descent using cross-entropy where the gradient reduces to (prediction - label) * input.

The article emphasizes evaluation discipline over model complexity: standardize using only the training segment to prevent look-ahead leakage, split history into train/test blocks, and compare against a majority-class baseline.

Results illustrate why this matters: a small out-of-sample lift on EURUSD, but underperformance on XAUUSD, showing that clean testing can reveal when β€œworking” ML has no tradable edge.

πŸ‘‰ Read | VPS | @mql5dev
❀13🀩5πŸ‘Œ4
MSB Pro ALGO Neon Account Dashboard is a free on-chart account monitoring panel for MetaTrader 5. It shows key metrics including balance, equity, floating P/L, today’s realized P/L, closed trades today, daily win rate, open positions, and BUY/SELL counts.

The open positions table lists up to five entries with symbol, side, volume, open price, and current P/L. When more positions exist, an additional count is shown. Market open/closed status is derived from the attached symbol’s trading session. Data refresh runs automatically every second.

The tool is read-only and contains no trade execution or strategy logic. It works on demo and live accounts without DLLs, external APIs, or extra files. Settings include panel X/Y placement, refresh interval, max rows, table visibility, and color customization.

πŸ‘‰ Read | CodeBase | @mql5dev
❀13πŸ‘Œ3πŸ‘2πŸ‘¨β€πŸ’»2✍1🀩1
Beetle Swarm Optimization (BSO) merges Beetle Antennae Search (two-point probing without gradients) with Particle Swarm Optimization to reduce sensitivity to the initial point and improve performance on rugged, multi-dimensional objectives.

Each beetle maintains position, velocity, personal best, and a shared global best. Per iteration it samples fitness at two antenna tips aligned with velocity, converts the better side into a BAS increment, updates velocity via PSO (inertia + cognitive/social pulls), then blends both moves using a Ξ» coefficient to switch from pure BAS to pure PSO.

Exploration-to-exploitation is handled by linearly decreasing inertia and exponentially shrinking antenna step size and spacing.

The MQL5 implementation fits a standard Moving/Revision test bench using a phase-driven state machine, because each logical step needs three fitn...

πŸ‘‰ Read | Docs | @mql5dev
❀14πŸ‘13🀩7πŸ”₯6
MSB Pro ALGO Position Risk Monitor is a free visual risk monitoring indicator for MetaTrader 5. It evaluates currently open positions and renders stop-loss risk metrics directly on the chart, using broker symbol specifications and platform profit calculation functions.

The panel reports total known open risk, account risk percent (based on equity, with balance fallback), counts of positions with and without stop loss, total positions, total lot size, protected/breakeven stop-loss count, and maximum single-position risk. It also shows a per-position table with symbol, side, lot size, stop price, monetary risk, risk percent, and a LOW/MODERATE/HIGH status.

Positions with stop loss at or beyond entry are treated as protected with zero remaining entry-to-stop risk. Positions without stop loss trigger an unbounded downside warning while known stop-defined...

πŸ‘‰ Read | NeuroBook | @mql5dev
❀9πŸ”₯9🀩9πŸ‘8
HimNet tackles forecasting in trading data where behavior shifts across venues and over time, making β€œone model fits all” averages unreliable. It learns spatial and temporal context directly from data, so the model can adapt without relying on external metadata that is often missing or stale.

The core mechanism is trainable embeddings (time-of-day, day-of-week, and per-series location vectors) that form regime clusters. Those clusters query compact meta-parameter pools to generate context-specific weights as mixtures, keeping memory and latency practical.

On top of this, a graph-convolutional recurrent unit uses dynamically generated convolution parameters, letting cross-market influence change with regime. For traders and MT5 developers, this translates into more stable liquidity/volatility forecasts, better execution settings per session/venue, ...

πŸ‘‰ Read | Quotes | @mql5dev
❀20πŸ‘15πŸ”₯10🀩8😁2
DoEasy adds an indicator object layer to standardize storage and reuse of indicators across programs. The base model follows existing library objects: an abstract base with descendants for standard and custom indicators, plus classification by group (trend, oscillator, volumes, arrows) for filtering and sorting.

Library updates include new message indices/text, default indicator object parameters, a dedicated object ID, and enumerations for properties and sort criteria. A new CIndicatorDE class (IndicatorDE.mqh) derives from CBaseObj, adds an explicit destructor for releasing the created handle, and implements full-field equality, including MqlParam structure and array comparison.

Testing wires the object into CBuffersCollection via CreateAC(), uses IndicatorCreate() without parameters for AC, prints object data to the journal, then deletes the objec...

πŸ‘‰ Read | AlgoBook | @mql5dev
❀48πŸ‘14πŸ”₯9🀩7πŸŽ‰5✍1
John Ehlers’ HighPass-LowPass Roofing Filter, described in Cycle Analytics For Traders (p.78), is a roofing-filter variation designed to isolate trend direction by removing unwanted frequency components.

Interpretation is straightforward: readings below 0 indicate a downtrend, while values above 0 indicate an uptrend. Some implementations also color the line to reflect bias, commonly using green for bullish conditions and red for bearish conditions.

Practical signals are typically derived from zero-line crosses and sustained position on one side of 0, rather than single-bar color changes, to reduce noise-driven flips.

πŸ‘‰ Read | Freelance | @mql5dev
❀67πŸ‘21🀩14πŸ”₯8πŸ‘¨β€πŸ’»4πŸ†3πŸ‘€2
Prop-firm equity guard utility targets challenge rule compliance by enforcing account-level risk limits from a single chart instance. It monitors equity in the background and triggers a shutdown sequence before daily or maximum drawdown thresholds are breached.

Daily loss control supports an optional buffer below the firm’s limit, closes all positions, and blocks new trading until the next server-day reset. Maximum drawdown monitoring applies the same logic at the account limit.

On trigger, the kill-switch closes active trades and removes all pending orders across symbols to prevent accidental fills during volatility or spread widening. No multi-chart setup is required; all symbols and timeframes are covered.

For automation, a global flag is set so other EAs can halt execution with a single conditional check.

πŸ‘‰ Read | Quotes | @mql5dev
❀26πŸ”₯6🀩3
Risk Guard is an account-level risk control utility, not a trading system. It never opens positions. A single chart instance can monitor manual trades and other EAs, with each rule configurable or disabled.

Core functions include on-chart risk-based lot sizing using tick value, tick size, and volume step; a daily loss limit that can close all positions and then auto-close any new trades until the next server day, with the lock persisted via a terminal global variable; maximum open positions with newest-over-cap closures; oversized-trade trimming based on actual SL distance; forced stop-loss insertion; and a spread status warning.

Enforcement is triggered via OnTradeTransaction on deal-add for same-tick intervention, with daily P/L computed from closed results since server midnight plus floating P/L, checked on tick and timer. All actions are logged and can ...

πŸ‘‰ Read | Docs | @mql5dev
❀19πŸ‘4πŸ”₯3🀩3πŸ‘Œ3
Position view updates for an MT5 replay/simulation stack focus on robustness and data completeness.

Open-position volume is added to the indicator via an OBJ_EDIT element, favoring X/Y placement over price/time anchoring. Formatting adapts to fractional volumes by suppressing decimals when the value is effectively an integer. Viewport updates are reordered to keep the volume field aligned, and dynamic sizing is adjusted to prevent background clipping.

Object deletion is handled through CHARTEVENT_OBJECT_DELETE. Internal deletes temporarily disable event handling to avoid false recovery. A small helper centralizes this toggle. Segment restoration is refined by allowing a negative sentinel in m_Info.price so missing SL/TP segments recreate only the move handle, not the full segment UI.

πŸ‘‰ Read | NeuroBook | @mql5dev
❀22πŸŽ‰2