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
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
β€8π5π₯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
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
β€9π9π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
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
β€23π7π€©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
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
π10β€9π€©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
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
β€14π8π€©4π2β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
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
β€12π7π₯2π€©2π2
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
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
β€27π4β‘2π₯2π€©2π2π¨βπ»2
Position replay/simulation indicator update: C_IndicatorPosition is removed to eliminate an intermediate layer between the indicator and C_ElementsTrade. Methods and state move into the indicator so the new P/L label can access the opening-price component directly.
Profit/loss is computed as points to the best close price, not POSITION_PROFIT. Spread makes POSITION_PROFIT unreliable for exit viability, so closing logic uses Bid for long exits and Ask for short exits, sourced via SymbolInfoTick in OnCalculate.
C_ElementsTrade gains a label anchored to the opening line, updated with a formatted points delta using the symbolβs digits. The label color indicates positive vs negative, and ChartRedraw is used to avoid delayed UI refresh.
π Read | VPS | @mql5dev
Profit/loss is computed as points to the best close price, not POSITION_PROFIT. Spread makes POSITION_PROFIT unreliable for exit viability, so closing logic uses Bid for long exits and Ask for short exits, sourced via SymbolInfoTick in OnCalculate.
C_ElementsTrade gains a label anchored to the opening line, updated with a formatted points delta using the symbolβs digits. The label color indicates positive vs negative, and ChartRedraw is used to avoid delayed UI refresh.
π Read | VPS | @mql5dev
β€17π8π€©4π2β‘1π₯1π1
Time-series forecasting is seeing diminishing returns from scaling Transformer-style models. Reported MSE/MAE gains stay under ~30% while parameter counts rise by orders of magnitude, and progress after PatchTST appears incremental.
A key cost driver is patching with attention: fragmenting sequences removes temporal/spatial identifiers, then position/identity encodings are added back, expanding latent dimensionality and increasing overfitting risk on limited datasets.
SSCNN (βParsimony or Capability? Decomposition Delivers Both in Long-term Time Series Forecastingβ) argues for structured decomposition over patching, with formal analysis. The model extracts long-term, seasonal, short-term, plus spatial components via temporal/spatial attention normalization and selection maps, then extrapolates and combines them using polynomial regression.
Benchmarks repor...
π Read | Freelance | @mql5dev
A key cost driver is patching with attention: fragmenting sequences removes temporal/spatial identifiers, then position/identity encodings are added back, expanding latent dimensionality and increasing overfitting risk on limited datasets.
SSCNN (βParsimony or Capability? Decomposition Delivers Both in Long-term Time Series Forecastingβ) argues for structured decomposition over patching, with formal analysis. The model extracts long-term, seasonal, short-term, plus spatial components via temporal/spatial attention normalization and selection maps, then extrapolates and combines them using polynomial regression.
Benchmarks repor...
π Read | Freelance | @mql5dev
β€17π5π₯4π€©3π1
MetaTrader 5 projects that rely on structs often end up with warnings about undeleted instances or unreleased memory. A common root cause is skipped initialization routines, which turns structured code into a source of inconsistent state.
In MQL5, a class is effectively a struct with lifecycle hooks. Constructors run automatically on instance creation and can take parameters; destructors run when an instance ends and are intended for explicit resource release. Multiple constructors are allowed, but only one destructor.
Replacing manual Init() calls with constructors removes the dependency on callers remembering setup steps. If no constructor is defined, MQL5 generates a default one, and member state may remain effectively uninitialized from a logic standpoint. Initialization lists can also be used to set members before the constructor body executes.
π Read | Forum | @mql5dev
In MQL5, a class is effectively a struct with lifecycle hooks. Constructors run automatically on instance creation and can take parameters; destructors run when an instance ends and are intended for explicit resource release. Multiple constructors are allowed, but only one destructor.
Replacing manual Init() calls with constructors removes the dependency on callers remembering setup steps. If no constructor is defined, MQL5 generates a default one, and member state may remain effectively uninitialized from a logic standpoint. Initialization lists can also be used to set members before the constructor body executes.
π Read | Forum | @mql5dev
β€24π4π€©3π₯1π1
Update to an MQL5 replay/simulation position view focuses on UI robustness and event-driven interaction.
OBJ_EDIT fields now auto-adjust size based on font metrics computed in the C_ElementsTrade constructor, removing manual width/height tuning and preventing text clipping after font changes. Font name/size are centralized via macros, and a deliberate compile-stop guard avoids conflicting macro redefinitions.
Distance readouts reuse the existing P/L display logic: take-profit and stop-loss lines show point distance from the open price without overwriting the open-line P/L value.
Runtime behavior is fixed at the indicator layer. Update logic is extracted into a helper and invoked from both OnCalculate and OnChartEvent, enabling live distance updates during drag and proper cleanup when creation is canceled with ESC.
π Read | CodeBase | @mql5dev
OBJ_EDIT fields now auto-adjust size based on font metrics computed in the C_ElementsTrade constructor, removing manual width/height tuning and preventing text clipping after font changes. Font name/size are centralized via macros, and a deliberate compile-stop guard avoids conflicting macro redefinitions.
Distance readouts reuse the existing P/L display logic: take-profit and stop-loss lines show point distance from the open price without overwriting the open-line P/L value.
Runtime behavior is fixed at the indicator layer. Update logic is extracted into a helper and invoked from both OnCalculate and OnChartEvent, enabling live distance updates during drag and proper cleanup when creation is canceled with ESC.
π Read | CodeBase | @mql5dev
β€15π4π₯2π2π€©1
Part 2 extends the Cairo-style split between geometry and rendering by adding Path.mqh as a common shape representation.
A path is geometry only: points grouped into outlines, with no color, thickness, fill rule, or destination buffer. This removes shape-specific render loops and enables reuse across different fills and transforms.
Points are stored as doubles to preserve sub-pixel coordinates. This is required for later anti-aliasing, smooth animation, and curve flattening without quantization.
A path can contain multiple contours (open or closed) to support glyph holes, rings, borders, and multi-part icons. Storage uses one flat vertex array plus a contour start index array and a closed-flag array for contiguous traversal and low overhead.
π Read | AlgoBook | @mql5dev
A path is geometry only: points grouped into outlines, with no color, thickness, fill rule, or destination buffer. This removes shape-specific render loops and enables reuse across different fills and transforms.
Points are stored as doubles to preserve sub-pixel coordinates. This is required for later anti-aliasing, smooth animation, and curve flattening without quantization.
A path can contain multiple contours (open or closed) to support glyph holes, rings, borders, and multi-part icons. Storage uses one flat vertex array plus a contour start index array and a closed-flag array for contiguous traversal and low overhead.
π Read | AlgoBook | @mql5dev
β€7π5π€©1
Gopalakrishnan Range Index (GRI), published in TASC in 2001, measures market activity using the closing-price range over N bars, normalized on a log scale. It remains a practical volatility gauge and is easy to implement in MetaTrader 5.
Implementation computes High/Low of Close over ChaoticPeriod, takes log10(range)/log10(N), returning 0 when range is zero. For range < 1, values become negative; a shifted range can clamp the minimum toward zero. Scaling by Point makes thresholds usable in EA inputs.
In testing, an EA using TEMA for direction and AMA for confirmation improved behavior when trades were filtered by rising GRI, avoiding low-activity phases. GRI is a condition filter, not a directional signal, and benefits from per-symbol threshold calibration and backtesting.
π Read | Quotes | @mql5dev
Implementation computes High/Low of Close over ChaoticPeriod, takes log10(range)/log10(N), returning 0 when range is zero. For range < 1, values become negative; a shifted range can clamp the minimum toward zero. Scaling by Point makes thresholds usable in EA inputs.
In testing, an EA using TEMA for direction and AMA for confirmation improved behavior when trades were filtered by rising GRI, avoiding low-activity phases. GRI is a condition filter, not a directional signal, and benefits from per-symbol threshold calibration and backtesting.
π Read | Quotes | @mql5dev
β€5π2π€©2π1π1
Post-trade stats typically report what a trade earned. This utility records what each trade had available, and what it returned.
On first detection it captures the initial stop distance as 1R, then measures max favorable and adverse excursion in R until the position closes. Trailing stops do not alter the reference, so the measurement stays consistent.
One CSV row per closed position is written to MQL5\Files: ticket, symbol, side, open/close time, entry, risk distance, peak R, worst R, realised R, and profit. Trades without a stop are skipped and counted.
Use case: equity curves that spike and fade can come from trades reaching high peak R and giving it back, or from trades never traveling far. Comparing average peak R vs realised R, plus average giveback on the chart panel, separates these cases.
The EA is read-only: no open/modify/close. Attach alongsid...
π Read | VPS | @mql5dev
On first detection it captures the initial stop distance as 1R, then measures max favorable and adverse excursion in R until the position closes. Trailing stops do not alter the reference, so the measurement stays consistent.
One CSV row per closed position is written to MQL5\Files: ticket, symbol, side, open/close time, entry, risk distance, peak R, worst R, realised R, and profit. Trades without a stop are skipped and counted.
Use case: equity curves that spike and fade can come from trades reaching high peak R and giving it back, or from trades never traveling far. Comparing average peak R vs realised R, plus average giveback on the chart panel, separates these cases.
The EA is read-only: no open/modify/close. Attach alongsid...
π Read | VPS | @mql5dev
π3β€2π₯1π€©1