MQL5 Algo Trading
494K subscribers
3.18K photos
1 video
3.18K 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
Manual account audits in MT5 often mean jumping between history tabs and spreadsheets, with no persistent view on the chart. This article treats the problem as UI engineering: building an Account Audit dashboard as a custom MQL5 indicator that stays compact, readable, and non-intrusive.

The indicator is structured for maintainability: named constants, a single metrics struct (balances, net profit, trades, wins/losses, win rate, withdrawals, composite rating), and small UI helpers to assemble rect-label blocks, text labels, and a star-based rating.

A key design fix is workflow safety. The dashboard can be shown/hidden via a button handled in OnChartEvent, restoring one-click trading when hidden to avoid terminal interaction conflicts. The calculation engine is intentionally deferred; OnCalculate remains empty, leaving a clean plug-in surface for later...

πŸ‘‰ Read | Signals | @mql5dev

#MQL5 #MT5 #Indicator
❀25πŸ€“3πŸ‘2πŸŽ‰2πŸ‘Œ2
The December 2021 TASC article β€œThe DMH: An Improved Directional Movement Indicator” by John Ehlers outlines an updated approach to directional movement using Hann windowing. Directional movement has been widely used for decades, and the original formulation by J. Welles Wilder was constrained by the practical computing limits of its time.

DMH keeps a default length of 14 bars to mirror Wilder’s common setting, but the article argues for making period length configurable. When used inside a rule-based strategy, parameter selection can be handled via optimization rather than convention.

This implementation adds optional visualization behavior beyond the original: color changes on slope shifts, color changes on zero-line crosses, or no color changes for a classic presentation. Period testing is recommended before relying on any signal behavior.

πŸ‘‰ Read | VPS | @mql5dev

#MQL5 #MT5 #Indicator
❀22πŸ‘2πŸ‘Œ1πŸ’”1
Google Research’s TimesFM, accepted at ICML 2024, applies the foundation-model workflow to forecasting. It is a 200M-parameter decoder-only transformer pretrained on 100B real-world time points, with strong zero-shot results across domains.

A practical setup targets trading: fine-tune TimesFM 2.5 on OHLCV using PEFT/LoRA, keeping trainable weights near 100K by adapting only the last 2 of 20 layers. This reduces overfitting risk on non-stationary series.

An end-to-end MT5 pipeline exports 14 instruments, builds covariates (sessions, economic events, moon phase, technical proxies), fine-tunes, then produces probabilistic forecasts (q10/q50/q90). Results are exported back to MT5 as CSV and rendered via an MQL5 indicator with confidence bands.

πŸ‘‰ Read | AlgoBook | @mql5dev

#MQL5 #MT5 #TimesFM
❀25πŸ‘3πŸ‘Œ2
Media is too big
VIEW IN TELEGRAM
We've released a new video demonstrating how to significantly speed up Expert Advisor optimization in MetaTrader 5.

The Strategy Tester lets you run multiple optimization passes in parallel by utilizing all available CPU cores. Instead of testing parameters sequentially, you can distribute the workload and discover the most profitable settings much faster. For even greater performance, connect to the MQL5 Cloud Network. Tens of thousands of cores can reduce optimization time from hours to just minutes.

In this three-minute video, you'll learn how to:

βœ“ Configure optimization modes (full search and genetic algorithm)
βœ“ Define testing parameters and input ranges for your Expert Advisor
βœ“ Connect to the MQL5 Cloud Network and run optimizations in the cloud
βœ“ Monitor progress, costs, and results in real time
βœ“ Analyze results and identify the best-performing parameters
βœ“ Earn by contributing your own computing resources

Comment the video:
πŸ‘‰ MQL5.community for traders
πŸ‘‰ MetaQuotes official YouTube channel
❀15πŸ‘2πŸ‘Œ2
This article demonstrates how to turn MetaTrader 5 into a lightweight visualization runtime using the MQL5 canvas, not indicator buffers. The focus is rendering a parametric butterfly curve with a clean math-style presentation inside a draggable, resizable floating panel.

Key techniques include supersampling via an offscreen high-resolution canvas and manual downsampling with per-pixel ARGB averaging for smooth anti-aliased curves. The plot adds a gradient background, axis grid with readable tick generation, rotated labels, and a four-segment color legend to show how the curve builds over 0..12Ο€.

The implementation also covers practical UI mechanics: hit-testing header and resize zones, clamped resizing to chart bounds, synchronized layer updates across multiple canvases, and redraw orchestration for responsive in-terminal tools.

πŸ‘‰ Read | Quotes | @mql5dev

#MQL5 #MT5 #AITrading
❀15πŸ‘2πŸ‘Œ2
Market Entropy Indicator logic has been formalized into an MQL5 Expert Advisor to remove manual monitoring issues such as inconsistent interpretation and late capture of compression-to-expansion transitions.

The EA computes fast/slow/base Shannon entropy from up/down/flat bar states on every tick, then derives divergence, momentum, regime (trend/transition/chaotic), and compression/decompression states. Signals come from entropy crossovers with momentum and regime filters, plus compression breakout and decompression-end triggers.

Execution is deterministic and parameterized: LotSize, SL/TP, MagicNumber, MinSignalGap, optional reverse-on-opposite-signal, and retry logic. It renders arrows and regime labels, enforces one trade per bar, supports daily resets, and logs all actions for Strategy Tester and live validation.

πŸ‘‰ Read | Signals | @mql5dev

#MQL5 #MT5 #EA
❀16πŸ‘4⚑2πŸ‘Œ2
HSIC (Hilbert-Schmidt Independence Criterion) answers a core algo-trading question: do features truly relate to the target, beyond out-of-sample hope. Unlike Pearson correlation, HSIC detects both linear and non-linear dependence using kernel similarity matrices, working with scalars or high-dimensional vectors without explicit joint distribution modeling.

The article implements HSIC in MQL5 with an RBF (Gaussian) kernel, including practical sigma selection via a median-distance heuristic and efficient distance computation in matrix form. Significance is handled two ways: an exact permutation test (accurate but costly) and a gamma approximation (much faster, best for large datasets).

A synthetic trading-style example shows HSIC recovering a non-linear dependency where correlations are near zero, making it useful for feature screening and subgroup testing before...

πŸ‘‰ Read | Docs | @mql5dev

#MQL5 #MT5 #HSIC
❀45πŸ‘4✍2🀯2πŸ‘Œ2⚑1πŸ‘€1
An experimental CCI-style indicator modifies the original CCI calculation, producing substantially different absolute values. As a result, fixed threshold usage typical for classical CCI becomes unreliable.

To address this, dynamic levels are added using a Donchian-channel-like approach, allowing context-aware bounds that adapt to recent ranges.

Multiple average types are supported for the core computation and for optional price smoothing. The smoothing layer can act as a signal filter without adding material lag.

Operational guidance centers on using color-state changes as signal events. Side-by-side comparisons with classical CCI show that while numeric outputs differ, relative behavior such as slopes and turning points remains broadly consistent.

πŸ‘‰ Read | Quotes | @mql5dev

#MQL5 #MT5 #Indicator
❀19πŸ‘3πŸ†3πŸ‘Œ1
Camel Algorithm (CA) is a bio-inspired optimizer proposed in 2016 by Mohammed Khalid Ibrahim and Ramzy Salim Ali. It models temperature as stochastic pressure, supply depletion, endurance decay, oasis-based resource reset, and population-level information sharing.

A reference C_AO_CAm implementation keeps per-agent temperature, supply, endurance, and step counters. Iterations update factors, move agents via random-walk dynamics biased by the current best, revise the best candidate, and optionally apply an oasis effect when fitness improves.

A modified variant changes β€œdeath” handling to per-dimension resets and replaces uniform reinitialization with Gaussian sampling around the best solution to focus sampling near promising regions.

In reported tests, the original CA reached a maximum score of 32.56% in the benchmark table.

πŸ‘‰ Read | Freelance | @mql5dev

#MQL5 #MT5 #algorithm
❀18πŸ‘5πŸ‘Œ2
This article shifts from 1D quote series to image-based market representation, encoding price, indicators, oscillators, and candlestick anatomy into 128x128 multi-channel frames. The goal is to let CNNs detect chart structures as visual textures rather than isolated numbers.

The model uses three parallel convolution paths (short-term moves, longer trends, volatility/momentum), then applies attention to suppress noise and emphasize decisive regions. A bidirectional LSTM adds temporal context, and multi-task training predicts both direction and move magnitude.

A key contribution is interpretability: attention heatmaps and neuron activation analysis expose what drove a signal (reversal zones, RSI/price divergences). RobustScaler, Gaussian blur, and training callbacks improve stability, with a roadmap toward multimodal news+macro inputs, multi-timefra...

πŸ‘‰ Read | Docs | @mql5dev

#MQL5 #MT5 #AITrading
❀36πŸ‘Œ4🀣2
In MetaTrader 5 build 5830, we've significantly improved the built-in help system:

β€’ Optimized colors in the dark theme for better readability.
β€’ Improved the size of the navigation sidebar.
β€’ Added the ability to undock the help window in MetaEditor.
β€’ Added support for copying text via the context menu and Ctrl+C.
β€’ Added the ability to adjust text zoom: hold Ctrl and scroll the mouse wheel, or use the context menu.
β€’ Added navigation between previously viewed sections using Alt + Left/Right Arrow.
β€’ Added the ability to print pages using Ctrl+P.

In addition, the update improves the display of certain interface elements in the dark and fixes an issue to ensure the "Use system colors" option in Market Watch is correctly applied after restart.

Discuss the update...
❀61πŸ‘9πŸŽ‰1πŸ‘Œ1πŸ‘¨β€πŸ’»1
A position sizing indicator for MT5 calculates lot size from a defined risk percentage and stop-loss distance.

Stop loss can be set by an Average True Range multiplier or by a fixed number of points. The calculation is point-based (10 points = 1 pip) to keep sizing consistent across symbols with different tick sizes and pricing formats, including FX pairs, indices, commodities, and equities.

Example configurations reference EURUSD on H4 and US500 on H1, highlighting the same risk model applied across markets and timeframes.

πŸ‘‰ Read | AppStore | @mql5dev

#MQL5 #MT5 #Indicator
❀27πŸ‘Œ4πŸ†2
Part 1 builds a minimal pipeline to move closed-trade history out of MetaTrader 5 into an external store, avoiding manual exports and enabling consistent, queryable analytics by symbol, magic number, and ticket IDs.

The architecture is kept modular: MT5 generates events, an MQL5 EA will collect and send JSON over HTTP, a Flask API receives requests, and SQLite persists records for later reporting.

On the backend, the article sets up a Flask + Flask-SQLAlchemy scaffold on Ubuntu/WSL, defines a Trade model aligned with MT5 identifiers (order/deal/position tickets, prices, timestamps, PnL), and creates a versioned API layout with health, trade collection, single-trade lookup, and an analytics summary endpoint to be implemented next.

πŸ‘‰ Read | Quotes | @mql5dev

#MQL5 #MT5 #EA
❀21πŸ‘2πŸ‘Œ2πŸ†2
Head and Shoulders detection is simple visually, but unstable without strict rules. Real charts include asymmetric shoulders, sloped necklines, and noise that breaks naive swing-based logic. A triangle-bounded model can constrain left shoulder, head, and right shoulder and validate them with measurable criteria.

The MQL5 indicator pipeline: detect swing highs/lows, normalize size via ATR, enforce shoulder symmetry, limit neckline slope, score candidates, then confirm via neckline breakout. Visualization uses chart objects (triangles, neckline, labels, optional arrows) rather than buffers.

Key implementation points: SwingPoint and Pattern structs, ATR handle via CopyBuffer(), configurable inputs (SwingStrength, ShoulderTolerance, MinPatternSizeATR, MaxNecklineSlopeDeg), and OnCalculate() orchestration with cleanup in OnDeinit().

πŸ‘‰ Read | Calendar | @mql5dev

#MQL5 #MT5 #Indicator
❀24πŸ‘Œ5
Round-number S/R detection in MQL5 keeps failing in production due to IEEE-754 artifacts and inconsistent Digits/TickSize across FX, metals, indices, and crypto. A deterministic pipeline is proposed: normalize to SYMBOL_TRADE_TICK_SIZE, convert with DoubleToString, remove the decimal separator, then count trailing zeros via string-suffix analysis.

Level strength is formalized as ZeroSize. ZeroSize scales with timeframe: M1–M15 typically needs 2, M30–H4 needs 3, daily+ focuses on 4+. Visualization reduces clutter by rendering ZeroSize 4+ as thick solid lines, 3 as medium, 2 as thin/dashed.

Strategy notes: treat levels as zones, require momentum overextension plus candle rejection, and place stops beyond a buffer to account for liquidity sweeps. The logic is symbol-agnostic, including BTC-style integer prices and JPY pairs.

πŸ‘‰ Read | Docs | @mql5dev

#MQL5 #MT5 #Indicator
❀25πŸ‘Œ2
This article outlines a Markov-chain forecasting approach that avoids neural-network opacity by modeling the market as transitions between discrete, interpretable states.

States are learned via K-means clustering over three feature blocks: price indicators, time cycles, and volume. Time is encoded with sin/cos transforms to preserve cyclic structure. These clustered components are combined into a compact state space (e.g., 9 practical regimes from a larger theoretical set).

Forecasting is driven by a transition matrix (multi-step via matrix powers) plus a second matrix estimating bullish-candle probability per transition, enabling directional probabilities and confidence grading. On EURUSD H1, overall accuracy was ~55%, rising to ~65–70% when trading only high-confidence predictions, making it useful for regime detection, signal filtering, and risk s...

πŸ‘‰ Read | Signals | @mql5dev

#MQL5 #MT5 #AlgoTrading
❀27πŸ‘4πŸ‘Œ2
Raw candlesticks inject short-term noise into algorithmic rules, making signals brittle and backtests harder to validate. This Renko overlay indicator addresses that by discretizing price into fixed brick steps and drawing the result directly on the MT5 chart.

Brick generation is anchored to a deterministic base: the first available candle close. Each new candle close is compared to the latest confirmed brick close; price change divided by the user-defined brick size yields the number of full bricks to append, while partial movement is ignored until completed.

Trend handling is explicit: continuation builds normally, but reversals require an opposite move of two bricks before switching direction, filtering shallow pullbacks. Bricks are stored in a dynamic close-price array, rendered as rectangle objects, capped by a max-history setting, and updated effi...

πŸ‘‰ Read | Signals | @mql5dev

#MQL5 #MT5 #Indicator
❀34πŸ‘9πŸ‘Œ3
Retail trading systems often base stop-loss distance and position sizing on Average True Range. ATR is a trailing statistic, so it can understate risk during regime changes and react late during shock events.

A common institutional approach is conditional variance forecasting with GARCH(1,1). Rather than averaging ranges, it models next-period variance from return shocks and volatility persistence, capturing clustering where large moves tend to be followed by large moves.

A practical implementation computes log returns and updates variance using standard parameters often seen in finance (alpha 0.09, beta 0.90), while keeping them configurable for calibration. Running the calculation natively in C++ avoids external runtime dependencies.

In execution logic, the forecasted variance stream can drive adaptive risk controls: expand stop distances or reduce...

πŸ‘‰ Read | Freelance | @mql5dev

#MQL5 #MT5 #AlgoTrading
❀21πŸ‘Œ3πŸ‘1
Forex forecasting sits between β€œno edge” randomness and exploitable structure. The article starts with an EA that flips direction randomly each new bar; results stay negative once spread is accounted for, showing why execution costs matter.

Adding realistic constraints (hold time, single position, SL/TP exits) turns the same random core into something that can be optimized. Seed selection becomes a search problem, with the secretary problem suggested to reduce brute-force runs.

From there, it builds data-driven signals: an empirical distribution of price increments (trim extremes to form a probabilistic channel), a simplified linear-trend rate updated to stabilize forecast error and tied to SMA, and a random-walk exponent estimated via log-scaled path length vs time to classify flat vs trend.

Finally, it explores polygonal-number weighted averages as...

πŸ‘‰ Read | Quotes | @mql5dev

#MQL5 #MT5 #AlgoTrading
❀21πŸ‘Œ3πŸŽ‰2πŸ‘1
A next-generation trading EA concept combines three components: Markov state modeling, an MLP used on transition probabilities, and a hedging-aware execution layer.

Market β€œstate” is defined as a multi-factor vector, not raw price. Daily change is normalized by ATR to classify three regimes (up, down, flat), keeping thresholds volatility-adjusted across instruments.

A 3x3 transition matrix is built from the last window of bars, with fallback to uniform probabilities when a state is absent. The MLP consumes the 9 matrix elements (9-40-2, ReLU) and outputs up/down probabilities. Retraining runs every 48 hours.

Execution can hold long and short simultaneously when both probabilities are elevated, with constraints on max positions and minimum entry distance. Reported tests cite ~28.7% annual return at 14.2% max drawdown (Sharpe 1.65), with EURUSD optimization...

πŸ‘‰ Read | VPS | @mql5dev

#MQL5 #MT5 #EA
❀31πŸ‘Œ3πŸ†3✍2πŸ‘2πŸ‘€2🀯1