MQL5 Algo Trading
490K subscribers
3.11K photos
3.11K 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
Momentum deviation can be applied to build deviation bands around a momentum series, forming an indicator conceptually comparable to Bollinger Bands but based on momentum statistics rather than price volatility.

The bands are derived from momentum with a deviation measure that expands and contracts as momentum dispersion changes. This makes the envelope responsive to shifts in acceleration and deceleration.

Operationally, it can be used in a similar manner to Bollinger Bands: monitoring momentum moves toward or beyond the outer bands for potential mean-reversion setups, and watching sustained runs near a band as a sign of persistent directional pressure.

πŸ‘‰ Read | Quotes | @mql5dev

#MQL5 #MT5 #Indicator
❀36πŸ‘3⚑2πŸ‘Œ2
MQL5 forum traffic highlights recurring issues among newer developers: inconsistent implementation, high bug rates, and unstable expectations about β€œcorrect” patterns.

Key habits to drop: fixating on past releases and reviews, seeking constant validation instead of testing and debugging, and assuming others must code the same way.

Progress tends to improve when developers shift from only consuming code to contributing fixes and answers, and when they share minimal reproducible examples rather than withholding context. Open collaboration and selective openness can shorten debug cycles and raise code quality.

πŸ‘‰ Read | Forum | @mql5dev

#MQL5 #MT5 #EA
❀76✍6πŸ‘Œ1
Larry Williams Outside Bar EA with an ONNX-based AI filter combines deterministic candle rules with probabilistic validation.

Startup requires the model file in MQL5/Files. Expected filename is larry_model.onnx (or the configured input). If the file is missing, initialization stops with INIT_FAILED.

Key inputs include Magic number, lot size, Risk/Reward ratio for TP vs SL distance, model filename, AI threshold (0.0–1.0), and ATR period used in feature generation.

On each new bar, an Outside Bar is detected when the current High exceeds the previous High and the current Low is below the previous Low. Signals trigger on close above the prior High for long, or close below the prior Low for short.

If triggered, 10 features are computed and sent to the ONNX model. Orders are placed only when Buy or Sell class probability exceeds the threshold. SL is set to th...

πŸ‘‰ Read | Docs | @mql5dev

#MQL5 #MT5 #EA
❀50πŸ‘8✍2
Trend-following labels are built from smoothed price direction rather than deviation: a Savitzky–Golay filter reduces noise, the gradient defines trend sign, and the signal is normalized by rolling volatility with a threshold to ignore weak moves.

Several labelers extend this baseline: β€œprofit-only” sampling keeps trades only if a random future horizon meets a net-profit requirement after spread/fees, and smoothing can be swapped (Savitzky–Golay, SMA, EMA, spline) or combined across multiple periods to confirm direction without conflicting signals.

Training uses two models: one predicts buy/sell, the other predicts tradable regimes. β€œNo-trade” labels are routed into the regime model instead of being dropped, preserving information and filtering bad entry points. Results show trend models generalize poorly on EURUSD; complexity reduction and tight sto...

πŸ‘‰ Read | Forum | @mql5dev

#MQL5 #MT5 #AITrading
❀38πŸ‘2πŸ‘Œ1
Larry Williams’ Trade Day of the Week idea treats time as a measurable market condition: identical setups can have different odds depending on the weekday. The article tests this by isolating time as the only variable and comparing win rates per day.

A minimal MT5 research EA is built around a daily volatility breakout: compute yesterday’s range, project a buy level from today’s open, enter only on a clean 1‑minute crossover, and close at the next day’s open. No SL/TP or trade management to avoid masking weekday effects.

Implementation focuses on repeatability: new-day detection, a struct for range/level, safe position checks via magic number, and a switchable mode for baseline (all days) vs user-selected weekday filtering for controlled A/B testing.

πŸ‘‰ Read | Calendar | @mql5dev

#MQL5 #MT5 #EA
❀39πŸ‘Œ2
This article extends the Candle Pressure Index (CPI) into a session-aware framework: prior session highs/lows act as durable reference boundaries, and CPI helps decide whether a revisit is genuine acceptance (sustained closes beyond the level with aligned pressure) or rejection (a probe beyond the level that closes back inside with a pressure flip).

The MQL5 implementation builds Tokyo/London/New York windows in broker time, handles midnight-crossing sessions, and evaluates only closed candles for deterministic behavior in both live charts and historical reconstruction. Session ranges are computed by datetime filtering, with on-demand scans to prevent the evaluation candles from contaminating the level being tested.

Signals use a two-candle model: breakout acceptance requires a CPI-validated close beyond the boundary plus a retest/hold; rejection req...

πŸ‘‰ Read | Docs | @mql5dev

#MQL5 #MT5 #Indicator
❀34πŸ”₯3πŸ‘Œ3✍1πŸ‘€1
Part 3 completes the core CRiskManagement class for MetaTrader 5, moving from UI to a modular engine in Risk_Management.mqh that tracks losses/profits and enforces limits.

The design centers on clear enums and a Loss_Profit structure supporting fixed-money or percentage-based limits, with selectable reference metrics (balance, equity, free margin, net profit). It models daily/weekly/total loss caps, per-trade risk, and daily profit targets, plus prop-firm rules where daily loss is evaluated dynamically against equity and can expand with intraday gains (FTMO-style).

Implementation details include a CTrade wrapper, magic-number scoping, profit time windows, and lifecycle-safe constructor/destructor. Initialization and setters configure stop loss, calculation modes, and percentage application, enabling lot sizing from per-trade risk and optionally stop-...

πŸ‘‰ Read | Signals | @mql5dev

#MQL5 #MT5 #RiskMgmt
❀30πŸ‘7πŸ‘Œ1
Part 13 replaces native chart objects with a CCanvas-based price dashboard in MQL5, combining a live mini-graph and an optional stats panel in compact, movable UI blocks.

The design focuses on interaction: mouse-driven dragging, edge/grip resizing with hover feedback, minimize/maximize controls, and dark/light theme switching. Panels redraw on new bars to keep price and account metrics current.

Implementation highlights include separate canvases for header/graph/stats, resource-backed bitmap backgrounds with opacity blending, and smooth bicubic image scaling. The graph plots recent closes with a filled line view and time labels, while the stats panel surfaces balance/equity and current bar OHLC for fast decision support.

πŸ‘‰ Read | CodeBase | @mql5dev

#MQL5 #MT5 #Indicator
❀42😁1
Multi-Mode Logarithmic Transform Indicator provides four calculation modes for price analysis using logarithmic transformations. It shifts the focus from absolute price levels to relative, percentage-based movement, improving comparability across assets with very different price scales and growth profiles.

Log Scale (Absolute) applies the natural log to the close, helping normalize exponential growth and reduce compression of older data on long histories. Trend structure reflects constant percentage change rather than constant currency increments.

Log Scale (Cumulative) builds a running sum of log returns to produce a growth curve starting from a common baseline. This supports ROI-style comparisons between instruments over the same window.

Log Returns (Difference) measures bar-to-bar momentum via the log close change. Log Volatility (Deviation) uses...

πŸ‘‰ Read | Docs | @mql5dev

#MQL5 #MT5 #Indicator
❀42πŸ‘8πŸ€”1
Transformers replace step-by-step recurrence with self-attention, enabling parallel training and better handling of long-range dependencies than classic RNN/LSTM pipelines. For market forecasting, the focus is the Temporal Fusion Transformer: a hybrid that combines LSTM sequence modeling with attention for multi-horizon, interpretable predictions.

The workflow pulls OHLCV data from MetaTrader 5, engineers time, trend, momentum, and volatility features, then builds a PyTorch Forecasting TimeSeriesDataSet with a strict time_idx and returns as the target. Training uses PyTorch Lightning with learning-rate search and validation against a naive β€œlast value” baseline.

Deployment wraps feature generation, training, and inference into a bot that retrains on schedule and trades from fresh predictions. Key trade-offs: GPU-friendly but compute-heavy, data-hungry, and ...

πŸ‘‰ Read | Forum | @mql5dev

#MQL5 #MT5 #AI
❀38πŸ‘2πŸ‘Œ2
Wizard-generated multi-signal EAs can look correct in live execution but fail in the Strategy Tester due to structural issues: excessive signal voting, no market-regime awareness, and no limits on how often trades can be triggered.

The MetaQuotes signal modules are technically solid; the weakness is deployment. Fibonacci, MA, AC, and RSI each fit different conditions, yet the default design lets them vote continuously with equal weights, encouraging redundant confirmations and noisy flips between long/short.

Optimization here goes beyond parameter sweeps. Add governance layers without modifying library code: session/time filters, cooldowns, regime classification, conditional signal participation, and adaptive weighting. Then validate iteratively in the Tester with out-of-sample checks to reduce drawdown and overtrading without curve fitting.

πŸ‘‰ Read | Freelance | @mql5dev

#MQL5 #MT5 #EA
❀44πŸ‘3πŸŽ‰3πŸ‘Œ3πŸ†2
Part 6 extends an MQL5 RSI indicator into a configurable engine with multiple calculation variants and multi-timeframe alignment.

Supported RSI modes include classic plus Cuttler, Ehlers, Harris, quick, gradual, and RSX-style options. Inputs can be derived from close/open/high/low, composites, or internally smoothed OHLC. Pre-smoothing provides basic, growth-based, evened-out, and linear weighted averaging.

Visualization adds hue changes driven by direction, center, or boundary events. Boundaries can be static or dynamic using recent extremes. Multi-timeframe processing uses iCustom handles, buffer copying, and optional linear interpolation to align values across periods.

πŸ‘‰ Read | CodeBase | @mql5dev

#MQL5 #MT5 #Indicator
❀57⚑6πŸ‘€5πŸ‘Œ2
RiskSizer Panel Lite for MT5 is a compact chart panel focused on fixed-percentage risk sizing and fast manual execution. Lot size is estimated from a chosen Risk% of account balance, using two draggable horizontal chart lines (LOW/HIGH) as the SL/TP zone, with one-click BUY/SELL support.

For BUY: entry uses Ask, SL is LOW, TP is HIGH when HIGH is above Ask. For SELL: entry uses Bid, SL is HIGH, TP is LOW when LOW is below Bid. The panel shows spread, risk amount in account currency, calculated lots for both directions, and current line prices.

Controls include editable Risk% with configurable step buttons, a reset to restore default SL/TP distances, and an optional max-spread filter. Parameters cover risk step, default SL/TP points, max spread, deviation, magic number, and UI refresh rate. Lot sizing is approximate and balance-based; demo testing is recomme...

πŸ‘‰ Read | VPS | @mql5dev

#MQL5 #MT5 #EA
❀42⚑2πŸ‘Œ2
β€œHead or Tail” is a high-risk short-term trading approach used on stocks and FX, built on random direction selection instead of market analysis. The decision is binary: buy or sell, with exits defined by time, take profit, or stop loss.

Operational flow is minimal: select an instrument, generate a random decision, open a position, then close by preset conditions. Risk management and position sizing logic are typically absent, making drawdowns structurally likely over time.

A common implementation checks that no positions are open (b + s = 0), then uses MathRand() % 2 to choose direction. Even values trigger a long order, odd values a short order, followed by an early return to stop further processing.

πŸ‘‰ Read | Quotes | @mql5dev

#MQL5 #MT5 #AlgoTrading
❀24🀣6πŸ‘3πŸ†3πŸ‘Œ1
This article turns Larry Williams-style price behavior into a testable MQL5 framework instead of a fixed β€œone-size” scalper. The EA waits for market structure first (3-bar swing high/low with inside/outside-bar exclusions), then requires volatility expansion to trigger a breakout entryβ€”no late fills.

Two volatility engines are supported: prior-bar range or a swing-distance comparison that picks the dominant recent move. Entry levels are projected from the current open; stops can be range-based or anchored to the swing extreme. Exits are modular: first profitable moment, time-based bar count, or risk-to-reward targets.

For research, the EA adds optional day/time filters, one-position-only enforcement, and risk-based position sizing driven by stop distance. Execution monitors intraday breakouts via 1-minute close cross logic, recalculating levels once per new...

πŸ‘‰ Read | Freelance | @mql5dev

#MQL5 #MT5 #EA
❀33πŸ‘Œ2
Part 14 extends an MQL5 canvas-based dashboard with a scrollable text panel that avoids native object limits by rendering text at pixel level. The result is clipped, antialiased typography with a web-like scroll experience inside a CCanvas surface.

Scrolling is handled by a custom rounded scrollbar that expands on hover, includes up/down buttons, a draggable slider, and mouse-wheel support confined to the text area to prevent chart zoom conflicts. The panel respects theme toggles, background opacity, resizing, and minimization via shared event handling.

The implementation adds text wrapping based on measured font widths, line classification for headings/links/emails to apply colors, and reusable drawing utilities like rounded rectangles and color adjustment, improving both readability and UI consistency for traders and MT5 developers.

πŸ‘‰ Read | Calendar | @mql5dev

#MQL5 #MT5 #Indicator
❀32πŸ‘Œ2πŸ‘1
In MetaTrader 5 build 5570, we have improved ONNX support in MQL5:

β€’ Models now run significantly faster on graphics cards with CUDA support.
β€’ New flags have been added for GPU management and logging.
β€’ The library workflow has been revised β€” it is now installed only on the first launch of a program using ONNX, rather than with the platform.

In addition, we have refined the rendering of text and analytical objects on charts using the Blend2D engine introduced in the previous update. We have also improved trading reports and made the strategy tester more resilient.

The web version of the platform has received several improvements as well. When adjusting stop levels directly on a chart, you can now see an approximate profit or loss value in monetary terms. We have also fixed the display of certain trading data.

Read more...
❀70πŸ‘14πŸ†4πŸ’”2
Traditional SuperTrend variants tend to lag and generate whipsaws due to fixed ATR multipliers. SuperTrend Quant Pro Elite addresses this with Z-Score normalization, adjusting sensitivity to current volatility by widening during spikes and tightening during stable conditions.

An adaptive volatility engine recalculates the ATR multiplier in real time. Volume confluence based on tick-volume VSA confirms signals only when activity exceeds institutional averages. Regime detection classifies markets as Trending (solid line) or Choppy (dotted line) using ADX logic.

A built-in multi-timeframe dashboard reports trend state across M15, M30, H1, H4, and D1. On-chart metrics include edge probability and profit factor from the active timeframe’s history.

Signal map: green line/arrow bullish, red bearish, star marks aligned volume and trend strength, dotted line...

πŸ‘‰ Read | AlgoBook | @mql5dev

#MQL5 #MT5 #Indicator
❀42⚑3
Basic Risk Calculator targets a recurring issue in discretionary trading: consistent position sizing. An on-chart panel computes trade volume from account balance, risk percentage, and stop-loss distance, returning both lot size and risk amount in account currency.

The utility supports multiple asset classes via symbol-specific tick value handling, auto-detects balance, and rounds volume to broker lot steps. It enforces minimum and maximum volume limits to reduce order rejections, and uses event-driven updates designed to avoid platform slowdowns.

A Pro Risk Manager variant adds pending-order price entry, periodic auto-refresh, 1/2/3% presets, take-profit and risk:reward output, bidirectional price/pip conversion, tick-synced pricing, dedicated SL price input, and mode-aware field locking for error reduction.

πŸ‘‰ Read | AlgoBook | @mql5dev

#MQL5 #MT5 #EA
❀33
TrendMomentumEA is an MT5 Expert Advisor built around trend and momentum filters using EMA50/EMA200, RSI, and Stochastic. Trade logic is evaluated on the last closed candle to reduce false signals from intra-candle noise.

Directional bias is restricted to price above both EMA50 and EMA200 for longs and below both for shorts. Entries require RSI alignment plus Stochastic %K/%D crossover confirmation. A session filter limits activity to London and New York windows based on broker server time.

Execution includes single-position control per symbol and Magic Number, with configurable lot size, stop loss, and take profit. Typical use cases include major FX pairs, indices, and commodities on M15 or H1. Demo validation and server-time verification remain mandatory; behavior is trend/swing oriented rather than scalping.

πŸ‘‰ Read | AlgoBook | @mql5dev

#MQL5 #MT5 #EA
❀40⚑3
An MQL5 analytical EA automates market-state reading using only closed-candle price action, reducing the manual workload across timeframes. It treats states as descriptive context, not signals: Compression (tight, overlapping ranges), Transition (loosening structure), and Expansion (wide, volatile movement). Trend is assessed separately via swing structure and close bias.

Implementation is modular: closed-candle gating (bar 1 timestamp) ensures non-repainting and runs once per bar for stable performance. Core features include relative range comparisons, CLV for close strength and directional bias, and swing-high/low scoring.

A hierarchical classifier resolves overlaps (Expansion, then Compression, then Trend, else Transition) and optional chart overlays visualize swings, compression zones, and state history without affecting logic.

πŸ‘‰ Read | Docs | @mql5dev

#MQL5 #MT5 #AlgoTrading
❀35πŸ†3😎2