MQL5 Algo Trading
568K subscribers
4.25K photos
7 videos
4.26K 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 extends the MT5 MicroStructure Foundation to fix a key weakness in EMA-stack micro-trend scoring: β€œtrend-aligned” bars can be either fresh breakouts or late retracements, yet both look equally strong.

The solution adds a strategy-neutral pullback depth metric using rolling Fibonacci retracement over the last 20 bars, plus a PULLBACK_QUALITY enum and PullbackAnalysis struct. Depth is filtered by ATR-normalized EMA(5/13) alignment to avoid scoring when no trend exists, and it flags structure as strong/healthy/warning/deep/broken based on how much of the prior swing has been given back.

Two context layers improve signal quality: a 60-bar rolling high/low proxy for H1 range position, and lag-1 return autocorrelation to detect brief momentum persistence. An empirical run on 514 NQ M1 NY sessions finds most bars are shallow pullbacks, while autocorr...

πŸ‘‰ Read | AppStore | @mql5dev
❀18πŸ‘8🀩4πŸ”₯2✍1πŸ‘Œ1
Price Action Volumetric Order Blocks MT5 is an open-source indicator for market structure and order block visualisation in MetaTrader 5. It marks confirmed swing pivots, BOS/MSB events, and tracks active bullish and bearish order blocks projected forward on the chart.

The tool estimates buy/sell participation inside each active zone using bar data and tick volume where needed. These figures are analytical estimates rather than exchange-grade order-flow and should be treated accordingly.

Signals are confirmation-based: pivots, structure breaks, and blocks are only shown after the configured confirmation bars close, reducing repaint-style noise from in-progress candles. A compact panel summarises active zones with price range, buy/sell percentages, and volume.

Key inputs cover pivot sensitivity, maximum active zones, projection length, colour palette,...

πŸ‘‰ Read | Quotes | @mql5dev
❀9πŸ‘4🀩4πŸ”₯3⚑1✍1πŸ‘Œ1
Most EA templates still assume one-symbol decision loops. A multi-symbol basket requires explicit data alignment, shared-bar processing, and leg-level execution control.

A basket EA can be built by standardizing each symbol’s close series, running PCA via MQL5 matrix/SVD, and selecting the lowest-variance component as a weight vector. The synthetic spread is the dot product of standardized prices and weights, with deviation expressed as a rolling z-score.

Execution must map basket direction to each leg using weight sign, size each order by abs(weight), and enforce per-symbol min/max/step rules. Orders are sequential, with compensating closes on failure; retcodes must be checked, not only CTrade booleans.

PCA alone does not validate mean reversion, cointegration, or tradability; separate testing is required.

πŸ‘‰ Read | AlgoBook | @mql5dev
❀13πŸ‘7🀩6✍2⚑1πŸ”₯1πŸ‘Œ1
NeonDesk is a manual trading panel for MT5. It does not execute automated entries; orders are sent only via BUY/SELL, and each action requires confirmation before submission.

The panel provides a multi-timeframe bias view (M1, M30, H4, D1), a candle countdown timer selectable independently from the chart timeframe (M1 to D1), current Bid/Ask and candle OHLC, plus an ATR-based SL/TP suggestion for reference only.

Trade controls include lot size and SL/TP as direct price levels in the chart’s format, plus a trailing stop in pips that only tightens risk. BUY, SELL, and CLOSE ALL are limited to the panel’s own trades via a dedicated magic number, isolating other positions.

Safety checks include a one-time risk acknowledgement, pre-trade confirmation showing full order details, validation of SL/TP side and broker minimum stop distance, and warnings on existing ...

πŸ‘‰ Read | VPS | @mql5dev
❀16🀩5πŸ‘4πŸ”₯3πŸ‘Œ1πŸ†1
Price charts give quick visual context, but an EA only sees OHLC series. Market context must be derived from swing sequences, not isolated pivots.

A Market Behavior Analyzer can convert detected swing highs/lows into structured objects with metadata: HH/LH/HL/LL label, move length, bar count, retracement, and links to adjacent swings.

Processing is split into stages: swing detection and enrichment, story evaluation, then rendering. The evaluation focuses on the latest confirmed structure, classifies moves as impulse vs pullback relative to that structure, and marks structure as Intact or Threatened using a retracement threshold.

Visualization stays passive: it reads the evaluated state and displays a compact dashboard plus interactive inspection, without re-running analysis.

πŸ‘‰ Read | Calendar | @mql5dev
❀19⚑6πŸ‘6🀩6πŸ”₯3πŸ‘Œ2
PropGuard 1.02 is an account-level risk manager for prop-firm accounts. A single instance on any chart monitors all positions on the account, regardless of whether they were opened manually or by other EAs, and enforces daily and maximum loss limits by closing positions and deleting pending orders.

Version 1.02 adds money-based exposure caps, an enforced stop-loss requirement, and a per-position risk cap. In testing against real trade logs, two recurring gaps were highlighted: trades left without a stop loss, and single trades consuming most of the daily loss budget. The new rules can close no-SL positions after a grace period and can tighten stops to a fixed monetary risk per trade.

Maximum loss can be measured as static (initial balance), trailing equity (high watermark), or trailing daily balance (floor updated only at daily reset). Exposure limits are e...

πŸ‘‰ Read | AlgoBook | @mql5dev
❀17πŸ”₯5🀩3πŸ‘2πŸ‘Œ2πŸŽ‰1
ST-Expert reframes market forecasting as a regime-adaptive problem, addressing how correlation structures collapse during shocks like COVID-era shifts and policy cycles. Instead of fitting one stable dependency graph, it maintains multiple specialized β€œexperts” that each represent a distinct market behavior.

Regimes are extracted by splitting history into time intervals that maximize structural dissimilarity using Kendall’s tau, solved via dynamic programming (MSGD). Each interval trains an expert graphon: a probabilistic graph generator that models links between assets as connection probabilities, sampled with Gumbel-Softmax to reduce noisy edges.

Training uses episodic learning: one expert forecasts while a gating network learns to mix the remaining experts to reproduce the active regime. At inference, the gate weights experts from live signals,...

πŸ‘‰ Read | Calendar | @mql5dev
❀20πŸ‘4🀩4πŸ‘Œ2πŸ”₯1πŸŽ‰1
This article builds an MQL5 dashboard to answer a practical question: how trade holding time relates to net profit in a specific account, beyond aggregate win rate.

A script extracts every closed trade, recovers true open time via position ID, computes duration in minutes, and calculates net P/L including swap and commission. Results are plotted as a CCanvas scatter plot (one dot per trade), colored by symbol, with a per-symbol summary table.

It overlays a least-squares regression (slope, intercept, RΒ²) to quantify the overall duration-profit trend, and adds a simple short/medium/long bucket analysis to surface ranges that outperform even when a single line is misleading. A log-scaled duration axis keeps long-tail hold times readable while preserving β€œprofit per minute” on linear data.

πŸ‘‰ Read | NeuroBook | @mql5dev
❀13πŸ‘8πŸ”₯2πŸ‘Œ2🀩1
APARCH support is added to the MQL5 volatility library as CAparchProcess under CVolatilityProcess, targeting cases where fixing the power term delta constrains estimation. Standard ARCH-family models predefine the exponent, which can mask better-fitting transformations and interact with asymmetry terms.

APARCH jointly estimates delta with omega, alpha, beta, and gamma. Delta governs whether dynamics align closer to squared or absolute residuals, consistent with the Taylor effect evidence that intermediate powers often retain stronger autocorrelation than squares. Gamma is bounded in (-1, 1) to keep the shifted shock term valid under fractional powers.

Implementation details include VOL_APARCH registration, new ArchParameters fields (aparch_delta, aparch_common_asym), a dedicated aparch_recursion() using raw residuals, repacking logic for fixed delta or...

πŸ‘‰ Read | AppStore | @mql5dev
❀14🀩9πŸ”₯7πŸ‘4😁1πŸ‘Œ1
Market behavior rarely fits a single variable; meaningful models require joint distributions that capture how multiple assets and factors move together.

The article lays out multivariate CDF/PDF mechanics, emphasizing that marginals are only projections: knowing each series’ standalone distribution cannot reconstruct dependence. Singular joint structures matter in practice because they reveal hard constraints, including deterministic links between instruments.

Dependence is formalized via factorization: independence holds only when the joint distribution equals the product of marginals, making conditional and unconditional distributions identical. This reframes independence as β€œcontext adds no information.”

Conditional distributions lead directly to conditional expectation as the regression function. Many forecasting and ML models can be viewed as approxima...

πŸ‘‰ Read | Calendar | @mql5dev
❀14πŸ‘10πŸ”₯8🀩5πŸ‘Œ1
Price windows can be compressed into fixed-length words to enable indexing and large-scale comparisons without revisiting raw series. SAX typically does this via z-normalization, PAA averages, and a shared Gaussian breakpoint table, but the bit budget wΒ·log2(a) is rarely evaluated for efficiency.

SFA replaces PAA with low-frequency DFT coefficients and replaces the shared bin table with Multiple Coefficient Binning, learning per-position quantiles so each letter is used. This avoids collapsing low-variance coefficients into a single symbol and supports three bin modes, including a Gaussian ablation.

A full similarity harness compares MinDist, ApproxDist, and TrueDist, validating a sound lower bound with the required factor-of-two from conjugate symmetry. Results show SFA gains when the alphabet is deep over few positions, shrinking as bits spread across many po...

πŸ‘‰ Read | Freelance | @mql5dev
❀17πŸ‘13πŸ”₯12🀩7✍1πŸ‘Œ1
Impulse candles can be formalized instead of identified visually. This indicator flags momentum bars with fixed rules and draws arrows: green below bullish impulses and red above bearish impulses.

A bar is marked when its body is at least ATR(InpAtrPeriod) * InpImpulseAtrMult, the body is at least InpMinBodyRatio of the full range, and the close is located in the top or bottom segment of the bar based on InpMinCloseLoc. Optional confirmation requires tick volume to exceed InpVolumeMult times the average of the prior InpVolumePeriod bars.

Signals are stable after close because calculations use only the current bar. The active bar can repaint until it closes; automation should read shift 1. For EAs, buffer 0 is bullish and buffer 1 bearish; non-zero values hold the arrow price via iCustom/CopyBuffer.

Defaults target M1–M15 on volatile symbols. On H1+ ...

πŸ‘‰ Read | Freelance | @mql5dev
πŸ‘17❀13🀩12πŸ”₯8πŸ‘¨β€πŸ’»3πŸ‘Œ2
Stormbreaker ADX is an MT5 Expert Advisor that trades only on completed candles, combining a Supertrend trend filter with ADX strength and the +DI/βˆ’DI relationship. Signals are evaluated once per new H4 bar using the previous bar’s indicator values, then orders are sent with an ATR-derived stop.

Default parameters use Supertrend ATR(10) factor 3.0, ADX(14) with entry at 23 and exit at 18. Buy requires bullish Supertrend, ADX β‰₯ 23, and +DI > βˆ’DI. Sell requires bearish Supertrend, ADX β‰₯ 23, and βˆ’DI > +DI. Exits occur on ADX < 18, Supertrend reversal, or an opposite qualifying signal; no fixed take-profit is used.

Position sizing targets 0.5% equity risk via OrderCalcProfit against the proposed stop, with volume rounded to broker steps and margin checked. Realized risk can differ due to spread, gaps, and execution. The source is provided for testing and modificatio...

πŸ‘‰ Read | NeuroBook | @mql5dev
πŸ‘22❀21πŸ”₯13🀩8⚑2πŸ‘Œ1
The updated MT5 walk-forward auto-optimizer focuses on speed, multi-asset runs, and lower memory usage by removing mutex-based report generation and reducing expensive file operations.

A new date auto-complete window splits a chosen period into alternating historical and forward windows: historical ranges can overlap, forward ranges are continuous, and both use fixed step sizes. The calculation is isolated behind a singleton data model and event-driven updates, with tools to bulk-clear and reapply ranges via a sub-window wrapper.

ReportManager.dll adds a user-defined optimization coefficient, keeps compatibility with older reports, and extends sorting options. On the MQL5 side, robots can supply this coefficient via a callback passed into the uploader.

Report export is accelerated by buffering passes in C# and writing the full report in one shot, ...

πŸ‘‰ Read | Forum | @mql5dev
❀56πŸ”₯16πŸ‘14🀩7⚑3πŸ†2πŸ‘€1
Inversion Fair Value Gaps adds automated fair value gap detection with bar-close confirmation and no repaint behavior.

Gaps are tracked until a candle body closes through the zone, marking an inversion event. After inversion, the tool monitors for bounce reactions off the inverted area and generates signals.

Options include a midline, filled-zone removal, and adjustable color settings for zones and markers. Alert routing is supported via popup, sound, push notification, e-mail, and Telegram.

πŸ‘‰ Read | Docs | @mql5dev
❀31πŸ‘16πŸ”₯9🀩9✍8πŸ‘¨β€πŸ’»4πŸ‘2
Entry/exit points remain the core problem in algorithmic trading because recognizable patterns are usually visible only after the move. Trend and flat regimes are easy to label visually, but unreliable as predictive signals without quantified probabilities.

Price formation can be described via market vs limit orders. Limit orders populate the order book, market orders consume it. Spread is the gap between best bid/ask. Stop Loss/Take Profit placement creates distributed trigger levels that can amplify acceleration or reversal.

From a probabilistic view, discrete ticks imply a random process where expected payoff for random entries converges to zero, excluding spread. Expected value and profit factor can be expressed through conditional events: closing by stops vs signals, with nested probabilities per stop configuration.

Regime detection can be fr...

πŸ‘‰ Read | AlgoBook | @mql5dev
❀68πŸ‘23πŸ”₯14🀩10πŸ‘€7πŸ‘Œ5πŸ‘¨β€πŸ’»1
ZoneUS30 is a simplified Expert Advisor focused on the US30 index and limited to SELL-only execution. The logic targets overextended upside moves where price may revert toward a prior reference area, triggering entries when internal conditions align.

The model combines mean-reversion behavior with the practical impact of swap. When a broker pays positive overnight swap on US30 shorts, holding positions across multiple sessions can add carry while waiting for a correction, without treating swap as the primary edge.

Trading is closer to swing or position holding than scalping, with some trades lasting days. The public build exposes only two inputs: lot size and the signal timeframe; remaining parameters are fixed.

Key risk: this is counter-trend selling in strong uptrends, with potential for extended adverse movement. Swap terms can change by broker rules an...

πŸ‘‰ Read | CodeBase | @mql5dev
❀31πŸ‘7πŸ”₯5🀩3⚑2πŸ‘Œ2
RSI Exhaustion Reversal - EURUSD is an open-source MQL5 Expert Advisor built for strategy research, historical testing, and education. It is restricted to the MetaTrader 5 Strategy Tester and will not place trades when attached to a regular chart. Full source code is included for inspection and modification.

The strategy targets EURUSD on M5 with SELL-only logic. It watches RSI(14) for an overbought exhaustion condition around level 65 during the 14:00–18:00 broker/server-time session. Before entry, spread is checked against volatility using a max Spread/ATR ratio of 0.15.

Risk controls use ATR(14) to size SL and TP at 4x ATR, cap position duration to 96 candles, and enforce a single concurrent position. User inputs are limited to internal timeframe, fixed lot size, and magic number.

Backtests are recommended on real ticks where available; results vary by broke...

πŸ‘‰ Read | VPS | @mql5dev
❀16πŸ‘10πŸ”₯4🀩4πŸ‘Œ1πŸ‘¨β€πŸ’»1
An Adaptive Kalman Trend Filter indicator is designed to reduce short-term price noise and present a clearer view of the underlying trend. It applies Kalman-style state estimation to smooth input data while retaining enough responsiveness to reflect meaningful movement.

The adaptive component modifies the filter’s sensitivity as volatility and market structure change. In lower-noise phases it can prioritize smoothness; during faster moves it can react sooner to shifts in direction.

Typical usage focuses on trend bias, momentum change points, and timing confirmations when combined with risk rules and other signals. As with any filter, parameter selection and out-of-sample checks remain critical to avoid overfitting.

πŸ‘‰ Read | Signals | @mql5dev
❀24πŸ”₯5🀩4πŸ‘2πŸ‘Œ2πŸ‘¨β€πŸ’»1
A specification panel reflects the broker’s current contract report. Broker Contract Change Watch logs when selected contract properties differ from the last saved observation, with a baseline stored per account server, login, and chart symbol.

Watched fields include digits, point size, minimum tick, contract size, volume min/max/step and directional limit, stops and freeze levels. It also tracks trading and execution modes, filling flags and allowed order flags, plus swap mode, long/short swap values, and the triple-swap weekday.

After reattachment or terminal restart, the next valid observation is compared to the saved baseline. A compact panel shows the latest change, volume settings, and stop restrictions. CSV output records local time, property, previous value, and new value. Spread and currency-converted tick value are excluded to avoid routine marke...

πŸ‘‰ Read | CodeBase | @mql5dev
❀17πŸ‘7🀩3πŸ”₯2πŸ‘Œ1
MetaTrader 5 EAs often keep critical strategy state only in RAM (grid depth, recovery steps, daily counters, online-trained model weights). After a terminal restart, the EA can mismanage existing positions because its internal context is gone.

A common persistence bug is overwriting the live state file: a crash mid-write truncates it, leaving β€œvalid-looking” but wrong data. The proposed fix is atomic-style saving: write to a temporary file, flush/close it, then replace the live file using FileMove, without DLLs.

To detect silent damage from edits or partial copies, the file includes a header with a magic identifier, a format version, and a checksum. On load, the store rebuilds a canonical body and verifies the checksum, returning an empty state if integrity fails.

Beyond scalars, the utility persists double arrays, making it practical to restore rolling statisti...

πŸ‘‰ Read | Forum | @mql5dev
❀14πŸ‘6🀩3πŸ‘Œ1