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
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
Z-Score is a normalized way to measure how far price is from a rolling mean, scaled by recent standard deviation. It answers whether the current move is statistically unusual versus the last N bars, without implying reversal by itself.

Common thresholds are Β±1 (typical), Β±2 (unusual), Β±3 (extreme), but fat-tailed returns reduce the reliability of Gaussian assumptions. Regime and timeframe selection remain the primary determinants of usefulness.

Three implementation patterns are outlined: mean reversion via re-entry from Β±2 back toward 0, breakout confirmation beyond Β±2.5 with exit inside Β±1, and trend-filtered pullbacks using a 200 EMA plus Β±1.5 bands.

MQL5 coverage includes a custom indicator (SMA, population variance, divide-by-zero protection) and EA logic with bar-close gating, indicator handles, Magic Number scoping, and backtest metrics that s...

πŸ‘‰ Read | Forum | @mql5dev
❀16πŸ‘12🀩2πŸ‘Œ2πŸ‘¨β€πŸ’»2πŸ”₯1
MD Scalper is a high-frequency scalping EA for MT4 built around a short moving-average channel and pending stop execution with a tight trailing stop.

Signals are derived from two 3-period smoothed MAs on High and Low. A break above MA(High) flags UP, and a break below MA(Low) flags DOWN. Entries also require the current bar range to exceed a configurable Filter threshold.

TradeMode controls order placement: Trend places BUYSTOP above price in rising conditions and SELLSTOP below price in falling conditions. Reversal places the opposite. Both submits both orders and cancels the remaining side after a fill. Pending orders are adjusted one-way to stay close to market.

Execution safeguards include stop/freeze-level awareness, modification throttling, retry logic on common trade errors, latency measurement with optional entry blocking, spread/commission filters,...

πŸ‘‰ Read | Quotes | @mql5dev
❀15πŸ‘8πŸ”₯5πŸ‘¨β€πŸ’»5πŸ†3⚑2🀩1
Backtests and optimisations depend on the bar history currently stored in the terminal, yet that history is rarely audited. A bar-gap is visually indistinguishable from a quiet market, and the tester will model whatever it is given without warning.

A bar-history audit tool runs six checks over the last N closed bars per symbol/timeframe: OHLC consistency, bar time order and grid alignment, missing bars validated against the symbol’s quote sessions, empty (zero-tick) and flat bars, reconstruction from M1 for cross-timeframe consistency, and spread sanity (zero, above limit, max/mean). Each finding can be written as a CSV row keyed by bar time for independent verification.

Example run: five Market Watch symbols, M15, 5,000 bars each, completed in about one second. Session coverage is the key metric: four symbols reported 100.00%, while XAUUSD showed ...

πŸ‘‰ Read | Calendar | @mql5dev
❀17πŸ‘11πŸ”₯3🀩2πŸ‘Œ2
Market Behavior Analyzer is a chart indicator that converts swing movement into an explicit market-structure model. Instead of marking swing points only, it tracks the move between them and labels structure as HH, HL, LH, and LL. Each completed leg is measured in pips, with supporting metrics such as bar count and retracement percentage.

Two interactive panels are included. Market Story summarizes current structure and tags the latest leg as impulse or pullback. Swing Inspector enables selecting a swing point on-chart to view price, classification, leg length, duration, retracement, and adjacent swing relationships.

Key inputs cover lookback and swing validation: InpLookbackCandles, InpDepth, and InpMinDistPoints. Visual controls toggle lines and labels, adjust fonts and colors, and enable or disable each panel with configurable panel themes.

The to...

πŸ‘‰ Read | Calendar | @mql5dev
🀩15❀12πŸ‘8πŸ”₯6πŸ†4✍2πŸ‘Œ2
Prop Firm Daily Loss Tracker is an on-chart monitor for funded and prop firm accounts. It tracks daily loss consumption without generating trade signals or placing orders.

The panel displays day result in account currency, day start balance, current equity, percent of the daily loss limit used, remaining room for the day, and remaining room to the max total loss. A status line reports OK, WARNING, or LIMIT REACHED.

Day result is computed as the closed P/L for the day plus (equity - balance), excluding deposits and withdrawals. Daily limit is account size multiplied by the daily loss percent. The max loss floor is account size multiplied by (1 - max loss percent). The trading day rolls over at a configurable server hour.

Alerts can trigger once per day at the warning level and again at 100%, with optional push notifications. Settings also include pan...

πŸ‘‰ Read | AppStore | @mql5dev
❀23πŸ‘14πŸ”₯6🀩5πŸ‘Œ3
Edge or Luck evaluates closed trades from account history and estimates whether the average trade is distinguishable from chance. Net profit and profit factor describe outcomes, but not the probability that similar results arise randomly when the sample is small.

The script applies bootstrap resampling (Efron, 1979): it resamples the existing trades with replacement, matches the original trade count, computes an average, and repeats this 10,000 times. The central 95% of simulated averages forms a confidence band, while the fraction below zero estimates the probability that the true average trade is negative. No return distribution is assumed, which fits skewed trading results.

Interpretation: a band fully above zero suggests a detectable edge; including zero indicates luck remains plausible; fully below zero suggests underperformance. By default, fewer ...

πŸ‘‰ Read | Calendar | @mql5dev
❀18πŸ”₯10πŸ‘6🀩3πŸ‘Œ3
Arixis Market Regime Map is a market-state classification indicator for MetaTrader 5 focused on answering a single operational question: what regime is currently active. It avoids Buy/Sell signals and labels price behavior as Trend Up, Trend Down, Range, or Transition.

Classification is derived from quantitative inputs such as Efficiency Ratio, normalized directional slope, volatility, market structure, and agreement across multiple horizons. Efficiency Ratio compares net price displacement to total path length to separate directional movement from noise.

The tool uses causal, non-repainting calculations, includes hysteresis to limit regime churn, and provides historical visualization. A Regime Strength metric summarizes how strongly the measurements support the detected regime, without implying a probability or forecasting direction.

Intended use i...

πŸ‘‰ Read | AlgoBook | @mql5dev
❀17πŸ‘11πŸ”₯5🀩4πŸ‘Œ2