Posts of MQL5 Algo Trading

newest first

#4247Photo

Convolutional neural networks are adapted from image recognition to price charts to improve pattern detection under shifts and scaling. The core idea is alternating convolution (feature extraction via learned kernels) and subsampling (dimension reduction and noise suppression), then feeding the resulting feature vector into a fully connected perceptron for decisions. The article details MQL5-style implementation: virtualized neuron classes with dispatch logic so feed-forward, gradient computation, and weight updates work across fully connected, convolution, and subsample layers. Subsampling uses windowed averaging (or max) with no trainable weights. Training follows backprop with CNN-specific gradient flow: pooling gradients are routed to max locations or evenly distributed for averaging, while convolution gradients use padding plus convolution with a 180°-rotate... 👉 Read | Calendar | @mql5dev

Open in Telegram
Views5,032−50%vs avg
Forwards6
Reactions6
Comments—
Views growthHide views growth

Views growth

Hours after publication

Show as table
Hours after publicationViews
0 h0
1 h1,840
3 h5,032
  1. After 1 hour1,840
  2. Total to date5,032
#4246Photo

Many execution errors in manual trading come from arithmetic. A lot size computed mentally, combined with a wider stop than intended, often pushes realized risk far beyond the plan. This panel focuses on risk calculation only and never opens trades without a button press. It displays current risk percent and its value in account currency, stop distance (fixed points or ATR-based), the lot size that matches the selected risk, plus spread, open volume, and floating P/L. BUY/SELL sends a market order with stop and optional target attached; target is a stop multiple (2R default). Lot sizing is rounded down to the volume step, capped by broker limits and free margin, and avoids server rejections. Stops respect trade stops and freeze levels, widened by spread. Netting-mode opposite orders are blocked with a warning to prevent unattached stops. Inputs cover rules ... 👉 Read | AlgoBook | @mql5dev

Open in Telegram
Views6,511−36%vs avg
Forwards5
Reactions13
Comments—
Views growthHide views growth

Views growth

Hours after publication

Show as table
Hours after publicationViews
0 h0
1 h2,803
5 h6,511
  1. After 1 hour2,803
  2. After 6 hours6,511
  3. Total to date6,511
#4245Photo

RegimeRouter is an EA structure built around explicit regime classification plus per-regime performance accounting. The classifier runs on each closed bar and combines three independent signals: ADX for directional strength, Hurst exponent on log returns for persistence vs anti-persistence, and lag-1 autocorrelation for continuation vs snapback. Each voter assigns trend, range, or abstains; the regime is committed only when the summed votes clear a configurable minimum, otherwise the system stays neutral and does not trade. Routing is split into two modules. TREND trades N-bar breakouts only when fast/slow EMAs agree on direction. RANGE trades mean reversion by fading a stretched z-score versus a moving average. NEUTRAL places no orders. Trades are stamped via magic numbers that include the regime id, and a startup rebuilds a ledger from deal histor... 👉 Read | CodeBase | @mql5dev

Open in Telegram
Views7,350−27%vs avg
Forwards7
Reactions3
Comments—
Views growthHide views growth

Views growth

Hours after publication

Show as table
Hours after publicationViews
0 h1,291
7 h7,350
  1. After 1 hour1,291
  2. After 6 hours7,350
  3. Total to date7,350
#4244Photo

Backtests often flatten multiple entry conditions into one profit factor, which hides where losses originate. Splitting results by setup type can change the conclusion: on USDCAD M1 one side produced most of the drawdown while the other was near flat. A small MT5 ledger can tag each order with a setup id by encoding it into the magic number at send time. After positions close, it aggregates by DEAL_POSITION_ID to avoid partial-close double counting, and reports per-setup wins/losses plus net P/L including swap and commission. Beyond raw win rate, the report adds a Wilson score lower bound and compares it to the breakeven rate implied by the reward ratio. This keeps early samples honest and prevents “trusted” labels based on a handful of trades. Key constraints: registration order becomes a data format, new setups must be appended, and stacked entries into o... 👉 Read | Signals | @mql5dev

Open in Telegram
Views8,349−17%vs avg
Forwards8
Reactions12
Comments—
Views growthHide views growth

Views growth

Hours after publication

Show as table
Hours after publicationViews
0 h0
1 h2,078
9 h8,349
  1. After 1 hour2,078
  2. Total to date8,349
#4243Photo

MetaTrader 5 strategy optimization typically relies on brute-force sweeps or the built-in genetic algorithm, but GA behavior varies with implementation details. The article builds an alternative optimizer around Particle Swarm Optimization, treating EA inputs as coordinates and iteratively updating particle positions using inertia plus attraction to each particle’s best state and the best state within its social group. Because EA parameters are discrete, particle coordinates are rounded to configured steps. To avoid wasting passes on repeated parameter sets, each candidate point is hashed (CRC64 over the parameter bytes) and tracked in a binary search tree for fast “seen/not seen” checks. The PSO core is decoupled from any EA via a Functor interface returning a user-selected trading metric, then validated against benchmark functions. For parallel t... 👉 Read | Docs | @mql5dev

Open in Telegram
Views16,551+64%vs avg
Forwards9
Reactions—
Comments—
Views growthHide views growth

Views growth

Hours after publication

Show as table
Hours after publicationViews
0 h298
13 h9,097
31 h16,551
  1. After 24 hours16,551
  2. Total to date16,551
#4242Photo

Many lot size calculators hardcode pip value assumptions that break on gold, indices, JPY crosses, and non-USD account currencies. A sizing routine should use the tick and volume properties the trade server publishes per symbol, then compute risk from those inputs. CalcLots() takes risk in account currency plus entry and stop prices, then returns the trade volume and the actual risk after broker constraints. Volume is always rounded down to the volume step. If requested risk is below the minimum lot, the minimum is returned, clamped_min is set, and the higher real risk is reported. The function is direction-agnostic and also provides stop distance in points and point value per 1.00 lot. The sizing math is isolated in Calc.mqh with no terminal state. It consumes a SymbolSpec struct and can be tested offline. SpecFromSymbol() is the only live-data bridge and... 👉 Read | NeuroBook | @mql5dev

Open in Telegram
Views13,306+32%vs avg
Forwards7
Reactions5
Comments—
Views growthHide views growth

Views growth

Hours after publication

Show as table
Hours after publicationViews
0 h0
1 h1,121
15 h8,107
33 h13,306
  1. After 1 hour1,121
  2. Total to date13,306
#4241Photo

Multi-symbol EAs that size trades from a correlation matrix often show unstable weights across adjacent rebalance windows. With N symbols and T bars, correlation estimates become dominated by sampling error when T is not much larger than N, even if market structure is unchanged. Random Matrix Theory offers a practical filter. Using the Marchenko–Pastur upper edge with Q=T/N, eigenvalues at or below lambda_max are treated as noise; only eigenvalues above the edge are retained as signal. A native MQL5 implementation can run without ALGLIB or DLLs by using a symmetric Jacobi eigendecomposition and a flat-buffer matrix class. Noise eigenvalues are replaced by their average to preserve the trace, then the cleaned matrix is reconstructed for downstream sizing. A useful runtime check is Frobenius distance between consecutive windows: denoised matrices ty... 👉 Read | VPS | @mql5dev

Open in Telegram
Views11,901+18%vs avg
Forwards4
Reactions16
Comments—
Views growthHide views growth

Views growth

Hours after publication

Show as table
Hours after publicationViews
0 h0
4 h2,135
21 h8,239
39 h11,901
  1. After 6 hours2,135
  2. After 24 hours8,239
  3. Total to date11,901
#4240Photo

Maximum drawdown reports miss a key variable: time underwater. Two systems can share the same 15% max drawdown and still differ materially in recovery duration. A dashboard script reconstructs an equity curve from closed deals by summing profit, swap, and commission per exit, sorting by deal time, then folding into a running balance. A single-pass analyzer segments drawdowns into start, trough, and recovery, flags still-open episodes, and computes duration in calendar days. Summary stats report deepest depth, longest duration, average recovery time (closed only), and open count. Output includes a CCanvas timeline with shaded drawdown bands and alternating-row labels, plus a terminal table sorted by duration so long shallow drawdowns surface first. 👉 Read | Signals | @mql5dev

Open in Telegram
Views10,578+5%vs avg
Forwards9
Reactions25
Comments—
Views growthHide views growth

Views growth

Hours after publication

Show as table
Hours after publicationViews
0 h0
6 h3,103
23 h7,822
41 h10,578
  1. After 6 hours3,103
  2. After 24 hours7,822
  3. Total to date10,578
#4239Photo

Serial autocorrelation can remain hidden behind a clean equity curve. Lag-1 checks are insufficient; dependence often shows up at higher lags or across a block of lags. The Ljung-Box portmanteau test addresses this by aggregating sample autocorrelations through horizon h into a single Q statistic and chi-square p-value. Residual diagnostics matter: if ARIMA/GARCH residuals remain autocorrelated, the model is leaving structure unmodeled, and downstream stats assuming independence can be biased. An MQL5 toolkit (no external deps) implements ACF, Ljung-Box Q, df adjustment, and p-values via the regularized incomplete gamma function (MQL5 lacks a chi-square CDF). Inputs support three data sources: closed-bar price returns, closing-deal P/L sequences, or external residual files, with guards for zero variance, invalid df, and malformed lag sets. 👉 Read | AlgoBook | @mql5dev

Open in Telegram
Views9,799−3%vs avg
Forwards5
Reactions24
Comments—
Views growthHide views growth

Views growth

Hours after publication

Show as table
Hours after publicationViews
0 h0
8 h4,237
25 h7,712
43 h9,799
  1. After 6 hours4,237
  2. After 24 hours7,712
  3. Total to date9,799
#4238Photo

SAGDFN targets spatio-temporal forecasting bottlenecks by reducing redundant edges early. Significant Neighbors Sampling builds a sparse neighborhood per node using similarity-ranked candidates plus random picks to preserve diversity and limit overfitting. Sparse Spatial Multi-Head Attention operates on the sparse graph and prunes weak links more aggressively via Entmax-style normalization. In practice, Sparse-SoftMax can replace iterative α-Entmax to avoid τ search overhead while keeping hard sparsity. OneStepFastGConv consolidates spatial aggregation into a single step. Implementation details center on GPU SpMM and its backward pass: local reductions, guarded indexing, and separate gradients for sparse weights and dense inputs, integrated into a recurrent GRU-like block with explicit intermediate buffers. 👉 Read | Quotes | @mql5dev

Open in Telegram
Views9,502−6%vs avg
Forwards4
Reactions15
Comments—
Views growthHide views growth

Views growth

Hours after publication

Show as table
Hours after publicationViews
0 h0
10 h5,187
27 h7,749
45 h9,502
  1. After 24 hours7,749
  2. Total to date9,502
#4237Photo

Native MT5 chart objects make table UIs hard to maintain: RectLabel/Edit grids require manual coordinates, per-object styling, and tight synchronization. A reusable CTable class resolves this by separating cell state from rendering and centralizing layout and lifecycle. Each cell stores width/height, colors, alignment, read-only, and description, plus “custom color” flags to protect overrides when defaults change. CTable manages backgrounds, cell objects, headers, and Refresh-driven updates. Core API: CoordinatesSet and WidthHeightSet clamp values and move/resize objects safely; CellsInitialize is required to size arrays and compute cell geometry; Create builds frame objects and per-cell controls with rollback on errors. PrefixSet renames all objects consistently. Per-cell setters/getters update both stored state and live objects; CellsColorSet, HeadersCo... 👉 Read | AlgoBook | @mql5dev

Open in Telegram
Views9,612−5%vs avg
Forwards2
Reactions20
Comments—
Views growthHide views growth

Views growth

Hours after publication

Show as table
Hours after publicationViews
0 h0
12 h5,969
29 h7,915
47 h9,612
  1. After 24 hours7,915
  2. Total to date9,612
#4236Photo

Canvas-based MQL5 dashboards can remain visually correct while losing responsiveness when every hover, scroll, or popup triggers a full repaint and repeated OS text measurements. Under rapid interaction, event volume outpaces rendering and causes stutter. A performance pass keeps output unchanged by combining frame throttling and partial rendering. Rendering is capped at ~16 ms per frame, collapsing event bursts into a single paint via a timer flush. Repaints are limited to the affected pane or region, with popups restored from a frozen backdrop using bulk rectangle copies. Implementation details include a direct-buffer CCanvas subclass for fast row copies, a text-width memo table keyed by text/font/size, and a glyph cache storing alpha coverage maps under a fixed memory budget. Hover handling maps to region masks to repaint only the touched bands,... 👉 Read | NeuroBook | @mql5dev

Open in Telegram
Views9,334−8%vs avg
Forwards5
Reactions28
Comments—
Views growthHide views growth

Views growth

Hours after publication

Show as table
Hours after publicationViews
0 h0
14 h6,409
31 h8,118
49 h9,334
  1. After 24 hours8,118
  2. Total to date9,334
#4235Photo

MQL5 can be extended with a small OS-style helper layer to standardize filesystem work, using native terminal APIs as building blocks. Coverage is narrower than Python, but enough for common file and folder tasks. Core methods map cleanly: getcwd (via script path and parent), listdir, scandir with a lightweight DirEntry equivalent, remove (FileDelete), rmdir, rename/move (FileMove), mkdir (FolderCreate), and stat via a custom stat_result with size and timestamps. A companion os.path-style class can provide exists, isfile, isdir (including handling ERR_FILE_IS_DIRECTORY 5018), join using arrays, and split. Result is a consistent interface for reuse in MT5 projects without DLL dependencies. 👉 Read | Docs | @mql5dev

Open in Telegram
Views9,366−7%vs avg
Forwards6
Reactions37
Comments—
Views growthHide views growth

Views growth

Hours after publication

Show as table
Hours after publicationViews
0 h0
16 h6,789
33 h8,189
51 h9,366
  1. After 24 hours6,789
  2. Total to date9,366
#4234Photo

FX options desks work in delta space, not strike space. Standard quotes per expiry are ATM volatility, 25-delta risk reversal, and 25-delta butterfly, with optional 10-delta wings. Strikes are derived from these pillars plus an interpolation choice. Equity-style tooling in MetaTrader 5 commonly starts from listed strike chains and single-rate Black-Scholes. For FX this misses both market quoting practice and the two-rate setup required for carry. A correct implementation uses Garman-Kohlhagen and treats delta as a convention: spot vs forward delta, and premium-adjusted vs unadjusted. The convention varies by pair, premium currency, and tenor, and can shift 1Y strikes by tens of pips or more without triggering obvious errors. The reconstruction pipeline converts RR/BF to wing vols, then solves each pillar’s delta back to its strike at that vol. Outpu... 👉 Read | Docs | @mql5dev

Open in Telegram
Views9,472−6%vs avg
Forwards7
Reactions28
Comments—
Views growthHide views growth

Views growth

Hours after publication

Show as table
Hours after publicationViews
0 h0
18 h7,225
35 h8,382
53 h9,472
  1. After 24 hours7,225
  2. Total to date9,472
#4233Photo

Probability theory remains a practical dependency for trading systems, from strategy PnL estimates to risk models. Modern ML also inherits classical statistics: neural nets are probabilistic models optimized via maximum likelihood, with predictable strengths and limits. A random variable is a deterministic function X(ω) on an assumed probability space Ω, used because Ω is rarely tractable directly. The working representation is the distribution on R via the CDF F(x)=P(X≤x), which supports interval probabilities by differences F(b)-F(a). Distributions split into discrete (PMF with point masses, stepwise CDF), continuous (PDF as dF/dx, interval probabilities via integrals), and mixed. Degenerate variables map all outcomes to a constant and appear in convergence results like LLN. Practical tooling includes CDF/PDF and QQ comparisons and MQL5 standard library... 👉 Read | Quotes | @mql5dev

Open in Telegram
Views9,287−8%vs avg
Forwards8
Reactions38
Comments—
Views growthHide views growth

Views growth

Hours after publication

Show as table
Hours after publicationViews
0 h0
20 h7,235
37 h8,230
55 h9,287
  1. After 24 hours7,235
  2. Total to date9,287
#4232Photo

ATR-smoothed Heiken Ashi candles are drawn directly on the chart: blue for bullish and red for bearish. Smoothing is ATR-driven: if the new HA close deviates from the prior smoothed close by at least ATR x sensitivity, the candle uses raw HA values; otherwise open/close are blended via a configurable factor to suppress minor colour flips. Trend bias is provided by Fast EMA (default 20) and Slow EMA (default 50). Early-entry arrows trigger only when a smoothed candle flips direction in line with EMA bias and while EMAs remain close, with “close” measured in ATR units to adapt across symbols and timeframes. Signals are skipped once EMAs separate beyond the ATR threshold. Buy arrows print below candles and sell arrows above, offset by an ATR fraction. Optional popup and push alerts fire once per bar per direction. No trade execution, no SL/TP, and the c... 👉 Read | AlgoBook | @mql5dev

Open in Telegram
Views9,513−6%vs avg
Forwards14
Reactions34
Comments—
Views growthHide views growth

Views growth

Hours after publication

Show as table
Hours after publicationViews
0 h0
22 h7,081
39 h8,005
57 h9,513
  1. After 24 hours7,081
  2. Total to date9,513
#4231Photo

MetaTrader 5 ships with MarketProfile, but it does not segment volume by individual swing legs. A swing-based profile can be built from OHLC and platform tick volume to study volume concentration inside each completed high-to-low and low-to-high move. Core logic: confirm swing highs/lows using a configurable window and next-bar validation, then connect confirmed points with a ZigZag leg. For each finished leg, compute the swing range, create ATR(200)/2 adaptive price bins, and allocate each bar’s tick volume to a bin using the close. After aggregation, the highest-volume bin is marked as the POC and the full profile is rendered with chart rectangles scaled by relative volume. Results reflect tick volume, not exchange-level order flow. 👉 Read | AlgoBook | @mql5dev

Open in Telegram
Views9,078−10%vs avg
Forwards10
Reactions35
Comments—
Views growthHide views growth

Views growth

Hours after publication

Show as table
Hours after publicationViews
0 h0
26 h7,311
43 h8,168
61 h9,078
  1. After 24 hours7,311
  2. Total to date9,078
#4230Photo

Double tops/bottoms look obvious in hindsight but are hard to automate because pivots, necklines, and tolerances are often subjective. This article turns the pattern into a deterministic contract suitable for MT5 Strategy Tester. The MQL5 design confirms swing pivots using a fixed left/right bar window, then pairs two same-type pivots only if their prices match within a tolerance scaled by pattern height. The neckline is strictly the opposite pivot between peaks, with spacing, leg-balance, and optional prior-trend filters to reject noisy shapes. A small state machine manages progression from detection to entry: arm the setup, trigger on a close through the neckline or wait for a retest, then invalidate on extreme breach or timeout. Risk rules are explicit: stop beyond the paired extreme with buffer, targets via measured-move or reward-to-risk, opti... 👉 Read | Freelance | @mql5dev

Open in Telegram
Views8,880−12%vs avg
Forwards7
Reactions34
Comments—
Views growthHide views growth

Views growth

Hours after publication

Show as table
Hours after publicationViews
0 h0
28 h7,200
45 h8,050
63 h8,880
  1. After 24 hours7,200
  2. Total to date8,880
#4229Photo

MetaTrader 5 reports blend partial exits into a single result, hiding whether scaling out improved or weakened performance. This article builds a native MQL5 Scale-Out Value Analyzer that reconstructs positions from deal history, detects multi-exit closures, and evaluates scaling against counterfactual full exits using only the trader’s realized exit prices. For each scaled position, it reprices the full volume at the first, last, and best per-lot exit outcome (including profit, commission, and swap). It then measures value added vs holding to the last exit, efficiency vs the best achievable exit, and aggregates results safely via ratio-of-sums. The tool ships as two scripts: an exporter using HistorySelect() to write deal-level CSV, and an analyzer that parses, groups by PositionID, validates volumes, excludes multi-entry positions, runs a single-trade depende... 👉 Read | AlgoBook | @mql5dev

Open in Telegram
Views9,236−9%vs avg
Forwards4
Reactions33
Comments—
Views growthHide views growth

Views growth

Hours after publication

Show as table
Hours after publicationViews
0 h0
30 h7,556
47 h8,379
65 h9,236
  1. After 24 hours7,556
  2. Total to date9,236
#4228Photo

Tree-based feature_importances_ (MDI) answers what the forest split on, not what a feature is worth. As features multiply, correlated indicators become interchangeable, and their “credit” gets diluted across copies, letting weak or even useless columns outrank a real signal with no warning. Permutation importance (MDA) is out-of-sample but can fail harder: if a signal has duplicates, permuting one column leaves substitutes intact, so the measured impact can collapse toward zero. The robust fix is clustered MDA: group dependent features using an unsupervised clustering step on a denoised correlation matrix (Marčenko–Pastur + effective sample size), then permute entire clusters. This recovers the true signal in a synthetic triple-barrier setup and produces a clean separation between informative and noise blocks. Clustered MDI can invert rankings when ... 👉 Read | Quotes | @mql5dev

Open in Telegram
Views11,243+11%vs avg
Forwards5
Reactions26
Comments—
Views growthHide views growth

Views growth

Hours after publication

Show as table
Hours after publicationViews
0 h0
32 h8,252
49 h9,684
67 h11,243
  1. After 24 hours8,252
  2. Total to date11,243
#4227Photo

Dragonfly Algorithm (DA), proposed by Seyedali Mirjalili in 2015, models two swarm modes: static hunting and dynamic migration. These map directly to exploitation and exploration in population-based optimization. Each agent applies five terms per iteration: separation, alignment, cohesion, attraction to the current best (Food), and repulsion from the current worst (Enemy). Velocity is updated as a weighted sum plus inertia, then position is advanced and clamped to bounds. When an agent has insufficient neighbors and Food is out of range, DA switches to Lévy flight using Mantegna sampling to generate heavy-tailed steps. Adaptive control drives convergence: neighborhood radius increases over epochs, inertia drops from 0.9 to 0.4, and s/a/c/e decay to zero mid-run, leaving Food attraction dominant. Population size is the main external parameter. 👉 Read | Signals | @mql5dev

Open in Telegram
Views10,736+6%vs avg
Forwards5
Reactions26
Comments—
Views growthHide views growth

Views growth

Hours after publication

Show as table
Hours after publicationViews
0 h0
34 h8,976
51 h9,755
69 h10,736
  1. Total to date10,736
#4226Photo

SAGDFN targets noisy, redundant market data by keeping only neighbors that measurably influence the system. After implementing Significant Neighbors Sampling in OpenCL, the focus shifts to Sparse Spatial Multi-Head Attention to extract structure from the selected links while staying compute-efficient. A key optimization avoids per-pair embedding concatenation. By splitting the first linear layer into separate query/key projections computed once per node, pair logits become simple vector additions, cutting complexity from O(NMhd) to O(Nhd)+O(NMh) and reducing memory pressure—well-suited to GPU execution in MQL5+OpenCL. For attention normalization, iterative α-Entmax is replaced with Sparse-SoftMax to keep sparsity without expensive τ searches. The OpenCL forward kernel computes head-wise sparse weights with local reductions, NaN/Inf guards, bounds-che... 👉 Read | Calendar | @mql5dev

Open in Telegram
Views11,464+13%vs avg
Forwards4
Reactions27
Comments—
Views growthHide views growth

Views growth

Hours after publication

Show as table
Hours after publicationViews
0 h0
36 h9,874
53 h10,601
71 h11,464
  1. Total to date11,464
#4225Photo

PDF generation in MQL5 can work without DLLs when the format is treated as plain text plus a bottom index. A minimal PDF has five regions: header, numbered objects, xref table, trailer, and %%EOF. Only the object list grows; most of the file is boilerplate. The body is a flat set of indirect objects referenced by “N 0 R”. Pages do not embed content or fonts directly; they reference a content stream and resource objects. PDF values are limited to eight types, with names (/Helvetica) distinct from strings ((Hello)). Streams require an exact /Length byte count. A single page typically needs Catalog, Page Tree, Page, Contents stream, and Font. Correct xref byte offsets and startxref are critical; a one-byte shift breaks the file. Content streams use postfix operators (BT, Tf, Td, Tj, ET). Multi-line layouts rely on relative Td moves and can switch fonts mid-s... 👉 Read | Docs | @mql5dev

Open in Telegram
Views11,999+19%vs avg
Forwards6
Reactions40
Comments—
Views growthHide views growth

Views growth

Hours after publication

Show as table
Hours after publicationViews
0 h0
40 h11,498
57 h11,999
  1. Total to date11,999
#4224Photo

This update finalizes the MT5 replay/simulation system for training by aligning simulated pricing with live-server behavior. A small fix removes hardcoded SYMBOL_DIGITS side effects, and a new config option lets users set per-symbol decimal precision so the position indicator formats prices correctly (e.g., instruments with 0.5 ticks). Database stability is improved by moving table-creation SQL into an external script embedded as a resource and adding constraints to prevent invalid or duplicate records, reducing corruption risks without extra application logic. Take Profit and Stop Loss become functional by adding a close-price check inside the position indicator and firing a custom event to the EA to close positions. The same event-driven pattern can be adapted to simulate pending orders by changing the trigger conditions and emitting the appropri... 👉 Read | Freelance | @mql5dev

Open in Telegram
Views12,493+24%vs avg
Forwards5
Reactions34
Comments—
Views growthHide views growth

Views growth

Hours after publication

Show as table
Hours after publicationViews
0 h0
42 h10,860
59 h12,493
  1. Total to date12,493
#4223Photo

The article shows how MQL5 operator overloading can be used to express data-structure operations with stream-style syntax similar to C++ input/output, improving readability when done with clear intent. A pointer-based queue is rebuilt using overloaded operators, where a small header-only change switches behavior between LIFO (stack) and FIFO without rewriting the calling code. This demonstrates separating policy (order) from usage. The same idea is extended to a linked list: adding a subscript operator enables array-like access, then the implementation is revised so assignments append new nodes instead of overwriting existing values. The final design uses a doubly linked list and avoids traversal by maintaining links during insertion, making updates predictable for trading utilities like event queues and order pipelines. 👉 Read | Quotes | @mql5dev

Open in Telegram
Views11,325+12%vs avg
Forwards5
Reactions31
Comments—
Views growthHide views growth

Views growth

Hours after publication

Show as table
Hours after publicationViews
0 h0
44 h10,752
61 h11,325
  1. Total to date11,325
#4222Photo

Average True Range (ATR) is derived from True Range (TR), defined as max(High-Low, abs(High-Close[1]), abs(Low-Close[1])). Initialization typically computes TR over Length bars, then uses the SMA of those values as the first ATR. RMA uses alpha=1/Length and updates as: rma = alpha*TR + (1-alpha)*prev_rma. SMA mode recalculates the simple average of TR over the last Length bars on each candle. EMA uses alpha=2/(1+Length) with: ema = alpha*TR + (1-alpha)*prev_ema. WMA applies linear weights: sum = N*TR[0] + (N-1)*TR[1] + … + 1*TR[N-1], then wma = sum / (N*(N+1)/2). Common validation setup: XAUUSD on H1, comparing RMA, EMA, SMA, and WMA outputs side by side. 👉 Read | Docs | @mql5dev

Open in Telegram
Views11,089+10%vs avg
Forwards5
Reactions29
Comments—
Views growthHide views growth

Views growth

Hours after publication

Show as table
Hours after publicationViews
0 h0
46 h10,594
63 h11,089
  1. Total to date11,089