MQL5 Algo Trading
575K subscribers
4.46K photos
7 videos
4.47K 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
ATS Liquidity City plots likely stop locations and marks which pools were swept on the current server day.

Liquidity pools are defined as confirmed swing highs/lows using N bars on each side (default 5), equal highs/lows when multiple swings fall within 0.10 x ATR(14), and yesterday’s high/low valid for today only. Equal levels increase pool size and are rendered with thicker lines.

A sweep is flagged on the first closed bar that trades beyond a pool. If the bar closes back inside it is marked grabbed & rejected, otherwise taken. Active pools render as solid lines with labels and prices; swept pools are dotted and retained for 300 bars. Tooltips show type, price, and status.

The panel reports nearest pools above/below in ATR distance, and a taken-today ticker. For developers: buffers expose sweep arrows and nearest active levels; the panel uses a 5...

πŸ‘‰ Read | AlgoBook | @mql5dev
❀32πŸ‘10πŸ”₯6🀩5πŸ‘Œ2🀣2
Arixis Backtest Robustness Analyzer is a free, open-source utility for MetaTrader 5 focused on evaluating backtest robustness beyond Profit Factor, net profit, and win rate. It operates on closed trade history and reports how results were generated, including average/median trade, best and worst trades, streaks, percentiles, and sample-size context.

Dependency and sensitivity checks recalculate outcomes after removing top or bottom trades to quantify concentration and the impact of extremes. When net profit is non-positive, dependency ratios are suppressed to avoid misleading percentages while still showing adjusted net results.

The tool reconstructs a closed-equity curve to analyze drawdown depth, underwater time, and recovery, with the limitation that intratrade floating drawdown cannot be derived from closed history alone. Time and direction breakd...

πŸ‘‰ Read | AppStore | @mql5dev
❀23πŸ”₯9πŸ‘6🀩5πŸ‘Œ2
Many EAs lose consistently, but reversing trades is not a shortcut to profitability. A mirrored inverse pays trading costs again, so results are not a simple sign flip. Real execution also changes outcomes due to spread side, slippage, swaps, and SL/TP path dependency.

MirrorHedgeEA mirrors another EA’s or manual trades inside the same account and broker, with no cross-account communication. It syncs the full trade lifecycle: market and pending orders, SL/TP changes, partial closes, closures, and deletions. Each mirror trade is tagged with a derived magic number suffix and a comment suffix for clean separation in history.

Configuration supports magic-number pattern matching, multiple lot sizing modes, inverse direction with TP/SL swapping, and restart-safe source/mirror linking. Designed for hedging accounts and intended as a measurement tool to evaluate in...

πŸ‘‰ Read | Freelance | @mql5dev
❀26πŸ‘8πŸ”₯6🀩3πŸ†3πŸ‘Œ2
Intrinsic-time trading replaces bar-based sampling with event-based sampling driven by price reversals. A clock tick is generated only when price moves by a fixed threshold delta from the last extreme (directional change), with subsequent continuation treated as overshoot. The resulting sequence of events forms the β€œcoastline” representation used by Olsen-group research.

An MQL5 Expert Advisor ports the Alpha Engine coastline trader: eight independent agents (long-only and short-only) across four thresholds (0.25%, 0.5%, 1%, 1.5%). Agents trade via limit orders on hedging accounts, cascading into adverse moves and de-cascading via fixed take-profits set at delta. Adds are in fixed increments, explicitly not martingale.

Risk shaping comes from inventory-driven threshold skew, fractional sizing, and an information-theoretic liquidity metric L that cuts adds i...

πŸ‘‰ Read | Signals | @mql5dev
❀13πŸ‘7🀩5πŸ”₯4πŸ‘Œ4✍2πŸ†1
Position sizing often relies on win rate alone, while ignoring the probability of long loss runs that can breach drawdown limits at a given risk-per-trade.

A MetaTrader 5 dashboard script can quantify this from history: empirical win rate, average win, average loss, and observed max losing streak, with breakeven deals excluded from win/loss stats and treated as streak breakers.

Consecutive-loss probabilities use the geometric tail P(streak β‰₯ N)=q^N, where q=1βˆ’p, giving immediate estimates for 5/10/15/20-loss runs without simulation.

Risk of ruin is computed from normalized edge A and risk units U=100/risk%, with RoR=((1βˆ’A)/(1+A))^U and a hard clamp to 1.0 for A≀0.

A CCanvas plot traces RoR versus risk-per-trade and marks the current setting; an Experts-tab report prints streak odds and current ruin probability, with limits noted around independence, r...

πŸ‘‰ Read | Freelance | @mql5dev
❀18πŸ‘6🀩5πŸ‘Œ4πŸ”₯2
MACD signal-line crossovers fail structurally in ranges: tiny sign flips in the MACD histogram can trigger frequent reversals with no information about momentum magnitude or persistence. On EURUSD H1 (2018–2024), this produces heavy whipsawing and large drawdowns out of sample.

A two-layer meta-labeling pipeline keeps the classic crossover for direction, then adds: (1) an Optuna-tuned regime gate requiring histogram magnitude vs ATR, persistence across several bars, and optional MACD zero-line agreement; (2) a secondary classifier that sizes positions by the predicted probability of hitting a triple-barrier profit target before a stop.

Context features mix MACD diagnostics (separation, slope, chop counts), external regime measures (ADX, volatility percentiles, EMA distance), and session timing. Results show the gate dramatically reduces trade count...

πŸ‘‰ Read | AlgoBook | @mql5dev
❀21πŸ”₯11πŸ‘6πŸ‘4🀩3⚑2πŸ‘Œ2
Automatic trendline generation is added to an MT5 framework without diluting the existing β€œlive object” lifecycle (touch, bounce, break). Creation and management stay separate: CTrendlineBuilder converts swing structure into validated bullish (higher lows) and bearish (lower highs) candidates, then creates chart objects with deduplication checks.

CTrendlineManager remains the orchestrator: it updates existing managed lines first, then runs ScanAndBuild(), discovers unowned chart objects, and registers them. After registration, every line becomes a CManagedTrendline and follows the same state machine for proximity, confirmations, resurrection windows, and expirationβ€”using the same live-drag and closed-bar evaluation paths.

The system also reconciles orphaned chart objects and centralizes direction-aware rendering, so visuals reflect both geometry and ...

πŸ‘‰ Read | CodeBase | @mql5dev
❀20πŸ‘5🀩5πŸ”₯3πŸ‘¨β€πŸ’»2πŸ‘Œ1
Flock by Leader (FBL) targets a common swarm-optimization failure mode in trading parameter searches: fast convergence to a single point that kills exploration. It builds multiple concurrent β€œhotspots” while keeping computation bounded.

Agents are split into sub-flocks using ARF, a density metric derived from k-nearest-neighbor direct and reverse neighborhoods. Dense-core agents become centroids, nearby agents join the best-ranked centroid, and the number of sub-flocks is capped to avoid fragmentation.

Leadership is fitness-driven: the leader is the member with the best personal best, not the centroid. Leaders exploit using inertia plus pulls to personal best and global best (phi). Followers combine cohesion, velocity alignment (using saved pre-update velocities), personal-memory pull, global pull, and separation (wSep) to prevent collapse. Outlier...

πŸ‘‰ Read | Freelance | @mql5dev
❀18πŸ‘6πŸ‘Œ3πŸ”₯2
MetaTrader 5 build 6060 turns the AI Assistant into a tool-using agent wired directly into MetaEditor and the terminal via MCP. It can generate an EA from a strategy description, compile with the real MQL5 compiler, interpret diagnostics, apply fixes, and iterate through Strategy Tester runs.

Under the hood it uses the Goose agent framework, loading separate MCP servers for editor tooling, terminal operations (charts, ticks, orders, tester), plus a MetaQuotes-hosted marketdata service for instrument search, fundamentals, and news. Sessions, tool calls, and token usage are locally recorded.

Control is explicit: model/provider can be cloud or local, and permissions gate trading, web access, and shell/file operations. The practical value is a closed loop from code to backtest, with guardrails suitable for live accounts.

πŸ‘‰ Read | Calendar | @mql5dev
❀20πŸ‘2πŸ‘Œ2πŸ†2
Prop Firm Risk Calculator is an on-chart panel for funded and prop firm accounts focused on position sizing and loss-limit planning. It is a calculator only and does not generate signals or place orders.

The panel displays risk per trade in account currency, stop distance in price units, and the resulting lot size. It also shows daily loss and maximum total loss limits, plus the number of consecutive losses at the selected risk that fit within each limit. The value of one price unit for one lot is read from the symbol specification.

Risk is computed as account size multiplied by risk percentage. Lot size is derived from risk amount divided by stop distance times the per-lot price-unit value, then rounded down to the volume step and constrained to symbol min/max volume. Stop distance can be manual or ATR-based using the last closed bar.

Inputs include accou...

πŸ‘‰ Read | Quotes | @mql5dev
❀22✍3πŸ‘Œ3
Shapelets replace hand-coded chart patterns with a subsequence search on labeled price windows. Each shapelet is a z-normalized snippet plus a distance threshold, acting as a decision stump using minimum sliding Euclidean distance.

Labeling comes from forward log returns over a horizon, keeping only moves above k times trailing 1-bar sigma and dropping FLAT. This avoids fixed pip thresholds but makes k horizon-dependent and introduces selection effects.

Core implementation issues: stable rolling variance requires mean-centering to avoid catastrophic cancellation; early-abandon keeps MinDist exact. Candidate scoring uses information gain over sorted distances, enabling fast re-scoring under label permutations.

Sliding-window datasets create duplicate traps: overlap checks must use absolute bar spans and optional z-space similarity, not row indices....

πŸ‘‰ Read | Docs | @mql5dev
❀10πŸ‘3πŸ‘Œ2
Stochastic Daily Breakout is an XAUUSD H1 EA built around momentum shifts and yesterday’s range. A stochastic signal-line turn flags a potential change, then a pending stop order is placed at yesterday’s high or low so execution occurs only if price confirms the move.

Logic is minimal and self-contained. The stochastic is calculated internally using a close-to-close range with SMMA smoothing (not equivalent to iStochastic). The only built-in indicator used is Bollinger Bands. One position is maintained at a time.

Rules: Buy when the signal line peaks on the prior bar and the open three bars ago is below the upper band; place a buy stop at yesterday’s high. Sell when the signal line troughs and the open three bars ago is above the lower band; place a sell stop at yesterday’s low. SL and TP are both 1.9% of entry. Pending orders expire after 9 bars and are repl...

πŸ‘‰ Read | Quotes | @mql5dev
❀14✍3πŸ‘2πŸ”₯2πŸ‘Œ2πŸ€”1
SpikingBrain reframes market modeling as event-driven computation: neurons stay idle until a threshold is hit, then emit spikes. This mirrors trading realities like Renko-style filtering, news shocks, level breakouts, and stop-loss cascades, where signal quality depends on reacting to discrete events rather than continuous noise.

Technically, it reinterprets Transformer attention as a dynamic trigger: compute is spent only when inputs become meaningful. Threshold adaptation tunes sensitivity to volatility, while local and global connectivity captures both microstructure moves and regime-level shifts.

Two variants show practical trade-offs: SpikingBrain-7B uses linear + sliding-window attention for long contexts with constant memory; SpikingBrain-76B adds hybrid attention, trainable tokens, and sparse MoE to balance coherence, latency, and resource useβ€”enabli...

πŸ‘‰ Read | AppStore | @mql5dev
❀19πŸ‘Œ2πŸ”₯1
Trading data is a finite sample, not the market’s true distribution. The article reframes strategy research as statistical inference: deciding what is a stable property versus a sample-specific fluctuation, so β€œpositive mean” or β€œnormal returns” aren’t mistaken for signal.

LLN and CLT are presented as the bridge from theory to practice. LLN explains why a trading edge shows up only across many trades, while CLT quantifies uncertainty for finite N, enabling confidence bounds and error scaling around estimates.

A key theme is treating the i.i.d. assumption as a hypothesis to test. Using ECDF, histograms, and KDE, EDA surfaces dependence, volatility clustering, and heavy tails before CDA applies parametric/nonparametric estimation and hypothesis tests. MQL5 script examples are positioned as reusable building blocks for a robust research pipeline.

πŸ‘‰ Read | Docs | @mql5dev
❀18πŸ‘¨β€πŸ’»6🀩4
Multi-symbol FX models break down when correlations are dense and covariance inversions are unstable. A sparse precision matrix fixes both: it captures conditional dependence via partial correlations, removing shared linear factors (like the USD leg) and turning absent links into exact zeros using an L1-penalized graphical lasso.

TICC extends this to lead/lag structure by stacking the last w bars of n symbols into one vector, then constraining the precision matrix to a block-Toeplitz form so regimes represent stable dependency patterns, not volatility levels. ADMM solves the Toeplitz graphical lasso efficiently: an eigen-based update guarantees positive definiteness; a grouped proximal step enforces Toeplitz structure and sparsity exactly.

Regimes are assigned with a Viterbi-style dynamic program that penalizes rapid switching, producing actionable...

πŸ‘‰ Read | AppStore | @mql5dev
❀22πŸ‘6πŸ”₯3🀩3πŸŽ‰2πŸ‘Œ2
This article moves an encoded candlestick stream from offline .txt analysis onto the MetaTrader 5 chart, closing the gap between research workflows and live decision support. A refined taxonomy adds N/n for bullish/bearish unclassified candles, preserving direction that was previously lost and improving multi-candle sequence analysis.

The MQL5 indicator overlays each closed bar with its symbol (A/a, H/h, E/e, G/g, D, N/n) and computes per-type frequency and percentage over a configurable lookback. Updates occur only on new bars to avoid repainting and unnecessary per-tick work.

The design relies on chart text objects (no buffers/plots), includes per-type color mapping and type filters, and implements safe object lifecycle management via unique prefixes and cleanup routines. Traders get immediate visual pattern structure plus statistical context; deve...

πŸ‘‰ Read | Freelance | @mql5dev
❀21πŸ‘10🀩5πŸ”₯4πŸ‘€3πŸ‘Œ2⚑1
SpikingBrain reframes market modeling around event-driven spiking signals, matching the irregular nature of price/volume moves. By reacting only to meaningful changes, it reduces constant compute load, stays stable in noisy regimes, and adapts faster with smaller fine-tuning datasets.

The architecture centers on encoding time series into spikes, integrator units that accumulate impulses as a built-in noise filter, and hybrid layers that separate short-term pattern detection from longer-horizon aggregation. Modularity supports mixing spiking blocks with conventional deep learning for broader workflows.

On the MT5/MQL5 side, the focus shifts to implementation details: leveraging pre-trained Transformer components, replacing brute-force window attention with graphon-based sparse attention plus MoE routing, and adding recurrent linear attention with gates to r...

πŸ‘‰ Read | Freelance | @mql5dev
πŸ”₯21❀20πŸ‘9🀩5πŸ‘Œ2πŸ†2⚑1
AI interfaces in MQL5 often fail at the same boundary: the model only reasons over typed prompts and cannot see the chart or read terminal state.

An updated panel closes that gap with two mechanisms: chart vision and tool calling. Vision attaches a chart screenshot (base64 + dimensions) to the message, rendered locally as a thumbnail and a full viewer with scrollbars, plus cleanup tied to chat deletion.

Tool calling exposes a controlled set of JSON-defined functions. The model requests indicator values, open positions, chart objects, trade history, and calendar data, the terminal executes the call, and results are returned as plain text for continuation.

Combined usage reduces manual transcription and keeps access scoped to explicitly permitted reads.

πŸ‘‰ Read | Quotes | @mql5dev
❀20πŸ‘15πŸ”₯5🀩5πŸ‘€2
Strategy reports show wins and losses, but they do not separate clean entries from trades that survived long adverse moves. MAE and MFE address this by measuring worst adverse and best favorable excursion after entry, then deriving entry efficiency as MFE / (MFE + MAE), independent of final PnL.

An MQL5 dashboard is outlined: read closed positions, compute excursions from tick history, then render a MAE-vs-MFE scatter plot and an efficiency histogram. A summary printer outputs analyzed count, tick-data exclusions, win/loss/breakeven split, mean efficiency, and best/worst entries.

Implementation details cover grouping deals into positions via DEAL_POSITION_ID, tick retrieval with CopyTicksRange in millisecond time, bid/ask handling by direction, undefined ratios on 0/0, histogram bin edge handling at 1.0, and CCanvas rendering. Arithmetic and stats are struc...

πŸ‘‰ Read | Freelance | @mql5dev
πŸ‘16❀11🀩10πŸ”₯5πŸ‘Œ2✍1
Nested CV fixes selection bias in performance evaluation by re-running model selection inside each outer fold. It does not reduce overfitting inside the selection loop, and it does not separate selection issues from regime drift, label noise, or feature instability.

A practical diagnostic is proposed: measure whether the selection criterion can discriminate candidates at all. Use boundary-shifted purged folds (OffsetPurgedKFold) to generate multiple valid repartitions without shuffling, then score every candidate on every offset.

The audit reports noise_floor (per-candidate dispersion across offsets), candidate_spread (dispersion of candidate means), and resolution_ratio = spread/noise. In the example, ratio=0.49, implying the criterion variance is about 2x the signal; the argmax matched the best-on-average candidate in 1/8 partitions. The implication is...

πŸ‘‰ Read | Freelance | @mql5dev
❀14πŸ”₯9πŸ‘8🀩7πŸ‘Œ2
This article turns the Greatest Swing Value breakout concept into a production-grade MQL5 Expert Advisor by enforcing a strict, ordered pipeline: detect directional setup, collect a fixed sample of β€œfailed swings,” compute their average, project a breakout level from the current bar open, then confirm the breakout using M1 close-to-close crossing. Each setup is valid for only the current bar, keeping signals time-bounded and avoiding stale triggers.

Failure swings are measured from bars that moved in one direction intrabar but closed against it (bearish bars for bullish breakouts: High-Open; bullish bars for bearish breakouts: Open-Low). The EA requires an exact count of qualifying swings within a capped search window, rejecting incomplete samples.

Execution includes broker-safe trade construction: configurable stop placement, two take-profit modes...

πŸ‘‰ Read | AlgoBook | @mql5dev
❀15πŸ‘13πŸ”₯5🀩5⚑2πŸ‘Œ2