MQL5 Algo Trading
488K subscribers
3.09K photos
3.09K 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
Multi-pair EAs often fail not on signal quality, but on hidden duplication of risk when several instruments move together. This article shifts the design from per-symbol logic to portfolio-aware execution by embedding real-time cross-pair correlation checks before any order is placed.

The EA maintains a centralized symbol model with synchronized close-price buffers, computes a Pearson correlation matrix (stored efficiently as a flattened array), and refreshes it on new bars with a timer fallback. Signals come from MA crossovers with an added directional bias filter.

Trade approval becomes a final β€œrisk gate”: existing positions are scanned against correlation strength and direction to block trades that would amplify exposure through positive correlation or create mirror exposure via negative correlation. A heatmap visualizes the matrix for fast validatio...

πŸ‘‰ Read | AlgoBook | @mql5dev

#MQL5 #MT5 #EA
❀17πŸ‘Œ3πŸ‘€2✍1
On Friday, March 6, 2026, a new version of MetaTrader 4 will be released. The update includes several important security improvements, bug fixes, and platform stability enhancements.

The update will be distributed via Live Update.

Discuss the update...
❀28πŸ‘5πŸ”₯5πŸŽ‰4πŸ†4πŸ‘Œ1
Moving-average crossovers work in trends but fail in ranges due to repeated crossings and whipsaws. Common fixes like longer periods or RSI/ADX filters are heuristic and often reduce responsiveness.

ALGLIB is available in MetaTrader 5 via the Standard Library port, providing optimized routines for statistics, filtering, SVD/SSA, and splines using CRowDouble/CMatrixDouble with conversions to MQL5 arrays.

A baseline EMA crossover can be preprocessed with ALGLIB SMA/EMA/LRMA, SSA trend reconstruction (window + rank), and cubic-spline derivative zero-crossings. Testing can run all variants in one indicator with a bounded lookback to control SSA cost, then compare signal density and timing under trend vs range conditions.

πŸ‘‰ Read | VPS | @mql5dev

#MQL5 #MT5 #AlgoTrading
❀67πŸ‘Œ7⚑4πŸ‘€2
An extended version of the Limit Channels indicator adds a β€œstates” display alongside the channel levels.

States are rendered as a colored histogram and derived from three nested level groups. Level 3 uses the outer bands and represents the slowest state. Level 2 uses the middle bands. Level 1 uses the inner bands and represents the fastest state.

The level grouping is a suggested approach for interpreting multi-level channel structures. Additional combinations can be derived from the available six levels, depending on the chosen strategy and timeframe.

Color transitions in the histogram can be monitored as potential signals, with confirmation logic left to the implementation.

πŸ‘‰ Read | AlgoBook | @mql5dev

#MQL4 #MT4 #Indicator
❀30πŸ‘2πŸŽ‰2πŸ‘€2πŸ”₯1πŸ‘Œ1
This article moves Attraos from theory into an MT5-ready implementation, building a CNeuronAttraos object that encapsulates Phase Space Reconstruction without extra compute by reshaping 1D buffers into lagged state vectors.

The design is modular: many static internal objects handle parameter generation, normalization, state updates, and storage, while only four components contain trainable weights, simplifying Save/Load and reducing disk usage.

Trainable matrices (state transition and residual paths) are produced via a compact two-layer scheme using a convolutional layer to replicate parameters across the full sequence, improving backprop efficiency and enabling stable fixed initialization.

Forward pass combines normalized inputs, state-space dynamics via the Multi-Resolution Dynamic Memory Unit, residual connections, and an OpenCL parallel-scan kernel ...

πŸ‘‰ Read | AppStore | @mql5dev

#MQL5 #MT5 #AlgoTrading
❀22πŸ‘3πŸ‘€2✍1πŸ‘Œ1
Larry Williams’ Hidden Smash Day is treated as a two-step reversal: a β€œsmash” bar that hints at exhaustion, then a next-session confirmation that proves it. The pattern is defined by where the close lands inside the bar’s own range plus a close-to-close comparison, not by breaking obvious prior highs/lows.

Bullish setup: higher close than the prior bar, but the close sits in the bottom 25% of its range (optional filter: close below open). Bearish is the inverse, with the close in the top 25%.

The EA formalizes this into testable MQL5 rules: evaluate only on new-bar open, require confirmation by a full bar close beyond the smash bar’s high/low, support long/short/both modes, and enforce one position at a time. Risk is reproducible via structure-based or ATR-multiple stops, plus fixed lots or percent-risk sizing.

πŸ‘‰ Read | Freelance | @mql5dev

#MQL5 #MT5 #Strategy
❀36πŸ‘Œ3πŸ†2πŸ‘€2🀑1
A daily trade limit sounds simple, but in MT5 it’s easy to bypassβ€”especially with multiple EAs and manual trades. This article turns β€œno more than N entries per day” into an account-level rule that’s automatically enforced.

The solution counts confirmed entry deals (DEAL_ENTRY_IN) inside a configurable session window (custom start time, not just midnight), then classifies status as Allowed, Caution, or Limit Reached. A dashboard shows trades used/remaining and can trigger alerts.

Enforcement is decisive: once the limit is hit, newly placed pending orders are deleted and newly opened positions are closed, while earlier positions remain untouched. The design is modular: a shared .mqh library for consistent counting/state, an indicator UI, and a background enforcer EA coordinated via terminal global variables.

πŸ‘‰ Read | Quotes | @mql5dev

#MQL5 #MT5 #AlgoTrading
❀65πŸ‘13πŸ‘€4✍3πŸ‘Œ3
An indicator is available to render trading order activity directly on the chart, covering both historical and active positions. Display elements include buy and sell entries, order close marks, stop-loss and take-profit levels, plus a connecting trend line to visualize the result of each trade.

Visibility can be controlled with switches for history orders, open orders, stop-loss lines, and take-profit lines. Separate color settings are provided for buy arrows, sell arrows, close arrows, take-profit lines, and stop-loss lines.

Line styling supports different formats for profitable versus losing trades via independent style parameters. Order filtering is supported through a MagicNumber setting, where 0 enables all orders and a specific value restricts output to matching orders.

πŸ‘‰ Read | Signals | @mql5dev

#MQL4 #MT4 #Indicator
❀39πŸ€”6πŸ†3πŸ‘Œ2⚑1πŸ’”1
Part 22 builds an MQL5 binomial distribution visualizer to turn a strategy’s win rate into actionable probability estimates, such as the chance of k wins in n trades or the likelihood of losing streaks.

The tool simulates binomial samples, bins them into a histogram, and overlays the theoretical PMF curve to check whether observed behavior matches the independence + fixed-p assumption and whether sample size is sufficient.

Implementation centers on CCanvas rendering plus MQL5 statistical libraries, with modular helpers for mean, standard deviation, skewness, kurtosis, percentiles, and 95/99% confidence intervals. The UI supports draggable/resizable panels, real-time parameter updates (trials, p, samples), and theming for clearer analysis and risk calibration.

πŸ‘‰ Read | NeuroBook | @mql5dev

#MQL5 #MT5 #AlgoTrading
❀31πŸ†3⚑2πŸ‘Œ2🀯1
KnitPkg brings dependency management to MQL4/MQL5 by replacing folder copying and manual #include edits with Git-backed, SemVer-versioned components declared in a manifest. A lock file pins exact revisions, making installs and builds repeatable across terminals and machines.

Projects define dependencies in knitpkg.yaml (YAML/JSON). KnitPkg installs them as either a classic include tree or a single generated header for flat distribution, while a registry stores metadata and resolves version ranges to specific Git commits.

Composite packages handle external dependencies cleanly using generated autocomplete headers for development and install-time directives that KnitPkg converts into real includes. The workflow is validated with unit tests compiled from the manifest, demonstrated by reusing one SMA implementation across a package, indicator, and CPU-effici...

πŸ‘‰ Read | NeuroBook | @mql5dev

#MQL5 #MT5 #AlgoTrading
❀62πŸ‘€4πŸ€”3πŸ†3⚑2πŸ‘Œ2
A multi-timeframe trend indicator consolidates MA-based direction from M1, M5, M15, and H1 into a single trend state: bullish, bearish, or sideways. The aggregation is designed to reduce conflicting signals by weighting aligned timeframes and flagging mixed conditions as neutral.

Sideways detection is handled with dot markers that appear when MA behavior suggests low directional strength, helping filter entries during range conditions. Additional arrow markers provide entry timing cues on a selected timeframe such as M30, indicating when conditions align for a potential position.

A separate MA-based trend readout for the active chart timeframe is included to keep the current context visible alongside the combined MTF signal.

πŸ‘‰ Read | Quotes | @mql5dev

#MQL5 #MT5 #Indicator
❀26πŸ‘8πŸ”₯2πŸ‘Œ2
Cluster-based classification can be applied to indicator slope to separate flat markets from trending phases using numeric thresholds rather than visual judgment.

An MQL-style HalfTrend example evaluates only x[iB] - x[iB+1], normalized to _Point for cross-symbol comparability. With a two-buffer line (up/down), the active buffer value becomes the source series, and fabs(delta) avoids duplicating clusters by sign.

Instead of k-means with prohibitive cost at scale, the approach uses incremental weighted mean and variance (Finch) in a single pass, enabling fast categorization over full history. Clustering is isolated in ClusterTrend.mqh, controlled by NumValues, and benchmarked in milliseconds on multi-thousand bar datasets.

πŸ‘‰ Read | Quotes | @mql5dev

#MQL5 #MT5 #AI
❀53πŸ”₯4πŸ‘Œ4πŸŽ‰2
CExecutionSafety is a small MQL5 include class intended to stop Expert Advisors from placing orders when execution conditions degrade. It tracks two latency components in real time: terminal ping and measured execution delay around trading calls, then blocks trading when the combined value exceeds a configured limit.

Ping is read from TERMINAL_PING_LAST, while RecordExecDelay() stores a wall-clock delta taken around a CTrade operation. CheckExecutionSafety() sums both values, compares against the threshold, and logs diagnostics when the gate fails.

If the terminal is disconnected, TERMINAL_PING_LAST returns -1. This is treated as an automatic failure to prevent orders without server contact.

Read-only accessors expose ping, last execution delay, combined latency (9999 when disconnected), sample availability, and the configured threshold. Changelog: v1.0 init...

πŸ‘‰ Read | Docs | @mql5dev

#MQL5 #MT5 #EA
❀41✍5πŸ‘3πŸ‘Œ3
CLatencyMonitor is a lightweight MQL5 include-file that adds latency awareness to execution-sensitive EAs via a single reusable class. It measures inter-tick deltas with GetTickCount64(), applies an ATR-based volatility gate to reduce false positives during high-volatility bursts, and publishes confirmed lag events through a named GlobalVariable for cross-EA IPC on the same terminal.

On each OnTick() call, the elapsed milliseconds since the previous tick are computed, with the first tick seeding state only. A lag candidate is suppressed when ATR exceeds AtrSmaMultiplier Γ— SMA(ATR, AtrPeriod), with the SMA calculated manually from the ATR buffer for self-normalisation across symbols and timeframes. If ATR setup fails or history is insufficient, the gate fails open so detection remains active.

A timer-driven persistence check confirms lag only after Persistenc...

πŸ‘‰ Read | Quotes | @mql5dev

#MQL5 #MT5 #EA
❀41πŸ’”4πŸ‘3⚑2πŸ‘Œ2
ExMachina Safe Scalping is a breakout scalping EA designed to stay flat unless six independent conditions align on the same bar. Filters include dual EMA trend (150/510), ATR-based trend strength to reject weak ranges, price location relative to both EMAs, an N-bar high/low breakout with a volatility-adjusted buffer, RSI kept out of extremes, and close-to-close momentum confirmation.

Risk controls are fixed per trade: predefined stop loss and take profit at entry, single open position, and no martingale, grid, hedging, or averaging down. Breakeven can move the stop to entry after favorable movement, and a drawdown threshold can auto-pause trading.

Operational filters include session-hour limits, maximum spread gating, and optional news-time blocking. The Code Base release is a single .mq5 file using the standard MT5 Trade library, with readable logic and an ...

πŸ‘‰ Read | Forum | @mql5dev

#MQL5 #MT5 #Scalper
❀40πŸ‘8πŸ‘€3πŸ‘Œ2✍1
The DoEasy chart subsystem is finished by making chart windows first-class library objects, enabling reliable auto-refresh of chart and subwindow properties. Instead of manually syncing state, every tracked integer/real/string property updates its stored parameters and emits structured custom events when values change, cross a threshold, or match a configured combination.

Core refactor work includes new message indices, a dedicated chart-window list ID for event attribution, and aligned enumerations for properties and sort criteria so search/sort stays consistent. The chart window class now owns its property arrays, descriptions, compare logic, and refresh flow, including indicator add/remove handling.

Chart objects gain symbol/timeframe change events, explicit helpers to set tracked values, and cleaner property population methods. Practical result: EA...

πŸ‘‰ Read | Signals | @mql5dev

#MQL5 #MT5 #AlgoTrading
❀44πŸ‘Œ9πŸ‘6πŸ‘€6
Last Structure Indicator (Single Phase) implements a framework to test the Last Structure Break (LSB) concept using structured price-action rules.

Session boundaries are detected via logical day separation, based on chart separators and datetime normalization rather than daily timeframe data. This keeps day transitions consistent across timeframes and broker feeds.

The scan builds support/resistance pivots with configurable modes (wick-based or body-based) and pivot strength validation using left/right bar requirements. Only the final structural levels of a session that remain unbroken into the close are accepted, then projected forward as trendlines into the next session.

Designed for real-time use with minimal recalculation, the tool aims to measure whether end-of-session structure has repeatable relevance for subsequent price action.

πŸ‘‰ Read | Forum | @mql5dev

#MQL5 #MT5 #Indicator
❀41πŸ‘Œ3πŸ”₯2
This article breaks down how to consistently identify Premium/Discount (PD) arrays and imbalances in price action, and why traders fail when they pick the wrong β€œreaction zones” or trade against the broader narrative. It emphasizes using a simple checklist mindset to reduce impulse entries and indecision.

Core concepts are defined practically: imbalances as fast, one-sided moves that often get revisited; market structure shifts as decisive breaks that flip highs/lows; PD arrays as splitting an expansion leg into premium vs discount to avoid buying high or selling low; and using fractal behavior to refine higher-timeframe ideas into lower-timeframe entries.

A MetaTrader 5 EA in MQL5 is presented to automate this workflow: detect trend and consolidation with stacked moving averages, map higher-timeframe expansion legs into PD zones, track imbalances inside th...

πŸ‘‰ Read | VPS | @mql5dev

#MQL5 #MT5 #EA
❀82πŸ‘Œ14πŸ‘€4⚑3🀝3
An updated Limit Channels indicator adds a β€œstates” panel rendered as a colored histogram to summarize channel conditions.

States are derived from three nested level groups. Level 3 uses the outer bands and represents the slowest state. Level 2 uses the middle bands. Level 1 uses the inner bands and reacts fastest.

The six total levels allow additional combinations beyond the default three-state mapping. Color transitions in the histogram can be used as event markers, with signal rules left to the implementer based on timeframe, instrument, and risk constraints.

πŸ‘‰ Read | Freelance | @mql5dev

#MQL5 #MT5 #Indicator
❀34πŸ‘€4🀯3
ALGLIB’s MQL5 port ships minLBFGS but lacks a box-constrained variant, pushing developers toward heavier optimizers for simple bound-limited calibration tasks. A compact Truncated Newton Conjugate-Gradient (TNC) solver fills that gap with an API designed to drop into projects like minLBFGS.

TNC approximates Newton steps using an inner Conjugate Gradient loop, relying on Hessian-vector products derived from gradient finite differences instead of forming a full Hessian. It supports analytic gradients when available, plus stable numerical differentiation near bounds, while enforcing constraints via projection and variable clamping.

The implementation is packaged as tnc.mqh with a CFunctor/CTruncNewtonCG interface, tunable stopping criteria, and clear termination codes. It’s validated on Rosenbrock and used to fit logistic regression alongside LBFGS, pro...

πŸ‘‰ Read | AlgoBook | @mql5dev

#MQL5 #MT5 #algorithm
❀92πŸ‘7⚑4😁2πŸ‘€2
A trend indicator is used to classify market direction as uptrend or downtrend based on the line state.

Common operational logic is straightforward: a green line is treated as a bullish condition and a red line as a bearish condition. Some traders use this as a basic ruleset to align entries and exits with the prevailing direction.

For practical use, results depend on the instrument, timeframe, and parameter settings. As with any single-signal approach, confirmation with volatility, volume, or higher-timeframe structure is typically required to reduce false signals.

πŸ‘‰ Read | Freelance | @mql5dev

#MQL5 #MT5 #Indicator
❀48✍6⚑3