An MT5 Expert Advisor focused on managed recovery entries using RSI filtering and ATR-based spacing. Entry logic includes market structure validation via LL/LH and support conditions, with optional news blocking through the MQL5 calendar, a CSV schedule, or both.
Risk controls cover fixed-lot and balance-based compounding sizing, adaptive recovery distance, and basket-level profit management with a target plus trailing. Basket handling also supports smart trimming to reduce exposure during recovery cycles.
Operational safeguards include spread and slippage limits, equity loss thresholds, crash-move detection with pause behavior, and dashboard monitoring for current recovery state and system status. Inputs are fully configurable, including magic number, ATR/RSI modes, recovery parameters, profit targets, trailing rules, news settings, and panel placement.
R...
π Read | Freelance | @mql5dev
Risk controls cover fixed-lot and balance-based compounding sizing, adaptive recovery distance, and basket-level profit management with a target plus trailing. Basket handling also supports smart trimming to reduce exposure during recovery cycles.
Operational safeguards include spread and slippage limits, equity loss thresholds, crash-move detection with pause behavior, and dashboard monitoring for current recovery state and system status. Inputs are fully configurable, including magic number, ATR/RSI modes, recovery parameters, profit targets, trailing rules, news settings, and panel placement.
R...
π Read | Freelance | @mql5dev
β€24π11π₯4π2
Volume Profile Levels reframes chart context by aggregating traded activity by price, not by time. A recent lookback window is split into equal price rows, volume is tallied per row, and the result is rendered as a horizontal histogram anchored at the latest bar.
Key references are derived from the same profile: Point of Control (highest-volume row) and Value Area High/Low, built outward from the POC to contain a configurable share of total volume rather than using a fixed range percentage. Each row is also classified by whether volume came mainly from up-closing or down-closing bars to show directional dominance at that price.
Inputs cover lookback length, row count, tick vs real volume, value area percent, update frequency (per bar or per tick), visibility toggles, sidebar width scaling, and line/colors. The implementation assigns each barβs full...
π Read | VPS | @mql5dev
Key references are derived from the same profile: Point of Control (highest-volume row) and Value Area High/Low, built outward from the POC to contain a configurable share of total volume rather than using a fixed range percentage. Each row is also classified by whether volume came mainly from up-closing or down-closing bars to show directional dominance at that price.
Inputs cover lookback length, row count, tick vs real volume, value area percent, update frequency (per bar or per tick), visibility toggles, sidebar width scaling, and line/colors. The implementation assigns each barβs full...
π Read | VPS | @mql5dev
β€25π12π2β‘1π€©1
Anomaly-detection logic from the deterministic Dendritic Cell Algorithm is repurposed for continuous optimization by treating dendritic cells as search agents and antigens as candidate solutions. Solution quality is converted into βdangerβ and βsafeβ signals via population-normalized fitness, then combined into a context value that steers behavior.
A deterministic, uniformly distributed lifespan gives agents different observation windows, smoothing decisions over time and improving stability. Context is accumulated and averaged to reduce noise, then selects among three moves: local mutation for exploitation, movement toward the current best with exploration noise, or full random reinitialization when the region looks consistently poor.
The implementation outlines an MQL5-style class design with explicit signal computation, boundary control, and modu...
π Read | VPS | @mql5dev
A deterministic, uniformly distributed lifespan gives agents different observation windows, smoothing decisions over time and improving stability. Context is accumulated and averaged to reduce noise, then selects among three moves: local mutation for exploitation, movement toward the current best with exploration noise, or full random reinitialization when the region looks consistently poor.
The implementation outlines an MQL5-style class design with explicit signal computation, boundary control, and modu...
π Read | VPS | @mql5dev
β€18π4π₯2π2π€©1
In MetaTrader 5 build 6180, we have significantly expanded the capabilities of the AI Assistant for working with the trading platform and Strategy Tester. The assistant can now retrieve and analyze tester reports and logs, check its current settings, help launch optimizations, add indicators to charts with specified parameters, and work with terminal and Expert Advisor logs.
For developers, we have expanded the capabilities for working with complex matrices and vectors in MQL5. Support for additional methods simplifies the processing, conversion, and validation of complex data in mathematical and analytical tasks.
The web terminal now provides improved handling of stop levels on netting accounts. When placing a new trade for an instrument that already has an open position, the terminal preserves the position's current Stop Loss and Take Profit levels, preventing them from being accidentally removed. We have also fixed data loading and quote display issues in Market Watch.
Read more...
For developers, we have expanded the capabilities for working with complex matrices and vectors in MQL5. Support for additional methods simplifies the processing, conversion, and validation of complex data in mathematical and analytical tasks.
The web terminal now provides improved handling of stop levels on netting accounts. When placing a new trade for an instrument that already has an open position, the terminal preserves the position's current Stop Loss and Take Profit levels, preventing them from being accidentally removed. We have also fixed data loading and quote display issues in Market Watch.
Read more...
π14β€6π2π€©2π2π₯1
MetaTrader 5 can open and modify trades, but it lacks a reusable pattern for what happens after entry. This article builds a Position Lifecycle Manager that decouples trade generation from trade management, so different EAs can share the same post-entry logic.
The framework discovers open positions, wraps each one in a CManagedPosition object, and drives it through explicit states: NEW, PROTECTED, BREAKEVEN, and CLOSED. State tracking preserves action history, avoiding repeated terminal queries and preventing duplicate stop or break-even operations.
A CPositionManager coordinates all managed objects, while a CRiskEngine calculates ATR-based protective stops without placing orders itself. Integration is shown with the standard MACD EA: entries stay intact; lifecycle handling becomes a reusable layer.
π Read | AlgoBook | @mql5dev
The framework discovers open positions, wraps each one in a CManagedPosition object, and drives it through explicit states: NEW, PROTECTED, BREAKEVEN, and CLOSED. State tracking preserves action history, avoiding repeated terminal queries and preventing duplicate stop or break-even operations.
A CPositionManager coordinates all managed objects, while a CRiskEngine calculates ATR-based protective stops without placing orders itself. Integration is shown with the standard MACD EA: entries stay intact; lifecycle handling becomes a reusable layer.
π Read | AlgoBook | @mql5dev
β€12π9π₯2π2
This article builds a compact MT5 position planning tool that turns Entry, Stop-Loss, and Take-Profit into interactive chart lines, so risk and sizing math updates instantly while levels are dragged.
It supports market, limit, and stop scenarios for both BUY and SELL. Market Entry auto-tracks Bid/Ask on every tick, while pending Entry stays user-controlled. Initial SL/TP spacing is derived from ATR to reflect current volatility, with a safe fallback when ATR isnβt available.
The EA validates the price structure (BUY: SL below Entry, TP above; SELL reversed) before computing stop distance, monetary risk from balance and risk %, normalized lot size using tick size/value plus min/max/step rules, reward, and risk-to-rewardβwithout placing or modifying orders.
π Read | Docs | @mql5dev
It supports market, limit, and stop scenarios for both BUY and SELL. Market Entry auto-tracks Bid/Ask on every tick, while pending Entry stays user-controlled. Initial SL/TP spacing is derived from ATR to reflect current volatility, with a safe fallback when ATR isnβt available.
The EA validates the price structure (BUY: SL below Entry, TP above; SELL reversed) before computing stop distance, monetary risk from balance and risk %, normalized lot size using tick size/value plus min/max/step rules, reward, and risk-to-rewardβwithout placing or modifying orders.
π Read | Docs | @mql5dev
β€35π16β3π€©3π¨βπ»3π2π1
Rare βoutlierβ bars break the core trading assumption that today resembles yesterday, yet they have no labels. This article implements Isolation Forest for MT5 as a compact MQL5 library that isolates points via random partitions, avoiding density modeling and handling multivariate features efficiently.
Key engineering choices make it testable and fast: a replayable 64βbit RNG (splitmix64 + xorshift64*) for deterministic forests, iterative array-based trees with in-place partitioning, and the correct truncated-depth path-length correction and normalization. A 100βtree fit on ~2.4k bars builds in ~2.4 ms; scoring one new bar is ~12 Β΅s.
Feature design is treated as the real lever: no raw prices, no lookahead, and careful column selection because isolation trees sample features uniformlyβuninformative columns directly degrade detection. Validation includes b...
π Read | Docs | @mql5dev
Key engineering choices make it testable and fast: a replayable 64βbit RNG (splitmix64 + xorshift64*) for deterministic forests, iterative array-based trees with in-place partitioning, and the correct truncated-depth path-length correction and normalization. A 100βtree fit on ~2.4k bars builds in ~2.4 ms; scoring one new bar is ~12 Β΅s.
Feature design is treated as the real lever: no raw prices, no lookahead, and careful column selection because isolation trees sample features uniformlyβuninformative columns directly degrade detection. Validation includes b...
π Read | Docs | @mql5dev
π12β€11π€©3π2π₯1
Dendritic Cell Algorithm (DCA) is a metaheuristic derived from innate immunity, originally published in 2005 for anomaly detection. The model integrates multiple signals over time and uses migration thresholds to avoid reacting to noise in single evaluations.
Optimization mapping treats high fitness as PAMP/Danger and low fitness as Safe, with Inflammation derived from population spread. Cells transform inputs into CSM, Semi, Mature via weighted sums and a shared (1+Inflammation) multiplier; migration triggers context selection (mature vs semi).
Per-solution MCAV aggregates contexts with exponential decay. MCAV drives control flow: above 0.5 triggers local mutation, otherwise either move toward best or reinitialize based on exploration rate. Implementation typically models cells, thresholds, weight matrices, agent assignment, and MCAV bookkeeping w...
π Read | AppStore | @mql5dev
Optimization mapping treats high fitness as PAMP/Danger and low fitness as Safe, with Inflammation derived from population spread. Cells transform inputs into CSM, Semi, Mature via weighted sums and a shared (1+Inflammation) multiplier; migration triggers context selection (mature vs semi).
Per-solution MCAV aggregates contexts with exponential decay. MCAV drives control flow: above 0.5 triggers local mutation, otherwise either move toward best or reinitialize based on exploration rate. Implementation typically models cells, thresholds, weight matrices, agent assignment, and MCAV bookkeeping w...
π Read | AppStore | @mql5dev
β€25π10π3π₯2π€©2
Auto ZigZag Fibonacci Golden Zone is an MT5 indicator that derives pullback entry zones from the latest confirmed swing using an internal ZigZag. It scans history to lock the most recent swing high/low, then draws Fibonacci retracements at 50%, 61.8%, and 78.6%.
The 61.8%β78.6% band is marked as the Golden Zone and extended a configurable number of bars. Optional chart labels can trigger when a candle closes inside the zone, with separate handling for uptrend and downtrend measurements.
A compact on-chart panel reports current price, swing points, exact fib levels, and usage steps. Key inputs include ZigZag Length (default 13), Golden Zone Length (15), swing price labels, and signal labels. Calculations are based on closed candles and remain fixed until a new swing is confirmed.
π Read | VPS | @mql5dev
The 61.8%β78.6% band is marked as the Golden Zone and extended a configurable number of bars. Optional chart labels can trigger when a candle closes inside the zone, with separate handling for uptrend and downtrend measurements.
A compact on-chart panel reports current price, swing points, exact fib levels, and usage steps. Key inputs include ZigZag Length (default 13), Golden Zone Length (15), swing price labels, and signal labels. Calculations are based on closed candles and remain fixed until a new swing is confirmed.
π Read | VPS | @mql5dev
β€20π5π€©2π2π₯1π1π¨βπ»1
Market Structure Shift (CHoCH) is used to confirm a directional reversal.
Bullish CHoCH occurs when price breaks above the last confirmed Lower High (LH), shifting bias from bearish to bullish. Bearish CHoCH occurs when price breaks below the last confirmed Higher Low (HL), shifting bias from bullish to bearish.
After confirmation, Areas of Interest (AOI) are mapped for execution. Common zones include Fibonacci Equilibrium anchored from the origin swing, and a post-CHoCH Fair Value Gap (FVG) formed within the first three candles of the breakout impulse, treated as an imbalance-based entry area.
Risk and targets are defined structurally. For buys, stop loss is placed below the origin swing low (0% Fibonacci anchor). For sells, stop loss is placed above the origin swing high (0% anchor). TP1 is set at the breakout structure level (100%). TP2 targets t...
π Read | NeuroBook | @mql5dev
Bullish CHoCH occurs when price breaks above the last confirmed Lower High (LH), shifting bias from bearish to bullish. Bearish CHoCH occurs when price breaks below the last confirmed Higher Low (HL), shifting bias from bullish to bearish.
After confirmation, Areas of Interest (AOI) are mapped for execution. Common zones include Fibonacci Equilibrium anchored from the origin swing, and a post-CHoCH Fair Value Gap (FVG) formed within the first three candles of the breakout impulse, treated as an imbalance-based entry area.
Risk and targets are defined structurally. For buys, stop loss is placed below the origin swing low (0% Fibonacci anchor). For sells, stop loss is placed above the origin swing high (0% anchor). TP1 is set at the breakout structure level (100%). TP2 targets t...
π Read | NeuroBook | @mql5dev
β€16π15β‘3π€©2π2π₯1
Dynamic flip zones update automatically, converting broken Support into SBR and broken Resistance into RBS on confirmed closes. Optional behavior allows broken zones to be removed instead of flipped.
Zones are drawn as normalized rectangles rather than thin lines. Width is adjusted using average historical volatility, reducing oversized areas and expanding narrow ones to keep sizing consistent across market regimes.
Repaint risk is reduced via confirmation bars that validate pivot points before zones are plotted. Pivot detection is based on ZigZag swing highs and lows, with additional filters to keep levels relevant.
Alerts are gated by a minimum move-away requirement. Price must travel a defined distance from a new zone before a retest can trigger notifications, cutting noise in ranges.
Overlap handling includes Most Extreme and Newest modes to ma...
π Read | NeuroBook | @mql5dev
Zones are drawn as normalized rectangles rather than thin lines. Width is adjusted using average historical volatility, reducing oversized areas and expanding narrow ones to keep sizing consistent across market regimes.
Repaint risk is reduced via confirmation bars that validate pivot points before zones are plotted. Pivot detection is based on ZigZag swing highs and lows, with additional filters to keep levels relevant.
Alerts are gated by a minimum move-away requirement. Price must travel a defined distance from a new zone before a retest can trigger notifications, cutting noise in ranges.
Overlap handling includes Most Extreme and Newest modes to ma...
π Read | NeuroBook | @mql5dev
β€25π¨βπ»5π3π₯3π2β1π1
Many indicator specs claim βnon-repaintingβ without a measurable definition. A testable invariant is stricter: once a bar is closed and processed, any drawn object on that bar must never change, move, recolor, change text, or vanish.
A script operationalizes this by recording every object after an initial pass, then appending more bars and forcing a full recalculation so the indicator rebuilds from a longer history. Objects on already-closed bars are matched and compared field by field (anchor times/prices, color, text). This targets failures caused by object names tied to bar index rather than bar time.
Changes and disappearances are tracked separately; only changes falsify the claim. Empty comparisons are reported as inconclusive. Results are written to CSV (one row per symbol/timeframe/step) including compared/changed/vanished counts and the first o...
π Read | VPS | @mql5dev
A script operationalizes this by recording every object after an initial pass, then appending more bars and forcing a full recalculation so the indicator rebuilds from a longer history. Objects on already-closed bars are matched and compared field by field (anchor times/prices, color, text). This targets failures caused by object names tied to bar index rather than bar time.
Changes and disappearances are tracked separately; only changes falsify the claim. Empty comparisons are reported as inconclusive. Results are written to CSV (one row per symbol/timeframe/step) including compared/changed/vanished counts and the first o...
π Read | VPS | @mql5dev
β€25π12π₯3π2π1
This article builds a practical case for a Cairo-style 2D renderer in pure MQL5 to draw modern UI elements (rounded rectangles, rings, gradients, translucent layers, arbitrary polygons) as a single OBJ_BITMAP_LABEL, avoiding the performance and feature limits of native chart objects and CCanvas.
The core model separates geometry (paths) from paint (sources), then converts paths into a per-pixel coverage mask for true anti-aliasing. Rendering becomes compositing: source through mask onto destination, so new paints (solid, gradients, images) automatically work with all shapes.
Part 1 focuses on the foundation: a strict ARGB uint color pipeline compatible with ResourceCreate, and a reusable pixel surface bound to one bitmap objectβkeeping later improvements isolated to masking and painting logic.
π Read | Calendar | @mql5dev
The core model separates geometry (paths) from paint (sources), then converts paths into a per-pixel coverage mask for true anti-aliasing. Rendering becomes compositing: source through mask onto destination, so new paints (solid, gradients, images) automatically work with all shapes.
Part 1 focuses on the foundation: a strict ARGB uint color pipeline compatible with ResourceCreate, and a reusable pixel surface bound to one bitmap objectβkeeping later improvements isolated to masking and painting logic.
π Read | Calendar | @mql5dev
β€22π6π2π€©1
Manually scrolling to a specific candle in MT5 becomes impractical on lower timeframes and deep history. This History Navigator EA solves it with a small dialog where day/month/year/hour/minute are entered, then the chart jumps to the correct historical area and can return to the live market view in one click.
The design separates concerns: lifecycle code in HistoryNavigator.mq5, and UI + logic in a CNavigatorDialog class built on the Standard Library (CAppDialog, event map, controls). Inputs are validated in two stages: range checks plus real calendar validation with leap-year handling, then converted via MqlDateTime + StructToTime().
Bar location uses CopyTime() and a binary search over available history, selecting the latest bar open not exceeding the requested timestamp. Chart positioning disables auto-scroll/shift, centers the target using CHART_VISIBLE_...
π Read | Forum | @mql5dev
The design separates concerns: lifecycle code in HistoryNavigator.mq5, and UI + logic in a CNavigatorDialog class built on the Standard Library (CAppDialog, event map, controls). Inputs are validated in two stages: range checks plus real calendar validation with leap-year handling, then converted via MqlDateTime + StructToTime().
Bar location uses CopyTime() and a binary search over available history, selecting the latest bar open not exceeding the requested timestamp. Chart positioning disables auto-scroll/shift, centers the target using CHART_VISIBLE_...
π Read | Forum | @mql5dev
β€12π4π₯3π2
Momentum oscillators often become noisy when raw price differences are used directly. A Hull Moving Average layer can smooth the series while staying responsive to direction changes.
An MQL5 implementation combines classic momentum (Close[i] minus Close[i+Length]) with HMA built from multiple WMAs: a fast WMA on half period, a slow WMA on full period, then a final WMA on the rounded square-root period.
The design relies on separate buffers for raw momentum, intermediate HMA values, final output, color indices, a zero reference, and a fixed gray fill between the line and zero.
Interpretation is based on position versus the zero line; crossings indicate state change but degrade in flat regimes due to frequent flips and reduced signal quality.
π Read | Forum | @mql5dev
An MQL5 implementation combines classic momentum (Close[i] minus Close[i+Length]) with HMA built from multiple WMAs: a fast WMA on half period, a slow WMA on full period, then a final WMA on the rounded square-root period.
The design relies on separate buffers for raw momentum, intermediate HMA values, final output, color indices, a zero reference, and a fixed gray fill between the line and zero.
Interpretation is based on position versus the zero line; crossings indicate state change but degrade in flat regimes due to frequent flips and reduced signal quality.
π Read | Forum | @mql5dev
β€13π7π₯1π€©1π1
Clustered feature importance depends on a correlation matrix that is both denoised and detoned. Estimation noise inflates spurious correlations, and a dominant first eigenvector from shared regime exposure makes unrelated feature families look similar. Both effects break clustering and bias MDI/MDA via substitution.
Noise is bounded using a MarcenkoβPastur fit, with q = T/N and sigma^2 fit to the empirical eigenvalue density. Two common silent failures are inverting q and using an incompatible KDE bandwidth definition, both yielding plausible but incorrect ceilings.
For serially correlated bars, raw T overstates information. An AR(1)-style effective sample size can shift lambda_max enough to change factor retention near the margin. After denoising (constant residual eigenvalues) and detoning (remove top eigenvector), ONC/K-means clustering recovers...
π Read | AlgoBook | @mql5dev
Noise is bounded using a MarcenkoβPastur fit, with q = T/N and sigma^2 fit to the empirical eigenvalue density. Two common silent failures are inverting q and using an incompatible KDE bandwidth definition, both yielding plausible but incorrect ceilings.
For serially correlated bars, raw T overstates information. An AR(1)-style effective sample size can shift lambda_max enough to change factor retention near the margin. After denoising (constant residual eigenvalues) and detoning (remove top eigenvector), ONC/K-means clustering recovers...
π Read | AlgoBook | @mql5dev
π9β€6π€©1π1
MetaTrader 5 file access stays inside the terminal sandbox, so identical file APIs can yield different internal layouts while producing the same terminal output.
Directory traversal in MQL5 splits into two paths. Interactive selection uses FileSelectDialog with a fixed root, constrained filters, and flags; results come back via a dynamic string array and are typically passed into FileOpen.
Non-interactive enumeration relies on FileFindFirst/FileFindNext. An empty sandbox returns an invalid handle and is not a code error. Basic enumeration lists only the current directory; recursive traversal requires passing subdirectory paths. A trailing slash in returned names can be used to detect directories without FileIsExist, but output may lose full path context unless it is assembled explicitly.
π Read | AlgoBook | @mql5dev
Directory traversal in MQL5 splits into two paths. Interactive selection uses FileSelectDialog with a fixed root, constrained filters, and flags; results come back via a dynamic string array and are typically passed into FileOpen.
Non-interactive enumeration relies on FileFindFirst/FileFindNext. An empty sandbox returns an invalid handle and is not a code error. Basic enumeration lists only the current directory; recursive traversal requires passing subdirectory paths. A trailing slash in returned names can be used to detect directories without FileIsExist, but output may lose full path context unless it is assembled explicitly.
π Read | AlgoBook | @mql5dev
β€3π€©3π2π1