MQL5 Algo Trading
503K subscribers
3.28K photos
2 videos
3.28K 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
Candle Range Theory levels on H1/H4/D1 often disappear on execution charts, causing lower-timeframe moves to be misclassified. A practical fix is an MTF overlay that plots higher-timeframe candle range, body, and wicks directly on the active chart.

An MQL5 indicator addresses this by mapping each lower-timeframe bar to its parent HTF candle with time-accurate anchoring, confirming setups only after the HTF candle closes to avoid repainting, and rendering the full OHLC structure as persistent zones.

Implementation details include HTF data loading via Copy* calls, a binary-search index map, CRT pattern checks evaluated only on HTF-close bars, and automatic drawing of range rectangles plus entry/TP/SL lines. Optional filters handle Sundays and small-gap candles, with alerts and performance safeguards for large histories.

πŸ‘‰ Read | Freelance | @mql5dev

#MQL5 #MT5 #Indicator
❀20πŸ‘Œ2
Clock-time bars encode equal information per minute, which fails under variable tick density and injects heteroscedasticity before feature generation.

AFML Chapter 1 bar types are implemented in two runtimes: a unified Python make_bars() module for batch tick histories, and an MQL5 library for event-driven bar building inside an EA. Output parity is validated on identical tick streams.

Production issues addressed include out-of-core tick loading via partitioned Parquet plus Dask, broker-feed cleanup (zero/negative spreads, duplicates, NaT timestamps), removal of zero-tick time bars, and imbalance-bar thresholds driven by O(1) EWM updates. EWM state persistence avoids resets across EA restarts.

πŸ‘‰ Read | Calendar | @mql5dev

#MQL5 #MT5 #AlgoTrading
❀24πŸ”₯5πŸ‘Œ3
Five-year H1 test on US_TECH100 (AvaTrade broker feed, 29,646 bars) evaluated MACD(12,26,9) histogram crossovers with ATR(14) exits: SL 2.5 ATR, TP 3.0 ATR, 48-bar timeout. Trades normalized to R, pessimistic same-bar fills assumed.

Filter impact was measured incrementally: regime (ADX + rolling ATR percentiles), then EMA200 alignment, then a US-session window (14:00–20:00 broker time). Raw MACD: 2,213 trades, 46.5% win rate, +0.017R expectancy, PF 1.03, max DD -28.8R. Regime and HTF filters changed little and slightly degraded expectancy.

Session filtering was the primary driver: 195 trades, 50.3% win rate, +0.100R expectancy, PF 1.20, max DD -9.7R. Regime breakdown showed RANGE negative, VOLATILE positive, contradicting common filter assumptions.

πŸ‘‰ Read | VPS | @mql5dev

#MQL5 #MT5 #Indicator
❀25πŸ‘9✍2πŸ‘Œ2πŸ†1
Minute-level NQ logic around the New York open fails most often through silent numeric faults: NaN/Inf, overflow from near-zero denominators, log of non-positive prices, missing/zero closes near history edges, and unstable variance from tiny samples. These values propagate as plausible numbers and corrupt downstream signals.

A defensive MQL5 foundation layer is specified as a single include file for CopyClose/SymbolInfoDouble workflows. It enforces minimum sample sizes, validates price arrays, bounds math outputs, and provides stable statistical and spectral primitives.

Core components include guarded math (SafeDivide, SafeLog, SafeSqrt, SafeExp, SafeTanh), validated data access (ValidateSymbolV2, SafeCopyClose), two-pass and trimmed estimators, a centralized OLS slope, shared result structs with status codes, and a single radix-2 FFT reused across mod...

πŸ‘‰ Read | NeuroBook | @mql5dev

#MQL5 #MT5 #AlgoTrading
❀16πŸ†6πŸ‘Œ3
This refactor rebuilds an MT5 drawing tools palette that became brittle due to mixed rendering, layout, theme values, and event handling. The solution replaces the flat code with a layered, single-responsibility sidebar architecture where extending features becomes additive rather than a rewrite.

Key building blocks include a category registry (labels, icon glyphs, multi-tool flags), a theme manager that swaps full color sets for dark/light modes, and a canvas layer that owns chart bitmap labels and supports dynamic resizing.

Rendering quality is improved with supersampled CCanvas drawing: alpha blending, downsampling, and anti-aliased rounded rectangles with per-corner control for edge snapping. Practical result: a compact sidebar that snaps to chart edges, toggles theme instantly, and scales cleanly as more tool groups are registered.

πŸ‘‰ Read | AppStore | @mql5dev

#MQL5 #MT5 #Indicator
❀16πŸ‘4πŸ‘Œ1
Hardcoding min_ret in triple‑barrier labels hides the biggest source of false signal: broker- and session-specific transaction costs. A reproducible pipeline solves this by measuring costs per symbol and converting them into a labeling threshold aligned with the real execution environment.

An MQL5 script samples spread history via CopySpread(), captures swap metadata with SymbolInfoDouble(), and exports a structured CSV including spread percentiles plus hourly spread means. This makes costs session-aware instead of relying on a single average.

A Python TransactionCostModel ingests the CSV, normalizes spread, slippage, commission, and swap into fractional-return units, and exposes min_ret_for_symbol() and diagnostics. Swap handling covers broker swap modes and triple-swap days, preserving carry credits instead of forcing abs().

The same model param...

πŸ‘‰ Read | Signals | @mql5dev

#MQL5 #MT5 #AlgoTrading
❀22πŸ‘5πŸ‘Œ2
Manual news trading still suffers from context switching between browser calendars and the MT5 terminal. That gap creates reaction delays, inconsistent execution, and strategies that cannot be validated on historical data or scaled with repeatable rules.

A practical architecture in MT5 is a dedicated news layer built on the terminal’s Economic Calendar and MQL5 API: single data source, cache + filters, exportable history for Strategy Tester, and automatic Live/Tester switching so identical code paths stay deterministic.

Key API usage patterns: CalendarValueHistory for bulk preloading, CalendarValueLast with change_id for incremental updates, and CalendarEventById/CalendarCountryById for metadata joins. Use TimeTradeServer for consistent time windows, and handle 5200/5201 retries while avoiding 5204 by timer-based polling.

πŸ‘‰ Read | Calendar | @mql5dev

#MQL5 #MT5 #AlgoTrading
❀20πŸ‘4πŸ‘Œ1
Prime Quantum AI is an MT5 Expert Advisor that combines a classical trend pre-filter (ADX + Alligator with DI+/DI-) with vision-based chart analysis via external AI providers.

The decision flow is two-stage. On each tick, the selected timeframe is checked for a bullish or bearish trend setup using configurable ADX thresholds and Alligator alignment. If a signal is present, the EA captures three screenshots (entry, mid, context) from adaptive timeframes derived from the TF input and submits them to the chosen provider.

The provider returns JSON: direction, confidence (0–100), stop-loss, take-profit, and reasoning. Orders are placed only when AI direction matches the pre-filter and confidence exceeds the minimum threshold, with scan cooldown controlled by InpScanIntervalSec.

Operational notes include multiple risk modes, AI or fixed SL/TP options, ATR trail...

πŸ‘‰ Read | AppStore | @mql5dev

#MQL5 #MT5 #AITrading
❀18πŸ‘6πŸ‘Œ1
GPT is broken down into a decoder-only Transformer: stacked blocks with multi-head self-attention and a two-layer feed-forward module, trained via large-scale unsupervised pretraining and smaller supervised fine-tuning. The key constraint is compute and memory, which shapes implementation choices.

The article implements a flexible GPT-style block for MetaTrader 5 using OpenCL. It replaces hard-coded attention threads with parameterized heads and layers, stores Q/K/V in a single combined tensor, and parallelizes all heads inside kernels to scale without rewriting code.

The feed-forward path is organized as a top-level loop over blocks, calling helper kernels for QKV projection, score computation with causal restriction, attention output folding, residual connections, and normalization, then a 2-layer feed-forward stage. Practical focus: managing GPU objects and bu...

πŸ‘‰ Read | Calendar | @mql5dev

#MQL5 #MT5 #AI
❀49πŸ‘Œ4⚑2πŸ‘2πŸ‘€1
Interactive correlation matrix dashboards can reduce guesswork by showing cross-symbol relationships directly on the chart. A live heatmap highlights positive and negative correlations with high-contrast colors, while also displaying exact Pearson coefficients to separate weak alignment from near-lockstep movement.

Usability focuses on trading workflows: the panel can be dragged to avoid obscuring price, and a one-click minimize mode keeps only the title bar visible. Timeframe switching across D1, H4, H1, and M15 helps distinguish structural correlation from short-lived intraday effects.

Practical applications include managing exposure when multiple positions share the same underlying driver, identifying negatively correlated pairs for hedging during volatility, and validating moves across related markets such as gold versus AUDUSD. The matrix can al...

πŸ‘‰ Read | Quotes | @mql5dev

#MQL5 #MT5 #Indicator
❀20πŸ‘4⚑1πŸ‘Œ1
Swap Monitor Panel is a lightweight MT5 indicator that overlays a live swap dashboard on the chart. It reads every symbol from the MarketWatch list and displays long swap, short swap, and estimated daily and weekly costs side by side in a compact table.

Swap conversion supports all MT5 swap modes, including points, currency variants, and interest-based calculations using current or open price. Monetary estimates are derived from symbol contract specs, tick value, and a configurable reference lot size.

The panel refreshes on a 5-second timer and can also be refreshed with a click. Sorting is configurable by symbol, best long swap, best short swap, or best daily cost. Optional highlighting marks the most favorable long or short swap for faster carry comparison.

Layout controls include minimize and close buttons, X/Y positioning, font settings, and tog...

πŸ‘‰ Read | Freelance | @mql5dev

#MQL5 #MT5 #Indicator
❀26πŸ‘5⚑1πŸ‘Œ1
WaterMark MT5 is a lightweight MT5 indicator focused on chart annotation and layout consistency. It renders a dynamic label for the active symbol and timeframe, updating immediately on chart changes and supporting both default and custom timeframes.

Two additional text fields are available for user-defined labels such as strategy notes, desk identifiers, or internal reminders. Placement is controlled via corner selection plus X/Y offsets, with configurable font family, size, and color to match existing templates across light and dark themes.

Implementation is positioned as CPU-efficient and designed to coexist cleanly with Expert Advisors without adding terminal overhead. Usage is straightforward: attach to any chart and adjust inputs to standardize presentation for analysis notes and shared screenshots.

πŸ‘‰ Read | Signals | @mql5dev

#MQL5 #MT5 #Indicator
❀36πŸ‘Œ1🀑1
Multi-symbol tick storage is extended to support real-time growth of per-symbol tick series, not only initial history loads. A per-instrument cap (default 200,000 ticks) is added to bound memory, with automatic eviction of the oldest ticks when limits are exceeded.

Tick updates handle batch arrivals by tracking the last tick timestamp in milliseconds and copying from last_time + 1 ms via CopyTicksRange(). The same add-object logic is reused for both initial series creation and incremental refresh. Current symbol updates run in OnTick(), while non-chart symbols are refreshed via a dedicated library timer.

Symbol objects gain DOM subscription state and lifecycle management. MarketBookAdd() is called on demand, and MarketBookRelease() is enforced in the destructor to guarantee matched unsubscribe behavior.

πŸ‘‰ Read | NeuroBook | @mql5dev

#MQL5 #MT5 #AlgoTrading
❀47πŸ‘2πŸ‘Œ2
Weekend gap reversion is often treated as a certainty, but results depend on instrument-specific statistics. A Weekend Gap Statistics & Distribution Analyzer measures how frequently gaps close, expected favorable movement, and the adverse movement typically seen before closure.

The tool separates results into three windows: last 5 gaps, last 12 months, and full history. It tracks gap size plus MFE and MAE to quantify reward versus required drawdown. Percentile-based TP levels show how many points 95/70/50/25% of gaps reached, while SL survival percentiles show the heat tolerated by gaps that eventually closed.

Configuration includes a minimum gap size in points and a capped bar lookback for performance. Output is shown in a small lower-left dashboard with automatic light/dark text for chart readability.

πŸ‘‰ Read | Freelance | @mql5dev

#MQL5 #MT5 #Indicator
❀22πŸ‘4πŸ‘Œ1
Packing an MQL5 EA into OnTick scales into a fragile monolith where UI, filters, execution, and logging collide. MetaTrader 5 is event-based, so logic should follow the platform’s model: OnInit/OnDeinit for lifecycle hygiene, OnTick for market reactions, OnTimer for periodic background work, OnChartEvent for UI and inter-module messaging, OnTradeTransaction for order lifecycle tracking, and OnBookEvent for depth-driven strategies.

Custom events (EventChartCustom) act as an internal message bus across modules and even across charts, enabling multi-symbol systems without tight coupling. This improves responsiveness and testability by isolating behaviors per handler and avoiding long blocking routines.

Services extend the architecture beyond charts, running continuous background tasks in OnStart (data sync, custom symbol ticks, scheduled signals) and coordinating ...

πŸ‘‰ Read | AppStore | @mql5dev

#MQL5 #MT5 #EA
❀22⚑1πŸ‘1πŸ‘Œ1
Media is too big
VIEW IN TELEGRAM
We’ve released a new video on one-click trading in MetaTrader 5 β€” a feature that lets you open and manage trades instantly, without extra confirmations.

Execution speed plays a critical role in trading. In this video, you will see how the platform's built-in tools allow you to place market orders instantly, manage positions directly on the chart, and react quickly to market changes.

βœ“ Watch this short video to learn how to:
βœ“ Enable the feature and trade without additional confirmations
βœ“ Open trades in one click from the on-chart panel
βœ“ Use trading panels in the Market Watch window
βœ“ Set Stop Loss and Take Profit by simply dragging levels
βœ“ Instantly close positions and remove protective levels
βœ“ Place and modify pending orders directly on the chart
βœ“ Use Depth of Market for fast trades and order management

One-click trading in MetaTrader 5 means maximum speed, convenience, and full control over your positions.

Discuss the video:
πŸ‘‰ MQL5.community for traders
πŸ‘‰ MetaQuotes official YouTube channel
❀17πŸ‘8πŸ”₯4πŸ‘Œ2πŸ‘€1
Grid-searching PT/SL on historical Sharpe is statistically fragile. Two free parameters will often select a rule that fits path-specific noise rather than the underlying trade P&L process, matching the LΓ³pez de Prado overfitting criterion.

A process-based alternative estimates a discrete Ornstein–Uhlenbeck model on cost-adjusted per-trade P&L, then derives PT/SL via OTR on 100,000 synthetic paths. SL is bounded by risk constraints; PT is driven by the forecast assumption.

The forecast is the key modeling choice. forecast=0 implies mean-reversion. forecast=E[P&L] is conservative directional. forecast=E[win] is optimistic directional. Units (pips vs returns) are a linear rescale; phi/half-life is invariant. Numba makes the sweep practical on a single machine.

πŸ‘‰ Read | NeuroBook | @mql5dev

#MQL5 #MT5 #EA
❀25✍7πŸ”₯4πŸ‘1
A two-stage MQL5 indicator design uses ALGLIB matrix.mqh (CMatrixDouble) to compute a rolling Market Score from trend, momentum, and volatility.

Trend is linear-regression slope over a sliding price window. Momentum is end-to-start delta. Volatility is window standard deviation. Score = wTrend*trend + wMom*momentum - wVol*volatility, evaluated on closed bars to avoid future leakage.

Stage 1 is a separate-window oscillator to validate math and scaling. Stage 2 moves to the main chart with threshold-cross arrows, optional 200-EMA direction filter, MinBarsBetween cooldown, and one alert per bar with state tracking.

πŸ‘‰ Read | Calendar | @mql5dev

#MQL5 #MT5 #AlgoTrading
❀24
MetaTrader 5 time-based candles can mask true activity: a 1-minute bar built from hundreds of ticks looks like one built from a handful. The article implements tick bars where each candle closes after N ticks, making charts reflect trade intensity for scalping and tick-driven systems.

An EA creates a dedicated custom symbol (cloned from the source instrument) and configures key properties like digits, point, and tick size, then optionally opens a chart for that symbol and avoids duplicates by scanning existing charts.

On every OnTick, the EA reads live prices, aggregates ticks into OHLC, assigns monotonic timestamps, and pushes both the forming bar and completed bars to the terminal via CustomRatesUpdate for real-time rendering.

πŸ‘‰ Read | VPS | @mql5dev

#MQL5 #MT5 #AlgoTrading
❀47πŸ‘Œ6πŸŽ‰3πŸ†3✍2πŸ‘1
John Ehlers published an alternative RSI calculation as part of a broader indicator set, commonly referenced as MyRSI. Due to material differences versus the platform’s standard RSI, a standalone implementation is often justified for testing and integration in existing workflows.

Key differences are structural. Output is normalized to the -1 to 1 range rather than 0 to 100, making the zero line a practical reference for regime changes. Because the scaling and internal math differ, values are not directly comparable to standard RSI levels, and common thresholds such as 50 do not translate as equivalent signals.

Operationally, it can still be used in typical RSI-style setups, with thresholds and triggers recalibrated to the normalized range.

πŸ‘‰ Read | Docs | @mql5dev

#MQL5 #MT5 #Indicator
❀20πŸ‘7πŸ‘Œ2
Malaysian Engulfing is treated as a strict, code-friendly engulfing variant for MT5/MQL5, addressing two gaps: inconsistent real-time detection and lack of post-signal context.

The rule set is unambiguous. Bullish: a bearish candle followed by a bullish candle opening at or below the prior close and closing above the prior high. Bearish: a bullish candle followed by a bearish candle opening at or above the prior close and closing below the prior low.

The workflow is split into two indicators. A strict detector renders arrows only for β€œperfect” candidates. A retest validator runs a lightweight state machine (SEARCH β†’ FOUND β†’ reset/confirm), defines a high/low zone, enforces invalidation, limits retests via barsRetestRange, and confirms returns with a wickThreshold filter.

Output is deterministic: arrows, rectangles, and confirmation events suitable for bac...

πŸ‘‰ Read | NeuroBook | @mql5dev

#MQL5 #MT5 #Indicator
❀27⚑4πŸ‘2πŸ‘Œ1