Latest posts

MQL5 Algo Trading
23 Sept, 22:01
A recurring failure mode in ML trading shows up again: out-of-sample direction accuracy above 60% can still produce weak or negative PnL once spreads, swaps, slippage, and regime shifts are included.Version updates improved dataset quality via strict UP/DOWN balancing, richer features (ATR/RSI/Bollinger position), and structured fine-tuning examples. These steps raise predictive consistency but do not align labels with profit.Key issues remain: forced binary outputs remove the “no trade” state; confidence tied to move magnitude does not map to expectancy after costs; parsers with hard fallbacks can introduce systematic bias; backtests with few trades and no costs inflate results.Next iteration needs profit-based targets (LONG/SHORT/FLAT or expected PnL), cost-aware validation, and evaluation by trading metrics rather than accuracy.👉 Read | CodeBase | @mql5dev


MQL5 Algo Trading
23 Sept, 20:01
Most EAs treat exits as fixed-point stops. That keeps risk deterministic but ignores volatility regime shifts: tight during spikes, loose during quiet sessions.A reusable MQL5 volatility trailing stop can be built around Simple True Range (closed bars only) with a live Bid/Ask anchor. The stop ratchets one-way and is quantized to SYMBOL_TRADE_TICK_SIZE to avoid off-tick rejections.A broker-aware engine should validate SYMBOL_TRADE_STOPS_LEVEL and SYMBOL_TRADE_FREEZE_LEVEL before calling CTrade::PositionModify(), and confirm success via ResultRetcode() rather than boolean returns. A minimum-step filter and optional only-in-profit guard reduce modification noise.A non-repainting diagnostic indicator can approximate the logic using Close[i-1] anchoring, while an EA template can log telemetry (evaluations, updates, skips, retcodes) for Strategy Tester ...👉 Read | Calendar | @mql5dev


MQL5 Algo Trading
23 Sept, 18:01
Operator overloading in MQL5 moves past arithmetic quickly once flow control depends on relational and logical operators.A stComplex example shows typical compiler failures: missing overloads for “<” and for “+=” when the right operand is another stComplex. Adding the required overloads fixes compilation but can still break loop behavior if the comparison returns false early, producing wrong counters or infinite loops.Operand order is another constraint. Overloads defined on stComplex cannot be called when the left operand is a built-in type. The workaround is explicit construction or casting to stComplex via a constructor.Further examples extend to “>” and bitwise operators, noting that bitwise operations on doubles depend on integer reinterpretation and IEEE-754 details.👉 Read | Freelance | @mql5dev


MQL5 Algo Trading
23 Sept, 16:00
Work begins on integrating core components into an MT5 replay/simulation system, prioritizing progress over minor UI edge cases in the position indicator. Duplicate drawing logic is consolidated with scoped macros, reducing maintenance and simplifying porting by removing symbol-specific dependencies.The key blocker is reliance on live-server position APIs. The indicator is refactored to route all PositionGet/Select calls through wrapper functions, enabling the same codepath to work on real accounts or in replay mode.Replay mode uses SQLite as the trade “server” state: the Expert Advisor creates and updates the database, while the indicator only reads it and refreshes via custom events. The replay framework is also updated for current MT5 behavior, including Z-order fixes for clickable controls and inheritance/constructor changes in the control classes.👉 Read | Freelance | @mql5dev


MQL5 Algo Trading
23 Sept, 14:00
MetaTrader history reports closed deals as a flat list and offers no session-level attribution. Session performance testing usually requires exporting to spreadsheets and tagging rows by UTC hour.A modular MQL5 pipeline automates this: read closed deals for a lookback window, assign each deal to Sydney/Tokyo/London/New York by UTC close hour, and aggregate net P&L, win rate, trade count, and average hold time. Output is a CCanvas bar chart plus a plain-text table in Experts, with an account-wide totals row.Implementation uses a history reader (DEAL_ENTRY_OUT/INOUT), position open-time recovery via DEAL_POSITION_ID scan, overlap resolution by boundary order, and tests that assert boundary classification, midnight wrapping, aggregation sums, and hold-time math.Known constraints: fixed UTC boundaries, broker time-basis must be verified, and earliest pos...👉 Read | Calendar | @mql5dev


MQL5 Algo Trading
23 Sept, 12:00
Part 6 revisits the earlier DFT + Leaky Integrate-and-Fire SNN EA, shifting from finding new techniques to stress-testing known components across seven operating modes. The DFT extracts the strongest cycle from a rolling window (price, MACD, or RSI) and gates direction via a phase threshold; the SNN accumulates bullish/bearish “charge” across bars using decay and a firing threshold.Each mode is optimized on ~2/3 of data, then forward-walked on the final third with frozen inputs while varying symbol, timeframe, and test window. Results were mixed: five forward runs profitable, two losing, highlighting parameter fragility rather than a confirmed edge.Key takeaways: window length vs noise/lag is critical; MACD/RSI smoothing interacts with DFT memory; multi-source voting underperformed without per-source tuning; SNN modes need input normalization (e.g., vo...👉 Read | AppStore | @mql5dev


MQL5 Algo Trading
23 Sept, 10:00
Operator overloading can improve readability, but it can also make debugging harder when expressions are not evaluated the way they look.A practical pattern is to overload operators to route assignments and arithmetic through a Debug function, adding call-site context (for example, passing the source line) and printing to the MetaTrader 5 terminal.A key detail is return type. Debugging inserted into assignment expressions fails if the debug hook is void. Fixes require returning the current object (or a suitable proxy) so the full expression remains valid.Using this avoids creating temporary instances. Temporary objects can change memory addresses and behavior, and with aggressive operator overloading can yield inconsistent results that are difficult to reproduce.👉 Read | NeuroBook | @mql5dev


MQL5 Algo Trading
23 Sept, 08:00
Position indicator work for a replay/simulation service moved toward decoupling. C_ElementsTrade removed direct dependencies on live position APIs by concentrating changes around DispatchMessage.Symbol retrieval via PositionGetString was replaced by passing the symbol into the constructor and storing it as a private member. Iteration over PositionsTotal and PositionGetTicket was dropped; a chart-wide custom event now triggers per-indicator refresh using the already known ticket.PositionGetDouble for SL/TP was removed by pushing SL/TP values into UpdatePrice, using cross-references so the opposite level is available when editing. Position API calls were relocated to main indicator code for controlled use.A chart-duplication bug was fixed by replacing ObjectFind with ChartWindowFind. Additional logic was added to flag invalid SL/TP ranges via color...👉 Read | Freelance | @mql5dev


MQL5 Algo Trading
22 Sept, 16:00
High-impact economic releases routinely cause spread expansion and slippage that invalidate clean backtests. Event timing is known in advance; the failure point is delivering a reliable schedule into an EA.Web scraping breaks on HTML changes. Paid calendar APIs add cost and require runtime connectivity, which is fragile on VPS setups. A file-based news filter avoids both by loading a Forex Factory CSV export from MQL5/Files at startup and running fully offline.Core components: typed CNewsEvent records with an impact enum, a quote-aware CSV parser, symbol currency extraction that handles broker suffixes, and an inclusive time-window checker with CheckAt for boundary tests. Optional chart rectangles visualize pre/post buffers for qualifying events.👉 Read | Freelance | @mql5dev


MQL5 Algo Trading
22 Sept, 14:00
Ed Seykota implemented an early computerized trend system in 1970 using FORTRAN on mainframes. Core logic: dual EMA crossover for direction, daily execution, multi-week holding, no intraday monitoring.Key rules: fast/slow EMA (commonly ~20/200) plus an ADX filter to avoid range conditions (ADX > 20). Position sizing uses ATR-based risk parity: equity risk % divided by ATR stop value (typical ATR(20) with 3–5x multiplier). Exits use EMA reversal or ATR stop, no fixed take profit.Main differentiator is portfolio heat. Residual risk is summed across all open positions and capped (often 10–20%); new entries are blocked when the cap is reached, limiting correlated drawdowns in multi-symbol portfolios. MQL5 EA architecture monitors a symbol list on D1, computes heat first, then evaluates exits and entries per symbol.👉 Read | VPS | @mql5dev


MQL5 Algo Trading
22 Sept, 12:00
This article dissects a fragile point in an MT5 automated optimization pipeline built on Adwizard: a multi-stage process can finish “successfully” yet silently skip tester passes, leaving no final EA database. The root cause may be terminal-side issues (history loading, beta instability), not strategy code.The key debugging method is database-driven: inspect stages/jobs/tasks/passes in SQLite, detect near-zero task durations and missing passes, then recover by re-queuing an entire stage (status Done -> Queued) so triggers propagate to jobs and tasks.It also validates the generated final EA and shows how risk/close managers can distort expected drawdown when equity grows fast, highlighting the need to align normalization and live lot-sizing. Finally, it outlines practical prep for project creation: pre-run optimizations and choose parameter ranges from dat...👉 Read | Calendar |


MQL5 Algo Trading
22 Sept, 10:00
Tree performance depends on the path length, not on a generic “imbalance” label. Height differences between subtrees can lengthen specific traversals, while other operations remain fast.Balanced search trees reduce comparisons sharply. A million keyed records can be located in under 20 steps in a well-balanced binary tree, based on the per-level growth rule for P-ary branching.Balancing is handled via local balance factors and rotations. Rotations rewire parent-child links while preserving in-order key ordering, but global balance requires validating all nodes.Recomputing subtree heights by traversal after each update is costly. A practical optimization is storing subtree height per node to update balance factors incrementally.👉 Read | Freelance | @mql5dev


MQL5 Algo Trading
22 Sept, 08:00
Position view updates for an MT5 replay/simulation stack focus on robustness and data completeness.Open-position volume is added to the indicator via an OBJ_EDIT element, favoring X/Y placement over price/time anchoring. Formatting adapts to fractional volumes by suppressing decimals when the value is effectively an integer. Viewport updates are reordered to keep the volume field aligned, and dynamic sizing is adjusted to prevent background clipping.Object deletion is handled through CHARTEVENT_OBJECT_DELETE. Internal deletes temporarily disable event handling to avoid false recovery. A small helper centralizes this toggle. Segment restoration is refined by allowing a negative sentinel in m_Info.price so missing SL/TP segments recreate only the move handle, not the full segment UI.👉 Read | NeuroBook | @mql5dev


MQL5 Algo Trading
22 Sept, 06:00
Risk Guard is an account-level risk control utility, not a trading system. It never opens positions. A single chart instance can monitor manual trades and other EAs, with each rule configurable or disabled.Core functions include on-chart risk-based lot sizing using tick value, tick size, and volume step; a daily loss limit that can close all positions and then auto-close any new trades until the next server day, with the lock persisted via a terminal global variable; maximum open positions with newest-over-cap closures; oversized-trade trimming based on actual SL distance; forced stop-loss insertion; and a spread status warning.Enforcement is triggered via OnTradeTransaction on deal-add for same-tick intervention, with daily P/L computed from closed results since server midnight plus floating P/L, checked on tick and timer. All actions are logged and can ...👉 Read | Docs |


MQL5 Algo Trading
22 Sept, 04:00
Prop-firm equity guard utility targets challenge rule compliance by enforcing account-level risk limits from a single chart instance. It monitors equity in the background and triggers a shutdown sequence before daily or maximum drawdown thresholds are breached.Daily loss control supports an optional buffer below the firm’s limit, closes all positions, and blocks new trading until the next server-day reset. Maximum drawdown monitoring applies the same logic at the account limit.On trigger, the kill-switch closes active trades and removes all pending orders across symbols to prevent accidental fills during volatility or spread widening. No multi-chart setup is required; all symbols and timeframes are covered.For automation, a global flag is set so other EAs can halt execution with a single conditional check.👉 Read | Quotes | @mql5dev


MQL5 Algo Trading
21 Sept, 04:00
John Ehlers’ HighPass-LowPass Roofing Filter, described in Cycle Analytics For Traders (p.78), is a roofing-filter variation designed to isolate trend direction by removing unwanted frequency components.Interpretation is straightforward: readings below 0 indicate a downtrend, while values above 0 indicate an uptrend. Some implementations also color the line to reflect bias, commonly using green for bullish conditions and red for bearish conditions.Practical signals are typically derived from zero-line crosses and sustained position on one side of 0, rather than single-bar color changes, to reduce noise-driven flips.👉 Read | Freelance | @mql5dev


MQL5 Algo Trading
20 Sept, 08:00
DoEasy adds an indicator object layer to standardize storage and reuse of indicators across programs. The base model follows existing library objects: an abstract base with descendants for standard and custom indicators, plus classification by group (trend, oscillator, volumes, arrows) for filtering and sorting.Library updates include new message indices/text, default indicator object parameters, a dedicated object ID, and enumerations for properties and sort criteria. A new CIndicatorDE class (IndicatorDE.mqh) derives from CBaseObj, adds an explicit destructor for releasing the created handle, and implements full-field equality, including MqlParam structure and array comparison.Testing wires the object into CBuffersCollection via CreateAC(), uses IndicatorCreate() without parameters for AC, prints object data to the journal, then deletes the objec...👉 Read | AlgoBook | @mql5dev


MQL5 Algo Trading
20 Sept, 06:03
HimNet tackles forecasting in trading data where behavior shifts across venues and over time, making “one model fits all” averages unreliable. It learns spatial and temporal context directly from data, so the model can adapt without relying on external metadata that is often missing or stale.The core mechanism is trainable embeddings (time-of-day, day-of-week, and per-series location vectors) that form regime clusters. Those clusters query compact meta-parameter pools to generate context-specific weights as mixtures, keeping memory and latency practical.On top of this, a graph-convolutional recurrent unit uses dynamically generated convolution parameters, letting cross-market influence change with regime. For traders and MT5 developers, this translates into more stable liquidity/volatility forecasts, better execution settings per session/venue, ...👉 Read | Quotes | @mql5dev


MQL5 Algo Trading
20 Sept, 06:00
MSB Pro ALGO Position Risk Monitor is a free visual risk monitoring indicator for MetaTrader 5. It evaluates currently open positions and renders stop-loss risk metrics directly on the chart, using broker symbol specifications and platform profit calculation functions.The panel reports total known open risk, account risk percent (based on equity, with balance fallback), counts of positions with and without stop loss, total positions, total lot size, protected/breakeven stop-loss count, and maximum single-position risk. It also shows a per-position table with symbol, side, lot size, stop price, monetary risk, risk percent, and a LOW/MODERATE/HIGH status.Positions with stop loss at or beyond entry are treated as protected with zero remaining entry-to-stop risk. Positions without stop loss trigger an unbounded downside warning while known stop-defined...👉 Read | NeuroBook | @mql5dev


MQL5 Algo Trading
20 Sept, 04:02
Beetle Swarm Optimization (BSO) merges Beetle Antennae Search (two-point probing without gradients) with Particle Swarm Optimization to reduce sensitivity to the initial point and improve performance on rugged, multi-dimensional objectives.Each beetle maintains position, velocity, personal best, and a shared global best. Per iteration it samples fitness at two antenna tips aligned with velocity, converts the better side into a BAS increment, updates velocity via PSO (inertia + cognitive/social pulls), then blends both moves using a λ coefficient to switch from pure BAS to pure PSO.Exploration-to-exploitation is handled by linearly decreasing inertia and exponentially shrinking antenna step size and spacing.The MQL5 implementation fits a standard Moving/Revision test bench using a phase-driven state machine, because each logical step needs three fitn...👉 Read | Docs | @mql5dev

Related Channels
Other channels in the same section of the catalogue.
