MQL5 Algo Trading
575K subscribers
4.46K photos
7 videos
4.47K 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
Part 9 adds a Trade Activity Auditor for MetaTrader 5 that captures account-level trade changes, not just actions taken by one cooperating EA. It uses OnTradeTransaction() to log distinct stages—requests, order updates, deals, position changes, and history transitions—without collapsing them into a single “trade” record, preserving evidence when callbacks arrive out of order or within the same second.

When the terminal was offline, it recovers missing context by scanning a configurable history window and appending ORDERS/DEALS not already journaled, marking rows as LIVE vs RECOVERED. The design separates responsibilities into modules: typed records, CSV journal with strict validation and export, transaction/history translation, and a chart panel for period summaries.

Practical benefits: reproducible trails for debugging multi-EA accounts, clearer attribution o...

👉 Read | Signals | @mql5dev
❤17👍13🔥7🤩5🏆3👨‍💻2👀1
STE-FlowNet treats price action as an event stream rather than aggregated candles, preserving where/when order imbalance appears. This reduces response latency, avoids information loss from averaging, and captures spikes and underlying trend in one representation.

The article continues the implementation by adding an SEW-style residual block built for stability in spiking networks. The block is encapsulated as an OpenCL-backed class with a clean forward pass that chains submodules and merges the result with the original input for reliable gradient flow.

It then builds a full Flow Decoder as a separate component with two parallel paths (main features and flow), using transposed convolutions, skip connections, and encoder latent states (via ConvGRU) to reconstruct detailed spatiotemporal flow maps. Practical outcome: real-time micro-movement tracking that can feed ...

👉 Read | NeuroBook | @mql5dev
👍12❤7🔥5🤩3👌3
Renko forecasting moved from CatBoost classification to regression to predict the next bar’s log-return, not only direction. This yields a continuous score usable for signal filtering and a 95% interval from OOF residual variance.

The core issue is forecast bias. A two-step fix is used: a residual cascade trained on honest TimeSeriesSplit OOF errors, then conditional bias correction split by sign (bull vs bear) with an MAE degradation guard.

Daily EURUSD (2024–2025) uses adaptive brick_size via 0.5×ATR(14) (~0.004). Features describe the last 10 Renko bars (25 fields). The cascade accepted one residual stage; OOF-MAE improved 0.001306→0.001262, R² to 0.718, while direction accuracy stayed ~64–65%.

A MetaTrader 5 script turns forecasts into orders with spread filtering, 2-brick SL, 3-brick TP, and 0.5% balance risk sizing, with explicit dry-run and trade...

👉 Read | Forum | @mql5dev
❤22👍10🤩7🔥5👨‍💻2👌1
This article builds an MT5 indicator that treats changing market cycles as chirps (frequency drifting within the window) and uses the Fractional Fourier Transform to detect them by searching for the rotation order where energy becomes most concentrated.

Two common implementation traps are addressed: directly sampling the FrFT kernel breaks unitarity in the discrete case, and real-valued inputs make the entropy objective symmetric around a=1, destroying chirp-rate sign. The solution is a unitary FrFT built from DFT eigenvectors plus an analytic-signal step to preserve direction.

Per bar, the code detrends, computes the analytic window, runs a golden-section search minimizing Rényi entropy, and derives a chirp-rate estimate plus a causal cycle reconstruction from a narrow peak band. A “focus gain” metric filters low-confidence windows. Synthetic tests lo...

👉 Read | AppStore | @mql5dev
❤24👍16🔥6👌3✍2🤩2
Online Portfolio Selection replaces batch estimation with sequential updates and a regret guarantee versus the best constant rebalanced portfolio (BCRP) chosen in hindsight. It assumes strictly positive, bounded price relatives and enforces a floor to keep log-wealth defined.

Several allocators share a core primitive: exact Euclidean projection onto the long-only simplex (Duchi 2008). EG stays on-simplex via multiplicative updates; Cover’s universal portfolio mixes constant portfolios, with practical implementations relying on finite sampling and showing strong seed sensitivity at low sample counts.

Mean-reversion methods (PAMR, OLMAR) use thresholds and moving-average predictions, with edge cases like zero-variance updates and warmup handling affecting reproducibility. BCRP is computed via projected gradient ascent and verified against closed-form...

👉 Read | Signals | @mql5dev
❤21👍11🔥9🤩6👌2💔2
Price series often contain multiple simultaneous cycles. Single-timeframe tools tend to isolate one band and suppress the rest.

A diagnostic MQL5 indicator is outlined to render a live Hilbert Spectrum via the Hilbert-Huang Transform. Empirical Mode Decomposition (EMD) extracts IMFs without a fixed basis, then Hilbert spectral analysis converts each IMF into per-bar instantaneous amplitude and frequency.

Implementation details include EMD sifting with cubic-spline envelopes solved via a tri-diagonal Thomas algorithm, SD-based convergence and iteration caps, plus a 65-tap windowed-FIR discrete Hilbert transform due to missing native analytic-signal support.

Per-IMF phase unwrapping enables instantaneous frequency, and a CCanvas heatmap bins energy into a time-frequency matrix in a separate subwindow, recalculated on bar close for cost control.

👉 Read | NeuroBook | @mql5dev
❤16👍12🤩9🔥4👌3👀1
This article translates two Linda Raschke swing setups into a single MT5 Expert Advisor optimized for H1/H4, where signal timing and stop precision matter more than multi-week patience.

The EA implements the 3/10 oscillator as an SMA-based MACD variant computed directly from price arrays, enabling the “Anti” pattern: wait for the signal line to cross zero, require a true pullback where the fast line touches/crosses the signal line, then take only the first reversal cross with a bar-close direction check. Stops track the pullback extreme; exits use an opposite oscillator cross.

For “Holy Grail,” entries require ADX ≥ 30 and strengthening over two bars, a 20-EMA slope filter, and the first pullback that touches the EMA, with exits on ADX breakdown or an adverse EMA close. Two independent state machines share one EA, include restart-safe position recovery, and...

👉 Read | VPS | @mql5dev
❤26👍12🔥9🤩8👌1
Prop Firm Guard moves beyond showing balance/equity by computing three separate compliance metrics at runtime: daily drawdown from a trader-confirmed equity baseline, overall drawdown from the initial challenge balance using a static floor, and profit-target progress from realized balance. Keeping these references independent avoids mixing day-specific risk, challenge-level limits, and growth objectives.

A key design change is readiness-aware states. Each engine publishes results only if all required references and denominators validate; otherwise it stays “not ready” instead of defaulting to SAFE. Helper functions validate financial inputs, classify loss usage with correct severity priority, and reset states deterministically.

The EA then combines the three engines into one guard status: missing data forces NOT_READY, and risk states always outrank target ...

👉 Read | AppStore | @mql5dev
👍19❤9🔥8🤩4👌1
This article rebuilds Market Profile for modern regimes without breaking Steidlmayer’s auction logic. It targets MT5 integration by using real tick trades with aggressor flags for exchange symbols (CopyTicksRange), plus a bar-based proxy for Forex.

Three structural flaws are addressed: single VA/POC in bimodal sessions, no aggressor context per level, and zero cross-session memory. Fixes include pairwise VA expansion, bimodality detection with a dead-zone and secondary POC, and a Delta Profile that tags absorption when delta is extreme at the POC.

A composite “market memory” layer adds exponentially decayed profiles, extracting HVN/LVN and tracking naked POCs efficiently via a triangular approximation, delivered as modular, performance-focused MQL5 components.

👉 Read | Calendar | @mql5dev
👍13🤩11🔥8❤4👌1
This article turns a higher-timeframe candle into an explicit event sequence by modeling four context candles (A-B-C-D) and validating what happened inside them using lower-timeframe bars. A-B is fully closed before D starts and defines direction via a small set of strict, explainable relationships (continuation, reversal with sweep+recovery, or inside-bar compression).

C is not a visual pattern; it is accepted only if trigger-timeframe bars show a buffered retest of the reference level plus a structure break, with displacement filtered by a minimum body-to-range ratio. Compression is handled as a three-step breakout, retest, then break, with a fixed first-qualifying direction.

D provides a closed-bar confirmation window: a completed trigger bar must close beyond C’s extreme plus buffer, while invalidation is based on closes crossing protected levels. The E...

👉 Read | VPS | @mql5dev
👍14❤7🤩7🔥5⚡1👌1
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
❤13🤩6👍4🔥2⚡1👌1
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
👍7🤩5❤4🔥3👌1
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
❤8👍5🔥5🤩4👌1
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
❤10👍8👨‍💻4🔥3🤩2👌1
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
👍14❤6🔥4🤩1👌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
❤8👍3🔥2🤩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
❤3👍2