MQL5 Algo Trading
575K subscribers
4.47K photos
7 videos
4.48K 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
An MT5 Expert Advisor executes fair value gap entries only when aligned with confirmed market structure. It consumes the same structure classes used by the companion indicator via SmcMarketStructure.mqh, ensuring the EA’s decisions match what is shown on chart without reimplementing the structure engine.

Longs require four conditions: uptrend with the last break as BoS, FVGs scanned only within the current leg up to the break bar, the leg high confirmed by IDM taking, and price returning into an eligible gap with a minimum retracement depth from B back toward A. FVGs are filtered by position within the leg, discount side relative to the broken level, and minimum size.

Entries trigger on touch at market. Stop sits beyond structure low A with a buffer. Target is R-multiple of risk, with risk-based sizing by default and broker stop-level validation. After CHoC...

πŸ‘‰ Read | Calendar | @mql5dev
❀15πŸ‘7🀩6⚑2πŸ”₯2πŸ‘Œ2
Equity Guard is a risk-management Expert Advisor for MetaTrader 5 designed for equity-based rule enforcement. It does not open trades; it monitors account equity and reacts when configured limits are reached.

Supported controls include a daily loss cap based on a percent of a day-start base and/or a fixed currency amount (stricter limit applied), an overall drawdown limit measured from initial balance or highest-equity trailing mode, plus an optional daily profit target. On trigger, it closes open positions, deletes pending orders, sends alerts (push optional), and can keep the account flat until the next trading day for daily rules or until manual reset for drawdown locks.

Day-start base can be balance, equity, or the higher of the two, with the trading day starting at a selectable server hour. State persists via terminal global variables across restarts, ...

πŸ‘‰ Read | VPS | @mql5dev
πŸ‘12❀7🀩5πŸ”₯3πŸ‘Œ3
Telegram Trade Notifier for MT5 provides account event notifications via Telegram while the terminal is unattended. Attached to a single chart, it reports trade activity without opening, modifying, or closing positions.

Events include position open/close details with origin (EA and magic number, manual, mobile, web), pending order placement/cancel/expiry, and optional SL/TP change alerts. A daily summary at a configured server hour reports closed trades, win/loss counts, realized result, open positions, floating P/L, balance, and equity.

Delivery uses a queued timer-based sender to avoid blocking trade events. Failed sends retry up to five times; non-retriable issues (invalid token/chat ID) are written to the Experts journal. Preview mode is enabled by leaving the bot token empty, showing messages on-chart and in the journal only.

Setup requires a Telegram...

πŸ‘‰ Read | AlgoBook | @mql5dev
❀11πŸ‘8πŸ”₯6🀩5✍2πŸ‘Œ2
Managing grids, averaging baskets, and hedges often means multiple positions per symbol with different entry prices. This indicator calculates and draws the basket break-even levels in real time, updating on every tick.

It plots Buy BE (all buy positions at zero), Sell BE (all sell positions at zero), and Net BE (buys and sells combined at zero, only when both sides exist). A Target line can be set in account currency to show the price where the basket reaches the specified profit.

An info panel displays buy/sell counts and volume, floating P/L, and the calculated basket levels. Calculation is based on aggregated lots and entry prices, optional swap inclusion, and current tick value; cross-currency symbols may be approximate. Spread and commissions are not included, so Buy BE aligns with Bid and Sell BE with Ask.

Planned entries can be added for cal...

πŸ‘‰ Read | AppStore | @mql5dev
❀14πŸ‘10πŸ”₯4πŸ‘¨β€πŸ’»4πŸ‘Œ3🀩2
Backtesting and ML pipelines fail most often at the data layer. Common issues in free CSV exports include mixed timeframes, indicator repainting, and implicit lookahead that only shows up after weeks of work.

Multi‑TF Data Grabber Lite exports deterministic, closed‑bar market data from MT5 to CSV with a frozen time window and zero lookahead. The same inputs produce the same output. If a new bar opens mid‑export, the run restarts with a fresh freeze to avoid partial corruption.

Run flow: open an XAUUSD chart, attach DataGrabber_Lite_v105, set From/To, enable indicators as needed, then start. Progress is shown with chunk, rows, elapsed time, and ETA, then the panel closes.

Output: three CSV files for M1/M15/H1 with 11 columns: time, OHLC, tick_volume, MA20, RSI14, MACD main/signal, ATR14. Files are stored under the terminal data folder in MQL5\Files\DataGrabb...

πŸ‘‰ Read | Signals | @mql5dev
πŸ‘17❀10πŸ”₯7🀩3πŸ‘Œ3⚑1
A compression-channel indicator tracks low-volatility stretches where ranges contract and closes cluster. It flags compression in real time, draws a gray channel after it persists long enough, then marks the breakout bar. Live channels also include an order-flow style volume split (buy vs sell) so dominance during the squeeze is visible.

Compression is detected by normalizing closes into the last 100-bar high/low range and monitoring the 14-bar standard deviation. A compression starts when the most recent extreme is the lowest deviation; a channel is confirmed when the high reappears after 10+ bars. Bands are sized at 0.5 ATR at formation, with optional nested channels.

Breakouts require either candle body midpoint beyond the channel edge or close-only logic. Arrows are exposed via buffers (10 bullish, 11 bearish) for EA access. Volume readouts suppo...

πŸ‘‰ Read | AlgoBook | @mql5dev
πŸ‘15❀13🀩10πŸ”₯8πŸ‘Œ2πŸ†1
BUZOA is a PSO-derived population optimizer that replaces a fixed velocity update with stochastic mode switching per agent. Each step selects one of three behaviors, changing the exploration/exploitation mix without adding extra state variables.

Agents maintain position L and an ability vector C (velocity-like), with pBest and gBest tracking. C is clamped to [-Cmax, +Cmax], where Cmax is half the search-range width per dimension. Position is updated by L = L + C, with boundary clipping and inertia damping via alpha1 *= wDamp.

Mode 001 updates C using inertia plus a pull to pBest. Mode 010 adds additional pBest and gBest attraction terms, increasing global movement pressure. Mode 100 resets: L is re-randomized over the full domain and C set to zero, acting as a built-in escape from local optima.

πŸ‘‰ Read | Quotes | @mql5dev
πŸ‘15❀12πŸ”₯10🀩6πŸŽ‰1πŸ‘Œ1
This article automates Head and Shoulders in MT5 by validating market structure, not just three similar peaks. A swing engine labels higher-timeframe swings (HH/LH/HL/LL), and the detector enforces the required sequence: head must be HH, left trough HL, right shoulder LH, with strict time ordering and bar-count width using iBarShift().

Risky lookalikes are filtered via ATR-scaled rules for head clearance, shoulder symmetry, and minimum pattern height. The neckline is a stricter horizontal level (lower trough), while breakout timing is checked on the EA chart timeframe via a close beyond the neckline.

A small state machine separates detection, lock, breakout monitoring, and trade lifecycle to prevent duplicate entries and stale setups. The same framework supports inverse patterns, with points standardized across broker constraints and execution.

πŸ‘‰ Read | NeuroBook | @mql5dev
❀22🀩13πŸ‘10πŸ”₯5πŸ‘Œ1πŸ†1
Part 6 adds CurveTo support using cubic BΓ©zier flattening, without modifying the rasterizer or edge builder. Curves are converted into line segments at path build time, keeping downstream code unchanged but losing analytic data for later transforms and metrics.

A cubic BΓ©zier is defined by P0..P3, follows end tangents along P0β†’P1 and P2β†’P3, and remains inside the convex hull. Flatness is tested by summing perpendicular distances from P1 and P2 to the chord P0β†’P3 using a 2D cross product.

Subdivision uses De Casteljau midpoints at t=0.5, producing two exact half-curves per split. Recursion appends only the endpoint, preserves left-to-right order, and uses a depth cap as a guard against non-terminating input.

πŸ‘‰ Read | VPS | @mql5dev
πŸ‘9❀7🀩7πŸ”₯4πŸ‘Œ2
Builds a session volume profile for MT5 from tick data, not bar-based TPO, so aggregation is accurate but performance-critical. The design keeps OnCalculate incremental and shifts all drawing to an OnTimer loop with three states: full rebuild after session-bound edits, full redraw on chart moves or new volume maxima, and partial updates for live ticks.

State is stored in hash-based buckets for O(1) access, plus an update set to redraw only touched price levels. Bucket sizing can be ATR-driven or manual.

Rendering uses pixel-space OBJ_RECTANGLE_LABEL bars for precise proportional widths, with draggable start/end vlines, multi-instance IDs to avoid object collisions, and an optional POC line that tracks the highest-volume price.

πŸ‘‰ Read | Calendar | @mql5dev
πŸ‘10πŸ”₯7πŸ‘Œ3🀩2❀1πŸ‘€1
Math engines are often treated as drop-in equivalents. A benchmark using an 8-16-8-1 MLP forward pass compared three MQL5 paths: native matrix/vector double, ALGLIB CMatrixDouble, and ONNX Runtime via OnnxRun().

Weights and test vectors were generated once in Python using float64, then reused unchanged. Each engine ran the same inputs, with outputs checked against the Python float64 reference and latency measured per call in microseconds, including p95 and p99.

Results show native and ALGLIB matching the reference to machine precision, while the ONNX path degrades accuracy and time due to its default float32 tensors and explicit input casts. The harness is diagnostic only and contains no trading logic.

πŸ‘‰ Read | Quotes | @mql5dev
πŸ‘11❀7🀩4πŸ†3πŸ‘Œ1
Static prompts in LLM-driven Expert Advisors fail because market regimes change faster than manual prompt iteration cycles.

Metaprompting treats the prompt as a trainable component. A separate optimizer LLM generates prompt revisions, tests them against realized trade outcomes, and promotes the best version to production.

A practical architecture splits responsibilities: an execution agent returns BUY/SELL plus confidence from OHLCV and indicators; an evaluator converts closed-trade results into metrics (directional accuracy, profit factor, R-multiple, flat rate); a meta-LLM updates the prompt on schedule or when metrics degrade. MQL5 can call a local Python service over WinHTTP without third-party DLLs.

Example backtest (EURUSD M15, Mar–Apr 2026) showed 99 trades, 1.35 profit factor, 2.77 Sharpe, and low drawdown, with limits noted around data l...

πŸ‘‰ Read | VPS | @mql5dev
πŸ‘9🀩7❀6πŸ”₯4πŸ‘Œ1
A multi-indicator trading strategy combines RSI, Parabolic SAR, Heiken-Ashi, Stochastic, CCI, Williams %R, and Bulls/Bears Power to align trend, momentum, and reversal signals.

Trend filtering is typically handled by Heiken-Ashi candles and SAR direction. Momentum confirmation can be taken from RSI and Stochastic crossing key levels, while CCI and Williams %R help detect overbought/oversold conditions and short-term exhaustion.

Bulls and Bears Power are often used to validate whether buyers or sellers are gaining control, reducing reliance on any single indicator. Practical implementation usually requires strict entry rules, a volatility-aware stop, and limits on conflicting signals to avoid overfitting.

πŸ‘‰ Read | AppStore | @mql5dev
πŸ‘15❀10🀩5πŸ”₯3πŸ‘Œ1
The Pro version targets development teams that require tighter control over execution and a broader toolset for building, testing, and deploying automated trading logic.

Key additions typically include advanced debugging and profiling, richer configuration for strategy parameters, and extended options for managing data feeds and symbol specifications. Deployment workflows are expanded with more granular environment separation and improved logging for incident review.

Licensing is generally structured for commercial usage, with clearer terms around redistribution, support coverage, and long-term maintenance. Suitable for production setups where reproducibility, auditability, and predictable updates matter.

πŸ‘‰ Read | Forum | @mql5dev
πŸ‘9πŸ”₯8❀7🀩4πŸ‘Œ1
MultiIndicatorDivergence adds a compact divergence panel that aggregates signals across timeframes, from M1 through monthly.

The panel compares price action against multiple indicators to flag disagreements commonly used as early reversal warnings. Each cell represents an indicator such as RSI, MACD, plus additional oscillators.

Color output is simplified: green indicates potential upward pressure, red indicates potential downward pressure, and dark indicates no actionable divergence at the moment. A higher count of the same color suggests broader indicator alignment.

Layout includes six columns covering the current bar and the prior five bars, enabling quick verification of whether divergence is emerging, persisting, or fading. This is a decision-support aid and does not replace risk controls.

πŸ‘‰ Read | Signals | @mql5dev
πŸ‘16❀12🀩6πŸ”₯4✍1πŸ‘Œ1
CNewsFilter provides a single decision point for EAs: whether the current time falls into a configured news blackout window. It reads the built-in MT5 economic calendar, filters by selected currencies and minimum importance, and blocks trading minutes before and after each release.

Integration focuses on a small API: SetCurrenciesFromSymbol(symbol) for base/profit/margin currencies, or SetCurrencies("USD,EUR"). Use SetImportance(low/moderate/high) and SetWindow(before, after). IsNewsTime() returns true inside the window. CurrentEvent() and NextEvent() expose event name, currency, and time for UI panels. Total() and Event(i) return the loaded events sorted by time. SetRefresh(seconds) and SetLookAhead(hours) control cache refresh and horizon.

Operational notes: no web requests, DLLs, or terminal permissions. Times are trade-server time (TimeTradeServer()). O...

πŸ‘‰ Read | VPS | @mql5dev
πŸ‘18❀9πŸ”₯8🀩7πŸ†2πŸ‘Œ1
Expert Advisors tag trades with a magic number. Magic Number Scorecard groups closed account trades by magic number to produce one result line per EA; magic 0 represents manual trading. This provides a fast view of which systems generate net results versus volume.

Per magic number, the report includes trades, wins, losses, win rate, gross profit, gross loss, profit factor, net profit, average trade, best and worst trade, maximum drawdown based on the closed-trade equity curve, and symbols traded. Rows are sorted by net profit.

Counting rules: one trade equals one closed position. All related deals are aggregated, including profit, swap, commission on entry and exit, and fees. Partial closes still count as one trade. Ownership is taken from the opening deal’s magic number, so manual closes remain attributed to the originating EA. Open or partially open positio...

πŸ‘‰ Read | Freelance | @mql5dev
πŸ‘15πŸ”₯8❀7🀩6πŸ‘Œ3πŸ‘¨β€πŸ’»1
MTF Trend Context [Vian] is a compact MT5 panel that reports trend state across five selected timeframes and summarizes alignment as ALL BULLISH/BEARISH, MOSTLY BULLISH/BEARISH, or MIXED.

Trend classification uses a single EMA rule per timeframe: Bullish when Close > Fast EMA > Slow EMA, Bearish when Close < Fast EMA < Slow EMA, Neutral otherwise. Default EMA lengths are 20 and 50, both configurable with Slow required to remain greater than Fast.

Each row is evaluated on the most recently closed bar of its own timeframe (shift 1), avoiding the current forming candle. Data readiness is validated before display; missing history or incomplete EMA calculations are shown as N/A rather than inferred.

Presets cover Scalping, Intraday, and Swing, plus a five-timeframe Custom set. If any row is N/A, alignment is not upgraded and remains MIXED with a count of...

πŸ‘‰ Read | Freelance | @mql5dev
πŸ‘12❀5πŸ”₯4🀩3
A risk-check script estimates worst-case gap losses for all open positions ahead of weekend or holiday closures. It sums the projected losses and compares them with the remaining room under the next trading day’s daily loss limit.

Output includes the next day’s limit in account currency, the floating loss carried over, and per-position details: symbol, side, lots, configured gap for its group, and the loss that gap implies. A final verdict flags OK or TOO MUCH, including a per-position reduction amount.

Key point: stop-loss orders do not cap gap risk, since fills occur at the first available price after the gap.

Inputs cover account size (or current balance), daily loss limit and safety margin, whether carried floating loss counts against the next day, per-asset gap percentages (FX, metals, indices, crypto, other), and symbol group matching via name fr...

πŸ‘‰ Read | Signals | @mql5dev
❀6πŸ‘4πŸ”₯3🀩1
MarketInfo is an information script for MetaTrader 5 that logs key telemetry for the active instrument and outputs a chart comment for quick review.

It reports current Bid, Ask, and spread in pips, along with symbol parameters such as minimum and maximum lot size, lot step, and price digits.

Volatility is calculated using ATR for a configurable period. The script also shows the time remaining until the current bar closes to support timing-sensitive execution and monitoring.

For a user-defined number of recent bars, it aggregates high, low, average close, average volume, and average range. A simple classification marks the current state as upward, downward, or sideways based on recent price behavior.

πŸ‘‰ Read | Docs | @mql5dev
πŸ‘3❀1πŸ”₯1