MQL5 Algo Trading
581K subscribers
4.7K photos
7 videos
4.71K 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
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πŸ‘17🀩12πŸ”₯8πŸ‘Œ3πŸ‘¨β€πŸ’»3
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
❀26πŸ‘23πŸ”₯13🀩8⚑2πŸ‘Œ2
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
❀60πŸ”₯16πŸ‘14🀩8⚑4πŸ†2πŸ‘€2
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
❀37πŸ‘17🀩11πŸ”₯9✍8πŸ‘4πŸ‘¨β€πŸ’»4
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
❀78πŸ‘23πŸ”₯15🀩10πŸ‘€7πŸ‘Œ6πŸ‘¨β€πŸ’»2
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
❀43πŸ‘7πŸ”₯5⚑3🀩3πŸ‘Œ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
❀19πŸ‘11πŸ”₯5🀩4πŸ‘Œ2πŸ‘¨β€πŸ’»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
❀31πŸ”₯6🀩4πŸ‘3πŸ‘Œ3πŸ‘¨β€πŸ’»2
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
❀19πŸ‘8🀩3πŸ”₯2⚑1πŸŽ‰1πŸ‘Œ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
❀19πŸ‘7🀩3πŸ‘Œ1πŸ†1
Refactor proposal for MQL5 divergence logic: extract oscillator, pivot detection, divergence classification, and state tracking from Adaptive SuperTrend into a reusable header, DivergenceEngine.mqh.

The module owns settings, optional RSI handle, buffers, and state (last pivots, divergence type, bars-since). Public access stays narrow: last divergence type, age, oscillator value, reset, and required lookback.

Integration pattern stays consistent across indicators and EAs: init engine, compute lookback, resize buffers, seed boundary at limit+1, refresh RSI buffer if selected, run a backward per-bar loop calling CalculateOscillator and DetectDivergence, then query and act outside the engine, and release on deinit.

Demonstration case uses Parabolic SAR: adapt its Acceleration Factor when an opposing divergence is recent, highlighting reuse without coupling to ...

πŸ‘‰ Read | AlgoBook | @mql5dev
❀18πŸ‘5πŸ”₯2🀩2πŸŽ‰1πŸ‘Œ1
ST-Expert reframes forecasting as a spatiotemporal problem: price history plus a dynamic network of cross-asset links. Using a Mixture of Experts, it shifts weight between specialist blocks as market drivers change, improving resilience, and exposing which relationships influenced a signal.

The article moves from concept to MQL5 implementation by integrating ST-Expert components into Extralonger’s three-route Transformer (temporal, spatial, mixed). A key idea is replacing classic Self-Attention’s Query/Key logits with a graphon-derived connectivity graph, keeping only Value paths.

A new CNeuronGraphAttention module builds attention from ST-Expert graphs, applies SoftMax to produce interpretable weights, and uses residual paths to retain contextβ€”aiming for fewer noise-driven signals when correlations break or rotate.

πŸ‘‰ Read | Docs | @mql5dev
❀16πŸ‘4πŸ”₯2🀩2⚑1πŸ‘Œ1πŸ†1
Media is too big
VIEW IN TELEGRAM
With Model Context Protocol (MCP), AI can work directly with MetaTrader 5 data and tools β€” turning the built-in AI Assistant into an agent capable of handling complex, multi-step tasks.

Analyze markets and trading history, review open positions, work with charts, test and optimize Expert Advisors, and perform supported trading operations β€” all through natural-language instructions.

Instead of manually collecting data and switching between tools, simply describe what you want to achieve and let the AI Assistant coordinate the necessary steps.

Watch the video to see how MCP works in MetaTrader 5 and explore practical AI workflows for trading, analysis, and algorithmic development.

Discuss the video:
πŸ‘‰ MQL5.community for traders
πŸ‘‰ MetaQuotes official YouTube channel
❀28πŸ‘4πŸ”₯4🀩4πŸ€”1πŸ‘Œ1πŸ†1
Running one strategy across multiple symbols and hours creates separate variants, and account-level metrics can hide where performance differs. A dashboard script addresses this by grouping closed deals by symbol and UTC closing hour, then computing win rate and payoff-based edge ratio per cell.

The pipeline reduces each deal to symbol, close-hour, and net profit, aggregates into symbol-hour cells, and renders two CCanvas heatmaps: win rate and edge ratio. Undefined ratios (all wins or all losses) are explicitly flagged and shown as neutral cells, not zero.

Breakeven deals count toward volume but are excluded from win/loss buckets to avoid ratio distortion and divide-by-zero. An Experts-tab table lists best and worst symbol-hour combinations by win rate with minimum-trade filtering. Limitations include linear scans, fixed color boundaries, server-time a...

πŸ‘‰ Read | AppStore | @mql5dev
❀18πŸ‘6🀩2πŸ‘Œ2πŸ‘€2⚑1πŸ”₯1
Adaptive EA design using random graph theory instead of a fixed market map.

A state-transition network encodes each closed bar via EMA spread/ATR, ATR regime, and optional RSI buckets, producing 45 states. Transitions update a decayed, Laplace-smoothed Markov matrix. A k-step matrix power yields the distribution k bars ahead, converted into a bounded directional expectation plus an entropy-based confidence gate.

A second outcome graph manages exits as an R-multiple random walk across milestones. Smoothed survival probabilities trigger closes when the next hop becomes unlikely.

A structural filter binarizes edges above a uniform baseline, measures clustering, then compares it to an Erdos–Renyi G(n,p) null via z-score. Near-zero separation is treated as a β€œstay flat” condition.

πŸ‘‰ Read | AppStore | @mql5dev
❀20πŸ‘5πŸ”₯4⚑2🀩2πŸ‘Œ2πŸ‘€1
Markov chains offer a practical way to model market uncertainty by turning price behavior into discrete states and estimating transition probabilities between them. The key constraint is β€œmemorylessness”: forecasts depend only on the current state, which can still work well for changing, nonstationary conditions.

The article shows two implementations: a simple 3-state regime model (down/flat/up) using a transition matrix, and a richer chain built from price differences bucketed into multiple states. Forecasts can be generated step-by-step via vector–matrix multiplication, with accuracy degrading as multi-step probabilities flatten.

It also extends beyond forecasting: a 2-state win/loss chain updates in real time to adjust expected value and win probability after each trade, enabling adaptive position sizing and risk-aware scenario planning in MT5 s...

πŸ‘‰ Read | Freelance | @mql5dev
❀16πŸ”₯9🀩4πŸ‘Œ2πŸ‘€1
MetaTrader 5 Build 6060 adds an AI Assistant plus MCP support as a native natural-language access layer for development, debugging, chart interaction, testing, and permission-controlled terminal actions. This reduces reliance on WebRequest, local middleware, external APIs, JSON parsing, and related credential and lifecycle management.

MCP changes the integration path, not MQL5 responsibilities. The assistant can generate and review code, but a compiled EA still enforces deterministic signal, risk, execution, and logging rules. Trading permissions remain bounded by terminal AI/MCP settings and separate EA-level switches.

A reference EA, MCP_Accessibility_Assistant.mq5, is built around explicit state output (BUY SETUP, SELL SETUP, WAIT, DATA ERROR), confirmation gating, and audit logging. It uses closed-bar EMA crossover signals, ATR-based stops, reward-to...

πŸ‘‰ Read | VPS | @mql5dev
❀28πŸ‘8πŸ”₯7πŸ‘¨β€πŸ’»4🀩3πŸŽ‰1πŸ‘Œ1
Many EAs persist state in terminal global variables (balances, locks, heartbeats, last trade times). Over time this builds up, while the F3 viewer remains unsorted, unfiltered, and provides no backup. After a restart, diagnosing unexpected behavior often depends on identifying which variable was read.

Global Variable Inspector addresses this with snapshot-based inspection. It filters and sorts variables by name, then prints name, value, last access time, and age to the Experts journal. Whole-number values between years 2000–2100 are additionally rendered as dates to expose timestamp usage. Snapshots can also be exported to CSV, deleted with a mandatory backup step, or restored later via import.

Notable behavior: reading a variable updates its access time and extends expiry. The script avoids refreshing non-matching entries by collecting names and access times...

πŸ‘‰ Read | VPS | @mql5dev
❀19πŸ‘8🀩6πŸ”₯5πŸ‘Œ2⚑1✍1
SensibleGuide_MTF_H1 is an H1 indicator that gates signals through multi-timeframe confluence and explicit risk constraints. Trend is scored via EMA alignment (10/20/50/100/200) with an optional minimum alignment threshold before any setup is considered.

Higher-timeframe modules load closed-bar data only and compute EMA bias plus confirmed swing points for H4, D1, and W1. The CHtf layer refreshes rates and EMA buffers, confirms swings with strength-based validation, and uses binary search to reference the last closed bar at a given H1 close time, supporting non-repainting decisions.

Support/resistance is aggregated into a capped level list: round numbers, H1 swings, long EMAs, Bollinger bands, Fibonacci from the screening timeframe, higher-TF EMAs/swings, and previous day levels. A k...

πŸ‘‰ Read | Calendar | @mql5dev
❀13πŸ‘11🀩7πŸ”₯6🀯2πŸ‘Œ2✍1
Symbol Spec Auditor consolidates contract specification details that affect risk and trading cost into a single on-chart panel. It converts key inputs into money per 1.00 lot in the account currency, then flags broker settings that can break lot sizing or order management without any journal errors.

The panel covers point and tick metrics, contract size, spread cost, margin, swap, volume constraints, execution and filling policies, GTC behavior, stops and freeze levels, and today’s trading sessions. Values that cannot be computed are marked n/a with the reason, and warning rows are highlighted with a one-line consequence.

Common triggers include non-standard contract sizes (e.g., XAUUSD 1 oz vs 100 oz), cent-denominated accounting, tick size not matching point, minimum volume/step forcing rounding, close-only modes, end-of-day order deletion, and unu...

πŸ‘‰ Read | Calendar | @mql5dev
❀23🀩8πŸ”₯5πŸ‘4πŸ‘Œ3✍1