MQL5 Algo Trading
574K subscribers
4.44K photos
7 videos
4.44K links
The best publications of the largest community of algotraders.

Subscribe to stay up-to-date with modern technologies and trading programs development.
Download Telegram
A fractal-dimension regime filter can separate trend and range by measuring path efficiency instead of directional strength. The value stays between 1.0 and 2.0: readings near 1.0 indicate clean directional movement, while readings toward 2.0 indicate repeated backtracking with limited net displacement.

The calculation follows a simplified Katz method over InpFractalPeriod bars: sum the absolute bar-to-bar changes (total path length) and compare it to the maximum displacement from the window’s first price, then apply a logarithmic ratio to derive the dimension. An EMA with InpSmoothPeriod reduces noise.

Zone logic uses two thresholds: at or below InpTrendThreshold (default 1.40) is trending, at or above InpChopThreshold (default 1.65) is choppy, with a neutral band between. Typical use is gating entries from a directional tool only when the line is i...

πŸ‘‰ Read | VPS | @mql5dev
❀15πŸ‘15πŸ”₯8🀩7πŸ‘Œ3
BotGuard is a lightweight monitoring Expert Advisor for VPS setups running trading robots. It does not open, close, or modify orders. Its role is terminal health reporting so outages are detected quickly.

Every 30 seconds it rewrites botguard_<login>.json in Terminal\Common\Files with UTC server time, login, server/company, connection and AutoTrading state, ping, balance/equity, margin level, open positions/orders, start-of-day equity, daily P/L %, and terminal build. It writes via temp file swap to avoid partial reads.

Every 5 minutes it appends botguard_<login>_log.csv (time, balance, equity, positions, connected) for equity curves and uptime checks. Push alerts and journal messages trigger on AutoTrading toggles, reconnection, and equity drawdown below a configured threshold.

External watchdogs can monitor file age and restart the terminal if updates stop. C...

πŸ‘‰ Read | Signals | @mql5dev
❀10🀩10πŸ‘9πŸ”₯6πŸ‘Œ2
Prop Firm Equity Guard monitors account equity continuously and enforces common prop firm risk rules. When a threshold is breached it closes all open positions, deletes pending orders, and blocks further trading until the lock condition expires. It does not open trades on a live chart and can run alongside manual execution or other EAs.

Supported limits include daily loss (based on balance, equity, or the higher of both at day start), maximum loss (based on initial balance), and an optional profit target that liquidates exposure once reached. Early warnings can trigger messages and MT5 push notifications at a configurable usage level.

A chart panel shows lock state, equity, daily and maximum loss usage, profit target, and the captured day-start value. State persistence relies on terminal global variables to survive restarts. Controls include reset hour in s...

πŸ‘‰ Read | VPS | @mql5dev
❀25πŸ‘16πŸ”₯9🀩8πŸ’―2πŸ‘Œ1
Session High Low plots the Asia, London, and New York trading sessions as colored boxes from session open to close, covering each session’s high and low. After the close, optional dotted extensions project the high/low levels for a configurable number of hours to track breakouts and retests.

Ranges are derived from M5 data, keeping session highs/lows consistent across M1 through H1. The active session box updates in real time as new extremes print. Tooltips provide high, low, and range in points, with labels for session name and prices; the New York label is positioned to avoid overlap with London.

Configuration includes per-session enable switches, start/end times, and colors, plus days to draw, maximum timeframe visibility, label toggle, and extension duration. Sessions crossing midnight are handled automatically, and weekends/holidays are skipped....

πŸ‘‰ Read | Forum | @mql5dev
❀22πŸ”₯11πŸ‘10🀩9πŸ‘Œ3
DailyPnLPct.mq5 adds an on-chart overlay that tracks today’s floating P&L as a percentage of a baseline balance and expresses daily-loss consumption in terms aligned with common prop firm rules.

The reset point is configurable via InpResetHour (server time). At each update, the script derives a reset timestamp, stores base_balance from ACCOUNT_BALANCE, then compares live ACCOUNT_EQUITY against that baseline to compute pnl_pct and β€œdaily loss used”.

A single OBJ_LABEL is maintained and refreshed on OnCalculate plus a 30-second timer. Status is color-coded based on consumption thresholds: under 50% of the limit, under 80%, or above. The text line reports Day P&L, loss used versus InpLimitPct, and remaining room before breach.

πŸ‘‰ Read | Quotes | @mql5dev
πŸ‘17πŸ”₯11❀9🀩5πŸ‘Œ3
ApexVelocity EA v1.0 targets volatility breakouts on XAUUSD with a fully dynamic parameter model rather than fixed point-based tuning. Execution logic is positioned as non-grid and non-martingale, built around price action, ATR-based volatility measures, and capital protection controls.

Broker-agnostic handling is implemented via ATR multipliers for buffers, break-even padding, trailing stops, and slippage tolerance, maintaining consistent behavior across 2/3-digit pricing. Risk sizing uses a TickSize/TickValue ratio approach to keep percentage risk aligned to account currency exposure.

Order management validates exits against SYMBOL_TRADE_STOPS_LEVEL to avoid invalid stop modifications during fast moves. Signal gating includes tick-volume acceleration, minimum ATR range, body-to-range quality filters, H1 MA-50 alignment, and session time windows. A peak-equi...

πŸ‘‰ Read | Docs | @mql5dev
πŸ‘17❀16πŸ”₯10🀩6
An Expert Advisor implements an opening-range breakout variant for 24-hour markets, tuned by default for XAUUSD. The chart timeframe is irrelevant; logic reads M1 and D1 directly, with M1 mainly useful for visual testing.

At the configured session start (08:00 London by default, mapped to server time with DST handling), the open is captured and entry levels are set using either a β€œstretch” metric from recent sessions or a multiple of daily ATR. If yesterday’s candle passes the selected contraction filter, buy-stop and sell-stop orders are placed around the open with opposite-side stops, OCO behavior, and timed order cancellation.

Filters include NR4, NR7, inside day + NR4, 3-bar narrowest range, combined modes, plus optional skip-after wide-range days.

Risk and execution controls cover % risk sizing, daily loss limits, max fills, spread/offset constraints, b...

πŸ‘‰ Read | AppStore | @mql5dev
❀16πŸ‘11πŸ”₯10🀩10πŸ‘Œ1
The article argues that profitable algorithmic trading starts with a measurable edge, not indicator stacking and optimizer-driven curve fitting. It proposes a scientific workflow: detect a price pattern, validate it across symbols and scales, then quantify expected payoff after real trading costs.

Using block charts (price quantized into fixed-point moves), the author finds a consistent tendency: after moving N points, price is slightly more likely to continue than reverse. This β€œtrend bias” appears across FX, stocks, crypto, and commodities, but weakens at larger scales.

Key implementation risks are highlighted for MT5 robots: signals arrive only on 1‑minute closes, creating entry/exit slippage versus the block close, and spreads/commissions can erase the edge. The suggested fix is to measure continuation probability, slippage distribution, and av...

πŸ‘‰ Read | Calendar | @mql5dev
❀18πŸ‘13🀩10πŸ”₯7πŸ‘Œ1
Manual Trade Pad for MT4 is a chart-based trading panel packaged as an Expert Advisor, focused on manual execution and position management from the chart. It consolidates order entry, sizing, SL/TP setup, and trade management without relying on terminal order dialogs, and supports both live trading and visual historical testing with the same workflow.

Order entry is limited to market BUY/SELL, with Stop Loss defined in points and Take Profit optionally derived from a Risk/Reward ratio. Position sizing supports fixed lots or risk-percentage sizing, with volume normalized to broker min/max and lot-step constraints.

Trade management includes break-even moves with an optional offset, partial close with volume constraints, and bulk closing by direction or all managed trades. Trade ownership is scoped by symbol and Magic Number to avoid interfering with other EAs...

πŸ‘‰ Read | Signals | @mql5dev
❀27πŸ‘7πŸ”₯7🀩3🀯2πŸ‘¨β€πŸ’»2πŸ‘Œ1
A combined momentum signal can be derived by tracking the slope direction of MACD, OsMA, AC, AO, and RVI at the same time.

When all five slopes are rising together, it indicates broad alignment across trend and momentum components, with reduced risk of acting on a single-indicator spike. When all five slopes are falling together, it suggests synchronized weakening across the same set.

Implementation typically requires consistent slope measurement per bar (e.g., current minus prior value), a shared lookback and timeframe, and strict handling of flat/near-zero changes to avoid noise. Confirmation rules should define whether β€œsame time” means the current closed bar only or a multi-bar window.

πŸ‘‰ Read | Calendar | @mql5dev
❀15πŸ‘10🀩8πŸ”₯4✍3πŸ‘Œ1
A trend-following trading system can be built around ATR as a volatility-normalized control layer for entries, position sizing, and exits.

Signals typically combine a directional filter (moving average slope, breakout of recent highs/lows, or channel rules) with an ATR-based threshold to avoid noise. Stops can be set at NΓ—ATR from entry and trailed using the same multiple, keeping risk proportional across regimes. Position size is commonly derived from account risk per trade divided by ATR distance to the stop.

Key implementation details include using consistent bar indexing, handling gaps, and separating signal generation from execution logic. Validation should cover walk-forward testing, transaction costs, and sensitivity to ATR period and multiplier.

πŸ‘‰ Read | NeuroBook | @mql5dev
❀18πŸ‘14πŸ”₯10🀩6πŸ‘Œ2🀝1
A good trading system starts with a clearly defined edge, expressed as explicit entry and exit rules that can be executed without interpretation. Signals should be based on measurable conditions, with fixed handling for gaps, slippage, and spread to avoid distorted backtests.

Risk management is mandatory: position sizing, maximum loss per trade, daily and weekly drawdown limits, and rules for stopping after regime changes. Performance evaluation should include out-of-sample testing, forward testing, and robustness checks across instruments and timeframes.

Execution details matter. Order types, latency sensitivity, and broker constraints should be accounted for. Ongoing monitoring should focus on degradation of expectancy, variance shifts, and adherence to the plan, with changes controlled through versioned updates and repeatable validation.

πŸ‘‰ Read | VPS | @mql5dev
πŸ‘15❀9πŸ”₯6πŸ‘¨β€πŸ’»5🀝4πŸŽ‰1πŸ‘Œ1
Gold Fractal Breakout EA for MT5 uses confirmed swing highs/lows to stage Buy Stop and Sell Stop entries. Swing detection is implemented via strict neighbor-bar comparisons, not the built-in fractals indicator. Ownership is filtered by symbol plus magic number, with exits managed through percentage-based rules.

Signal data is always read from H1 via an internal constant, regardless of the chart or tester timeframe. Scans are throttled (default 15 minutes, tick-driven), while position management runs on every tick. Default entry offsets are negative, placing buy entries below swing highs and sell entries above swing lows, but orders still must satisfy stop-order validity and broker stop-distance rules.

Key constraints: pending β€œexpiry hours” is calculated but orders are submitted as GTC, so time-based expiration is not implemented. Any open position on the s...

πŸ‘‰ Read | VPS | @mql5dev
❀30πŸ”₯8πŸ‘7🀩4πŸ‘€1
MQL4TradeCompat is a compatibility framework that recreates the classic MQL4 order-centric trading model on top of the native MQL5 execution architecture. It keeps legacy code working with familiar MQL4-style functions while translating operations into Position, Order, Deal, and History APIs.

The facade CMQL4TradeCompat exposes an MQL4-compatible interface and dispatches requests to native trade calls. CLiveTradeInfo acts as a live trade repository, aggregating positions and pending orders into a single collection with MQL4-style indexing, ticket selection, snapshot caching, and chronological ordering. CHistoryTradeInfo reconstructs historical trades from deal chains, including closed-trade aggregation, pending-order history, and profit, commission, swap, and weighted close-price calculations.

Core mapping routes OrderSelect through live/history repositorie...

πŸ‘‰ Read | Quotes | @mql5dev
❀16πŸ‘9πŸ”₯7🀩4πŸ‘Œ1
GDS Renko Trade Manager is an MT5 Expert Advisor focused on stop-loss management for positions opened manually. It builds a fixed-size Renko stream per symbol from broker Bid ticks and advances logic only on completed bricks. No entries are generated, no pending orders are placed, and positions are not closed by this release. Existing TP values remain unchanged when SL is modified.

Core functions include break-even after N favorable completed bricks (optional offset) and Renko-based trailing after M bricks at a configurable gap, without intentional stop loosening. Positions can be filtered by verified manual origin or by exact positive Magic Number. A dashboard tracks BUY/SELL tickets, broker SL, thresholds, and brick progress, with an inset of recent completed bricks.

Operational controls include monitor-only mode by default, single-instance locking per accou...

πŸ‘‰ Read | AlgoBook | @mql5dev
❀14πŸ‘10πŸ”₯8🀩3πŸ‘Œ2
Standalone drawdowns and correlation matrices cannot identify which configuration is responsible for a portfolio’s maximum drawdown. This script computes attribution from daily results and prints a full report in the Experts tab.

Key metrics include drawdown added via leave-one-out, the configuration’s share of the portfolio’s worst peak-to-trough window, and an Euler variance share Cov(x_i,P)/Var(P) shown alongside net profit share. A composite A+ to F score evaluates drawdown compression, risk spread, drag-free share, and return-to-drawdown, then issues KEEP, REDUCE, or REMOVE with recommendations.

Data sources are selectable: a reproducible demo portfolio (12 configs, 520 days), live account deals grouped by magic number (optionally symbol), or CSV input (Date,Config,Profit) with automatic separator and flexible number parsing.

Tuning inputs cover m...

πŸ‘‰ Read | CodeBase | @mql5dev
❀11πŸ‘7🀩7πŸ”₯4πŸ‘Œ2
Randomness can be treated as a testable null hypothesis, not a default assumption. Typical targets include PRNG output and discretized market returns, where the goal is to detect deviations from IID uniform behavior.

A practical approach uses a chi-square test over overlapping s-chains. Counts are collected for (s+1)-tuples across an alphabet of size N, then observed transition frequencies are compared to conditional expectations vi_/N. Under H0, the statistic converges to chi-square with N^s*(N-1) degrees of freedom and is consistent against homogeneous ergodic Markov alternatives of order s.

For market data, a quantile transform helps remove drift by enforcing near-uniform state frequencies, isolating transition structure. On ~1,000 daily EURUSD observations (to 2026-04-03), results were: s=1 p=0.98, s=2 p=0.41, s=3 p=0.02, indicating dependence...

πŸ‘‰ Read | NeuroBook | @mql5dev
πŸ‘12❀10πŸ”₯5🀩4πŸ‘Œ1
S3CE-Net reframes market data as an event stream: irregular tick-level impulses in price, volume, and liquidity that often precede visible trends. Instead of waiting for candlestick patterns, it targets early precursors using spike-guided attention.

The architecture combines SSAM to prioritize meaningful micro-events and suppress noise, with STFS to preserve broader context by sampling across time and the feature axis. For market vectors, β€œspatial” sampling is redefined as random feature subset selection based on functional relationships, not index proximity.

The implementation in MQL5 uses OpenCL kernels to generate five parallel views (global, temporal, feature, plus two alternatives) and produces separate forecasts per view to avoid averaging away weak but actionable signals. Training stability comes from triplet loss and label-smoothed cross-entropy, improvin...

πŸ‘‰ Read | Forum | @mql5dev
πŸ‘9❀6πŸ”₯4⚑2🀩2πŸ‘Œ1
Part 18 extends the multi-symbol architecture with a shared indicator cache to remove duplicated handle management across strategy nodes.

Multi-symbol EAs often recreate identical MA/ATR indicators per module, repeating BarsCalculated(), Refresh(), buffer reads, error handling, and release paths. When requests match on type, symbol, timeframe, and inputs, this causes duplicate work and unclear ownership during partial init and shutdown.

The cache centralizes creation, readiness gating, data access, and lifetime. Consumers request MA or ATR via a full-parameter identity key; hits reuse an existing entry, misses create a new Standard Library CiMA/CiATR object. Each entry tracks references and request counts, and Release(entry&) applies reference counting with final FullRelease() on last consumer.

Strategy nodes keep independent signal and position state, bu...

πŸ‘‰ Read | VPS | @mql5dev
❀7πŸ‘6πŸ”₯3🀩3πŸ‘Œ1😈1
Hermes Agent proposes a tighter alternative to RDP for MQL5 maintenance: a private Telegram bot triggers only explicitly enabled MetaTrader 5 MCP operations on the Windows machine where MT5 is installed (build 6060+).

Requests flow from Telegram to a gateway that validates user IDs, then Hermes maps the message into MCP tool parameters, executes the call in the local terminal, and returns structured output. Terminal logs, compiler diagnostics, and Strategy Tester results remain the source of truth.

The setup emphasizes reproducibility and control: pin the Hermes revision, record versions, keep MT5 running, and start with read-only tools for market data or account history before enabling MetaEditor compile or Strategy Tester jobs. Trading tools stay disabled, and a per-server confirmation gate can require approval for non-read-only actions.

πŸ‘‰ Read | AlgoBook | @mql5dev
πŸ‘13❀7πŸ”₯5πŸ‘Œ1πŸ‘¨β€πŸ’»1
ATR Monitor adds a compact panel that compares the current Day, Week, and Month ranges against each timeframe’s built-in ATR. It also reports whether price is currently above or below each period’s open. The three rows are shown on any chart timeframe.

Columns include ATR (pips), Range (high minus low, pips), ATR% (Range/ATR*100), and From open (current minus open, pips). ATR% uses the full high–low range, while From open is a separate direction readout with positive/negative coloring and neutral near zero. Readings at or above MaxATRPercent are highlighted; the default threshold is 100% and does not cap the displayed value.

ATR is calculated on the current forming candle (shift 0) for each timeframe and updates on ticks, so it changes during the period. Period boundaries follow broker candles. Range and ATR differ because ATR uses true range and can incl...

πŸ‘‰ Read | Freelance | @mql5dev
❀5πŸ‘4πŸ”₯4πŸ‘Œ1