MQL5 Algo Trading
489K 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
The article begins a graphics layer for an MQL5 library, building custom UI elements on CCanvas. The design targets composite components with arbitrary hierarchies, where every visual element shares consistent coordinates, sizing, IDs, and interaction flags.

A key improvement is throttling canvas redraws to ~16 ms to avoid invisible overpainting and reduce CPU load. Utility code is also refined with a Pause method overload that supports timing without extra logging state.

Input handling is formalized via a CMouseState service. It encodes mouse buttons plus Shift/Ctrl and wheel events as bit flags, and adds a second byte for cursor position relative to a form (inside, active area, edges, control zones). This compact state feeds OnChartEvent processing.

On top of a CObject-derived base graphical class, a CForm implements a movable bitmap-label canvas, activ...

πŸ‘‰ Read | Forum | @mql5dev

#MQL5 #MT5 #Indicator
❀56πŸ‘Œ2πŸ‘€2πŸ”₯1
A scheduled trade execution expert is designed to open and close positions at predefined day/time values and operates only on the chart symbol where it is attached.

Order entry settings include day, hour, and minute for opening, plus direction selection (buy, sell) and lot size. Risk controls support optional take profit and stop loss defined in pips, with 0 disabling each level. Filtering is available via a magic number to manage only specific positions.

Order exit settings provide day, hour, and minute for closing. Closing behavior can be limited to positions opened by the expert or expanded to close all open positions on the account at the configured time.

πŸ‘‰ Read | Signals | @mql5dev

#MQL4 #MT4 #EA
❀28πŸ‘Œ2πŸ‘€2
This article shows how to add dynamic voice alerts to MetaTrader 5 EAs using a local text-to-speech pipeline, avoiding the limitations of pre-recorded WAV notifications.

An MQL5 Expert Advisor formats market events (signals, prices, time, ATR, margin/trade status) into text and sends it via WebRequest HTTP POST to a localhost Python service. The Python side exposes a simple /speak endpoint, queues incoming messages, and speaks them sequentially to prevent overlaps and thread-related crashes.

A moving-average crossover EA demonstrates the pattern, including a TestMode that speaks on each new bar and practical error handling for common WebRequest failures. This design improves accessibility, reduces alert maintenance, and stays fully local for low latency and privacy.

πŸ‘‰ Read | Signals | @mql5dev

#MQL5 #MT5 #EA
❀23✍2πŸ‘2πŸ‘Œ2πŸ‘€2
Rising and falling wedges remain widely used for framing entries and risk, but manual detection is inconsistent and slow under live conditions. Objective rules are required to avoid bias and missed formations.

A wedge is defined by converging trendlines with directional compression. Valid structures require confirmed swing highs/lows, multiple touches on both boundaries, and measurable slope convergence. Rising wedges have positive slopes with the lower line steeper; falling wedges have negative slopes with the upper line steeper. Breakout direction confirms or invalidates the setup.

An MQL5 indicator can formalize this: non-repainting pivot confirmation, slope and apex validation, overlap prevention, and per-bar monitoring for breakout or failure. Modular classes for pivots and wedges plus event-driven OnCalculate updates keep performance stable and...

πŸ‘‰ Read | Docs | @mql5dev

#MQL5 #MT5 #Indicator
❀29πŸ‘Œ2πŸ‘€2😱1
Financial market series are nonlinear, high-volatility signals where linear statistical models often break under regime shifts, liquidity shocks, and event-driven discontinuities.

Attraos applies a chaos-theory view: observed prices are treated as low-dimensional projections of a higher-dimensional deterministic system. Phase space reconstruction (Takens) is used to recover latent dynamics via embedding dimension d and delay Ο„, then improve long-horizon stability by controlling attractor deviation.

Architecture notes: PSR selects d and Ο„; MDMU segments tensors and filters uninformative components; LMA uses diagonal state matrices with polynomial projections; DP uses exponential matrix discretization; frequency-domain local evolution amplifies relevant spectral components.

Implementation focus in MQL5/OpenCL centers on diagonal matrices stored as vectors...

πŸ‘‰ Read | Docs | @mql5dev

#MQL5 #MT5 #AlgoTrading
❀62✍7πŸ‘Œ7πŸŽ‰2πŸ‘Ύ2πŸ‘€1
Moving-average setups remain a practical way to filter trend direction on a selected timeframe. A common approach uses two moving averages, typically a faster line and a slower line, to separate momentum from background direction.

Key parameters are the MA type, period length, applied price, and shift. Adjustments should be tested per instrument and volatility regime, since the same settings rarely perform consistently across markets.

This two-MA trend filter can be combined with other signals such as volatility bands, momentum oscillators, or session filters to reduce low-quality entries. Validation should include spread and slippage assumptions, with separate checks for ranging conditions.

πŸ‘‰ Read | VPS | @mql5dev

#MQL5 #MT5 #Indicator
❀34πŸ‘Œ2πŸ‘€2
Previous Day High/Low/Close indicator plots the prior session’s High, Low, and Close directly on the chart. Each day’s levels are drawn as horizontal lines limited to that day’s range, while yesterday’s lines extend into the current session as active reference levels. Older sessions can be displayed up to 50 days back using a dotted style for separation.

Levels are sourced from the Daily timeframe, so accuracy is independent of the chart timeframe. H1 and H4 tend to show interactions most clearly. PDH is a resistance reference, PDL is a support reference, and PDC often behaves like an early-session pivot.

Optional alerts can trigger once per day when price touches any of yesterday’s levels, with configurable popup/push behavior, tolerance handling, and automatic reset at midnight server time. Non-trading days are skipped automatically.

πŸ‘‰ Read | VPS | @mql5dev

#MQL5 #MT5 #Indicator
❀29πŸ‘Œ3πŸ‘Ύ3πŸ‘2πŸ‘€2😁1
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