MQL5 Algo Trading
554K subscribers
4.02K photos
6 videos
4.03K 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
Part 2 connects dynamic risk-budget computation to position sizing via WParamCalibrator.

The calibrator converts risk_budget_pct into a sigmoid w parameter, then PropFirmAwareSizer scales positions smoothly from full size to zero as the daily budget erodes. The sizing logic remains independent of the specific prop-firm rule set.

A sigmoid is used to avoid threshold discontinuities that cause abrupt sizing shutdowns and unstable behavior in path-dependent strategies. The chain computes cal_bet_size = (risk_budget_pct * safety_factor) / stop_loss_pct, then numerically inverts the sigmoid to get w. The 0.98 cap and 0.02 floor are arithmetic guards, not business rules.

Default parameters create a long flat sizing ceiling until roughly 1.4% budget remains, concentrating de-risking late. This requires strategy-specific tuning and backtesting.

A product...

πŸ‘‰ Read | Docs | @mql5dev
❀12πŸ‘5πŸ‘Œ2
The article completes a doubly linked list in MQL5 by adding safe deletion and insertion in the middle, avoiding array-style shifting and extra copying. The core technique is pointer rewiring: link a node’s prev directly to its next (and vice versa), then free the removed node.

Deletion evolves from value-based search to index-based removal, with a maintained element count to validate bounds and handle head/tail as fast paths. A further refinement accepts negative indexes to traverse from the end, requiring direction-aware pointer updates to prevent deleting the wrong node.

These patterns matter when building MT5 tools that process large, frequently changing datasets, such as order/price event buffers, where predictable runtime and minimal memory churn are critical.

πŸ‘‰ Read | VPS | @mql5dev
❀20πŸ‘8πŸ‘Œ2
The MVC table library for MT5 is extended with a vertical header, enabling row-aware layouts where both axes carry meaningful labels. The example builds a symmetric symbol correlation matrix: row/column headers show symbols, cells show correlation values.

Rendering is improved with three-point color interpolation for coefficients in [-1..+1], so each cell can be shaded consistently based on correlation strength and sign. Cells now support their own background color instead of inheriting the row color.

Interaction handling is refined: hover/click can operate at cell level without row flicker, and events report the selected row/column plus header texts. Header classes are refactored into a common base with specialized column/row variants, and column headers can emit sortable-click events. Subwindow sizing is handled to keep cursor tracking correct afte...

πŸ‘‰ Read | VPS | @mql5dev
❀10πŸ‘3πŸ‘Œ2
Replay/simulation UI updates for MQL5 position indicators.

A chart-only long/short cue is added when SL and TP are absent. C_ElementsTrade gains a direction object; CreateInfoDirect builds a Wingdings glyph via CharArrayToString from a ushort array, selecting code 236 or 238 based on a constructor flag. C_IndicatorPosition is adjusted to pass position direction with minimal edits.

Interaction safety is tightened for SL/TP dragging. DispatchMessage now signals the mouse indicator to hide the horizontal line during move mode and restore it after selection. Follow-up changes route the active price into UpdateViewPort, enabling an auxiliary line and synchronized movement of related controls while waiting for server confirmation.

πŸ‘‰ Read | Freelance | @mql5dev
❀19πŸ‘5πŸ‘Œ2πŸ‘¨β€πŸ’»2🀩1
SCNN splits a time series into long-term, seasonal, short-term, coupled, and residual components, training each path separately. This improves auditability versus monolithic models and supports mixed heuristics plus neural modules.

Current implementation work focuses on the coupled component via spatially weighted normalization with attention. OpenCL kernels AdaptSpatialNorm and AdaptSpatialNormGrad compute weighted mean/variance per time step, normalize per variable, and backpropagate gradients to inputs, attention weights, and saved statistics.

A new CNeuronAdaptSpatialNorm class in MQL5 wires the forward/backward passes and builds attention from a reduced trainable tensor, its transpose, a correlation matrix, and SoftMax, while persisting mean/stddev for later graph stages.

πŸ‘‰ Read | Calendar | @mql5dev
❀14πŸ‘7πŸ”₯2πŸŽ‰2🀩2πŸ‘Œ2
Ecological Cycle Optimizer (ECO) reframes metaheuristic search as an ecosystem: 20% producers hold elite solutions, herbivores and carnivores iteratively chase better regions, and omnivores blend signals across trophic levels to reduce blind spots.

Exploration is controlled by an adaptive predation coefficient that starts aggressive for broad search, then decays toward 1 to emphasize local refinement. Target selection uses fitness-weighted sampling to keep diversity while favoring strong candidates.

A decomposition phase applies three mutation styles (best-neighborhood, distance-scaled local randomness, and time-decaying global jumps) to avoid early stagnation. Greedy revision rolls back losing moves, preserving monotonic improvement.

The MT5 implementation structures this as a configurable class with grouped agent ranges, per-iteration Moving/Revis...

πŸ‘‰ Read | Docs | @mql5dev
❀9πŸ‘6πŸ‘Œ2🀩1
Most SMC indicators stop at annotation. They mark swings, FVGs, and liquidity lines, then leave interpretation and trade decisions to manual work. Many also repaint by confirming swings only after the fact, so historical study does not match live conditions.

A workable approach is a single analysis pipeline that produces an explicit Market Intent Score (0–100) and maps it to a small set of decision states. The same code path must run in both β€œindicator” and β€œexecution” modes, with one boolean controlling whether orders are sent.

The system uses four timeframes (default H4/H1/M15/M5) and five stages: structure, liquidity, price behavior, intent scoring, and decision/trade plan. Key implementation details include storing swing confirmation lag, separating β€œbroken” vs β€œswept” levels, pooling liquidity with ATR-scaled tolerance, and using protected hig...

πŸ‘‰ Read | Forum | @mql5dev
❀17πŸ‘9πŸ‘Œ3πŸ‘¨β€πŸ’»3πŸ”₯2🀩2πŸ†1
A quantum-enhanced MT5 pipeline is extended with a 3D-bar module to preserve the joint structure of price, time, volume, and volatility that 2D indicators miss. M15 OHLCV for 8 FX pairs feeds three parallel feature builders (3D bars, an 8‑qubit Qiskit encoder, and 33 classic indicators) before CatBoost predicts 24‑hour direction, with optional Llama-based interpretation.

The Bars3D layer tackles non-stationarity by converting OHLCV into stationary, windowed features: cyclical time encoding, returns and price acceleration, volume change and acceleration, plus rolling volatility and its change, scaled to a 3–9 range. It also flags β€œyellow clusters” where high price and volume volatility coincide, estimating local reversal probability.

Quantum features come from RY angle encoding with CZ entanglement on a ring, measured into entropy, dominant-state p...

πŸ‘‰ Read | Calendar | @mql5dev
❀17πŸ‘5πŸ”₯2🀩2✍1⚑1πŸ‘Œ1
SCNN implementation in MQL5 reaches the assembly and test phase, focusing on the Encoder’s end-to-end data path. The model decomposes a time series into long-term, seasonal, short-term, and spatially-aware components, keeping intermediate signals interpretable.

The forward pass applies long-term normalization, seasonal transposition and period normalization, short-term extraction, and attention-based spatial normalization. Outputs plus summary statistics are concatenated without expanding means/std across time to reduce memory, then passed through projection and a Fusion block with TANH and SIGMOID convolution branches combined by element-wise multiplication.

Backpropagation mirrors this layout: gradients split across the gated convolution branches, recombine after transpose, then flow through projection and sequential deconcatenation. Normalizers...

πŸ‘‰ Read | AppStore | @mql5dev
πŸ‘10❀9⚑2🀩2πŸ‘Œ1
Partial Information Decomposition (PID) is implemented in MQL5 to fix a common failure in trading feature selection: single-indicator screens miss pair-only effects (classic XOR), where each input is useless alone but powerful together. PID splits information from two sources into four atoms: redundancy, two uniques, and synergy, with internal consistency checked via co-information.

The library supports three redundancy axioms (I_min, I_MMI, I_ccs) and shows they can disagree materially, making the axiom a modeling choice rather than an implementation detail. Continuous market data is discretized into equal-frequency bins to build a compact joint count table; all entropies are computed efficiently using precomputed log lookups.

Finite-sample bias makes raw atoms nonzero even on pure noise, so the library relies on a permutation null (with block shufflin...

πŸ‘‰ Read | Signals | @mql5dev
❀7πŸ‘4πŸ”₯2🀩1πŸ‘Œ1
An MQL5 signal class is set up to test whether a neural confirmation adds measurable value to a trend-continuation ruleset on EURUSD H4. The rule engine proposes entries from ADX/DI, an HMM gates them by regime probability, and an optional GRU vetoes unless direction and confidence thresholds are met.

The HMM estimates range, trend, or high-volatility states from normalized ADX and standardized ATR/price using a 3-state Gaussian model with Baum-Welch fitting and posterior gating (>= 0.6). The GRU is regime-specific and predicts near-term direction; it must agree with the rule and exceed |output| >= 0.05.

Evaluation is framed as a three-way comparison: raw rule, HMM-gated rule, and HMM+GRU. The added complexity is justified only if rejected trades have worse expectancy and risk metrics, rather than simply reducing trade count.

πŸ‘‰ Read | AppStore | @mql5dev
πŸ‘8❀5πŸ‘Œ1
Walsh functions provide an orthogonal, lightweight alternative to sine/cosine transforms for decomposing price series into components. Symmetric terms act as smoothers, while antisymmetric terms emphasize trend, making them useful for extracting structure that common indicators often miss.

A practical approach builds probability distributions for Walsh-derived features: order-0 aligns with SMA, and order-1 (with doubled period) captures SMA change. Combining these distributions yields an expected future SMA/trend level plus an explicit uncertainty measure; large forecast error becomes a volatility/regime signal.

Two key implementation issues are addressed: periods constrained to powers of two, and repainting from windowed calculation. Periods can be scaled by integer factors, and repainting can be removed by locking values at bar close, enabling a ...

πŸ‘‰ Read | Freelance | @mql5dev
❀20πŸ‘6🀩4πŸ”₯1πŸ‘Œ1πŸ‘€1
H1 Container MTF Boxes is a display-only MT4 indicator that maps a single H1 candle into lower timeframes on the active chart. It renders an H1 container and optional nested boxes for M30, M15, M5, and M1 candles that occur within that hour.

The H1 range can include 25%, 50%, and 75% levels. Lower timeframe boxes use a single 50% midline to reduce visual noise. AutoFollowCurrentH1 tracks the current H1 candle, or a historical H1 can be selected via H1Shift.

Visibility toggles are provided for each nested timeframe, along with controls for colors, widths, line styles, labels, and an ObjectPrefix to avoid naming collisions. M1 mode can generate many objects and may be disabled if the chart becomes crowded. Values update while candles are still forming. An EA version based on the same H1 container logic is in development.

πŸ‘‰ Read | Forum | @mql5dev
πŸ‘9❀7🀩2πŸ”₯1πŸ‘Œ1
A CISD-based market microstructure tool is designed to flag potential turning points using ICT/SMC-style logic. It monitors consecutive delivery candles, derives reference levels from the delivery open, and confirms a Change in State of Delivery when price reclaims and closes beyond those levels.

Confirmed CISD events extend pending levels forward, then render dashed or solid lines with mid-line labels and directional entry arrows. Liquidity sweep logic marks wick expansions that run swing highs or lows and then reject, highlighting potential stop runs.

Market Structure Shift detection tracks swing breaks and annotates them with dots. Candle overlay options apply Emerald Green and Red bull/bear colors either directly or conditioned on the confirmed CISD direction.

πŸ‘‰ Read | CodeBase | @mql5dev
❀13πŸ‘5🀩4✍1πŸ”₯1πŸ‘Œ1
Session Range Desk MT5 v4.01 is a source-available, educational session-range breakout EA for MT5 hedging accounts. It combines a trailing completed-bar range, ATR-banded range validation, stop-distance position sizing, and an on-chart panel. Multiple symbols can share a desk view via terminal global variables. No grid, martingale, or averaging logic is used.

At the configured start time, the EA builds a high/low range from the previous LookbackCandles bars. If the range width falls outside the Min/Max ATR multiplier band, the day is skipped. Otherwise, a touch or a bar-close breakout can place a market order with the opposite range edge as the stop. Optional management supports fixed R targets, break-even, and partial closes, with one intended entry per symbol per server day.

Risk controls include RiskPercent sizing and a MaxDailyRiskPct desk threshold, wh...

πŸ‘‰ Read | Forum | @mql5dev
❀11πŸ‘5πŸ”₯2πŸ‘Œ2🀩1
A fixed 3-qubit quantum circuit is used as a nonlinear feature generator for MT5 price windows, modeling β€œuncertainty structure” rather than claiming any quantum computing advantage. Mean return, volatility, and range drive RY rotations; a CNOT chain adds dependencies; 1000-shot simulation yields an 8-bin outcome histogram.

Seven metrics are extracted from that histogram: entropy, dominant-state probability, superposition width, outcome coherence, neighbor-bit correlation (entanglement proxy), variance, and count of significant states. Caching via window hashing is required to keep sliding-window runs practical.

These features are fused with classical OHLCV-derived inputs in a bidirectional LSTM pipeline (BatchNorm, ReLU, Dropout), trained with Focal Loss plus weighted sampling to handle directional imbalance. On a small EURUSD H1 sample, reported ga...

πŸ‘‰ Read | Quotes | @mql5dev
❀21πŸ‘2🀩2πŸ‘Œ2⚑1πŸ‘¨β€πŸ’»1