MQL5 Algo Trading
489K subscribers
3.1K photos
3.1K 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
The article presents β€œcompression readiness,” a non-repainting MT5 indicator that turns discretionary price-action compression reading into closed-bar rules. It targets the key problem: separating meaningful absorption ranges from low-information sideways drift.

Detection compares a recent window to a prior one, scoring range contraction, candle overlap, boundary tests, and wick rejections. Robustness comes from optional wick-trimmed boxes, close-out invalidation when a bar closes outside the range, and a dead-drift filter to reject ultra-quiet markets.

Compression is graded (none/early/building/mature) via transparent thresholds. Directional bias is estimated without indicators, using CLV and rejection asymmetry, with optional smoothing and state-change visuals for practical chart context.

πŸ‘‰ Read | VPS | @mql5dev

#MQL5 #MT5 #Indicator
❀33πŸ†6πŸ‘Œ3
An MQL5 Expert Advisor can model liquidity zones using a minimal two-candle structure: a β€œbase” candle representing compression and an β€œimpulse” candle representing expansion, with evaluation restricted to closed candles for non-repainting behavior.

Execution logic typically relies on candle high-low range comparisons (not indicators), a configurable impulse-to-base ratio, and directional alignment to bias continuation setups.

Automation details include CTrade-based order handling, spread checks, magic number tagging, and one-bar-one-execution timing. Entries can be split into multiple limit orders across the base candle range, with stop-loss buffered beyond the zone and targets anchored to the impulse extreme.

Testing in MT5 Strategy Tester should first validate mechanical correctness: order placement, fills, stop/target behavior, and pending expiry when ...

πŸ‘‰ Read | VPS | @mql5dev

#MQL5 #MT5 #EA
❀59πŸ‘Œ8πŸ€”1
A standard deviation variant based on price momentum rather than raw price. The calculation is optimized for minimal CPU load while keeping output values broadly comparable to conventional standard deviation.

Like standard deviation, it can be applied to measure deviation for different input series, not only price. This makes it suitable for custom data streams such as indicator buffers or derived signals.

In side-by-side comparison, the upper plot represents the momentum-based deviation, while the lower plot shows the classic standard deviation. Usage guidance remains the same as for standard deviation indicators across volatility filtering, normalization, and regime detection.

πŸ‘‰ Read | Freelance | @mql5dev

#MQL5 #MT5 #Indicator
❀27πŸ‘Œ3
AdaptiveQ Enhanced is an MQL5 Expert Advisor built around DQN reinforcement learning, game theory, and causal analysis for FX trading under uncertainty.

Market state is modeled as 531,441 discrete states across seven major currency pairs, with inter-symbol dependency handled via Nash-equilibrium action selection. Correlations are applied only when |corr| > 0.3 to reduce noise.

The action space expands to six actions: buy, sell, add-to-buy, add-to-sell, close-profitable-buys, close-profitable-sells. Inputs include multi-timeframe signals (M15/H1/H4), MA deltas/flags, RSI, Stochastic, and momentum, mapped into a single state index.

Implementation focuses on performance: cached prices, correlations, indicator values, persistent indicator handles, and periodic refresh. Learning adds an opportunity-cost term plus cross-learning between correlated pair...

πŸ‘‰ Read | NeuroBook | @mql5dev

#MQL5 #MT5 #AlgoTrading
❀24πŸ‘Œ3
This workshop rebuilds the Supertrend indicator in MQL5 with a focus on correctness and live-trading safety. It targets a common pain point: many retail Supertrend versions repaint, flip inconsistently, or hide the logic, making them unreliable for EAs.

Supertrend is treated as a volatility-driven state machine: ATR defines dynamic trailing bands, and a single bullish/bearish state is determined by closes relative to the band. The implementation leverages MT5’s built-in iATR via an indicator handle, then layers clear trend logic and plotting on top.

The design emphasizes practical usability: one line that flips sides, consistent candle recoloring for fast trend recognition, user inputs for ATR period/multiplier, documented buffers for automation, and proper handle lifecycle management to keep the indicator stable and extensible.

πŸ‘‰ Read | NeuroBook | @mql5dev

#MQL5 #MT5 #Indicator
❀46✍4πŸ‘Œ4🀣2πŸ†2πŸ‘€2⚑1
MQL5 Community OAuth can be configured from the Apps section and used as an identity provider for external software, including Android clients. OAuth 2.0 is implemented with standard authorization-code flow and endpoints for login, token exchange, and user_info.

Compared with generic social auth, the returned profile can include trading-focused signals such as rank, reputation, products, and forum activity. This is useful for apps that need domain-specific user context and basic trust signals.

Mobile clients should only initiate authorization and receive the code via a redirect URI or deep link. Token exchange requires a server component because the client secret must not ship in the APK. Some free PHP hosts block outbound POST, which breaks token exchange even when redirects work.

πŸ‘‰ Read | Calendar | @mql5dev

#MQL5 #MT5 #AlgoTrading
❀70πŸ‘4⚑3πŸ‘Œ3✍1πŸ‘€1
An indicator is available to chart the spread between two instruments as either a difference or a ratio.

Configuration includes Instrument1 and Instrument2, which must match the broker’s symbol strings exactly. Multiplier1 and Multiplier2 apply scaling factors to each instrument to normalize contract sizes or pricing units.

The ChartDifernce boolean selects the output mode. When enabled, the indicator plots the difference between the two instruments. When disabled, it plots the ratio.

The spread series is rendered in a separate subwindow. Once plotted, standard technical indicators can be applied to the spread line for additional analysis.

πŸ‘‰ Read | Forum | @mql5dev

#MQL4 #MT4 #Indicator
❀37✍3πŸ‘Œ3⚑1πŸ‘€1
MetaTrader 5 indicators rely on event-driven flow: timeframe changes trigger OnDeinit, then OnInit after the chart rebuild. During this cycle, indicator memory is cleared, so runtime counters reset unless state is stored externally.

One approach is to handle OnDeinit(reason) and preserve the counter only when reason equals REASON_CHARTCHANGE; otherwise reset to zero. This keeps logic local, but file-based persistence can introduce race conditions when multiple charts or rapid period changes contend for the same state.

An alternative is terminal global variables. They persist across reinitializations while the terminal is running, store only double, and can be adapted via unions for packed data. GlobalVariableTemp enables session-scoped state without filesystem dependency, but shifts control to terminal-level storage semantics.

πŸ‘‰ Read | CodeBase | @mql5dev

#MQL5 #MT5 #AlgoTrading
❀25πŸ”₯8πŸ‘Œ2πŸ’―2
Unidirectional ML trading is often a better fit for instruments with persistent trend, where buy/sell classes are not separable and bidirectional classifiers generate systematic errors.

A one-direction sampler replaces buy/sell markup with a single label: 1 means β€œopen trade in selected direction”, 0 means β€œskip”. Trade duration is randomized between min/max bars.

The tester is updated for one-direction logic with Numba-accelerated processing, supporting exits by model signal, stop loss, or take profit, whichever occurs first.

Meta learners are used as preprocessing, not as final models. Cross-validated or bootstrapped β€œheads” identify consistently misclassified rows and set meta_labels and labels to 0 to filter low-quality entries. This simplifies learning under trend non-stationarity and reduces false entries for the chosen direction.

πŸ‘‰ Read | AlgoBook | @mql5dev

#MQL5 #MT5 #AlgoTrading
❀32πŸ‘Œ2
Classic Ilan popularized grid averaging with Martingale-like sizing: add positions against price to improve the average entry. It can look robust in range markets, but it predictably fails in sustained trends as exposure grows exponentially and margin collapses.

Ilan 2.0 added volatility-based grid spacing, multi-symbol correlation checks, and extra filters, yet remained a static rule engine with no way to learn when to stop averaging.

Ilan 3.0 AI reframes the EA as a reinforcement learning agent. Q-learning drives decisions via a dynamic Q-table over discretized market/position states, updated with the Bellman equation and an Ξ΅-greedy explore/exploit schedule. Rewards favor profitable closes and penalize averaging, with persistence by saving/loading the Q-table.

Tests still show drawdown risk typical of Martingale, motivating a next step: neural...

πŸ‘‰ Read | AppStore | @mql5dev

#MQL5 #MT5 #AlgoTrading
❀57πŸ‘3😁3πŸ‘Œ3πŸ‘€3
Price Action Day Trader EA executes on each new bar using three setups: pin-bar rejection with configurable wick-to-body thresholds, engulfing candles for reversal momentum, and inside-bar breakouts from a defined mother bar.

Entries are gated by a dual EMA trend filter (20/50 by default) and a support/resistance lookback that validates signals against recent structural levels.

Risk is position-sized by balance percentage (default 1.5%) with a max daily loss cap (3%). Trade management includes break-even automation and trailing stops, plus a session window that can block entries and force end-of-day flat.

Execution includes automatic detection of broker filling mode (FOK, IOC, Return). Key inputs cover RiskPercent, StopLossPips, TakeProfitRatio, PinBarRatio, SRLookback, EMA periods, and trading hours. Recommended for M15/H1/H4 on majors and XAUUSD, with SL...

πŸ‘‰ Read | AppStore | @mql5dev

#MQL5 #MT5 #EA
❀40πŸ‘Œ5
A computer-vision pipeline is built around MetaTrader 5 data to predict EURUSD direction without hand-crafted indicators. The system pulls ~2,000 H1 bars, converts rolling 48-candle OHLC windows into normalized multi-channel β€œimages,” and labels each sample by the move 24 bars ahead.

A Keras Functional CNN (two Conv blocks with batch normalization, then dense layers) is trained with early stopping to reduce overfitting. Functional design also enables introspection.

Interpretability is treated as a core feature: intermediate feature maps are visualized alongside candlesticks, and an attention-style heatmap highlights the chart regions driving the decision, often aligning with reversals and key levels.

Outputs are presented as both direction and probability, supporting confidence-based position sizing and server-side execution via headless plotting.

πŸ‘‰ Read | Quotes | @mql5dev

#MQL5 #MT5 #AI
❀36πŸ‘Œ3πŸ‘1
Market reversals are often driven by crowd positioning, not clean trend logic. Larry Williams’ smash day reversal targets breakouts that fail fast and trap late participants.

A smash day is a bar that closes beyond recent structure: below prior lows for buy reversals, above prior highs for sell reversals. Outside bars are excluded to reduce ambiguous range expansion.

The EA framework makes the pattern testable in MQL5. It supports buy-only, sell-only, or both, with a single active position to keep attribution clean.

Entries trigger on a break of the smash bar level, either immediately on price cross or after bar-close confirmation. Stops sit at the smash bar extreme; take profit uses a configurable risk-reward ratio. Position sizing can be fixed-lot or percent-risk.

πŸ‘‰ Read | NeuroBook | @mql5dev

#MQL5 #MT5 #EA
❀33πŸ‘Œ6πŸ‘¨β€πŸ’»3🀨1
This article builds an on-chart position labeler for MetaTrader 5 to close the usability gap between the Trade tab and live price action. Each open position is tied to a chart β€œbubble” anchored at entry time/price, showing ticket and real-time P/L with a clickable close area.

The implementation uses MQL5 Standard Library components: CCanvas for ARGB overlay rendering, CPositionInfo for stateful access to live position fields, CTrade for safe programmatic closes, and CiMA (Trend) to generate simple test positions.

Key engineering points include custom hitboxes for mouse interaction, OnInit bootstrapping of indicator handles and chart event routing, and a throttled redraw loop (~30 FPS) to keep UI responsive without slowing trading logic.

πŸ‘‰ Read | AppStore | @mql5dev

#MQL5 #MT5 #EA
❀36πŸ”₯4πŸ‘Œ3πŸ‘1
A new option has been added to select the timeframe used when drawing Bobokus Fibonacci levels. This allows Fibonacci calculations and placement to be based on a chosen chart period rather than the currently active view, improving consistency when switching timeframes.

Support is also included for custom Fibonacci levels. Any additional ratios can be defined and displayed alongside the default set, making it easier to align levels with a specific trading model or internal standards.

The update focuses on configurability and repeatable layout, reducing manual rework when analyzing multiple symbols or sessions.

πŸ‘‰ Read | NeuroBook | @mql5dev

#MQL5 #MT5 #Indicator
❀33πŸ‘€4⚑2πŸ‘Œ2πŸ”₯1
Better MQL5 code often comes down to habits, not years of experience.

Strong forum culture matters: critique code only after understanding intent, and provide explanations that teach. Dropping unclear snippets encourages copy-paste fixes, spreads bad patterns, and leads to wrong answers and unfair reviews.

Adopt a growth mindset. Complex EAs, advanced math, and adaptive models become approachable through steady practice and reading real source code.

Keep code lean and intentional. Remove unused blocks and variables to reduce bugs, speed reviews, and make debugging easier.

Treat mistakes as training data. Try multiple approaches before posting, document what was attempted, then understand the fix to prevent repeats. Progress in algo trading development is incremental, built through iteration, experiments, and helping others.

πŸ‘‰ Read | Docs | @mql5dev

#MQL5 #MT5 #Strategy
❀73πŸ‘9πŸ‘Œ6⚑4🀑3πŸ”₯2🀨1
An equidistant channel tool is used to mark rectangular consolidation by placing two parallel boundaries around price. The upper line tracks repeated highs, the lower line tracks repeated lows, while the midline helps assess balance and potential mean reversion.

Key checks include multiple clean touches on both sides, stable channel width, and limited slope to confirm a range rather than a trend. When volatility contracts inside the channel, breakouts can be evaluated by close outside the boundary, follow-through, and a retest of the broken line as former resistance or support.

πŸ‘‰ Read | Quotes | @mql5dev

#MQL5 #MT5 #Indicator
❀39✍5πŸ‘€5πŸ‘Œ3
GUI animation on CCanvas requires deterministic redraw. Overpainting frames accumulates pixels, so state must be restored before drawing the next frame.

A minimal sprite workflow is implemented by caching the background under a moving element, drawing the element, then restoring the cached pixels on the next update. This scales better than full form redraw for multiple independent elements.

GCnvElement is extended to store an initial pixel snapshot, add resource-to-array copying, and track last text coordinates plus anchor-based X/Y offsets for correct background capture.

ShadowObj is simplified by reusing the new base snapshot and Width/Height accessors. Form.mqh adds a pixel-copier class with ID-based instances, storing rect coordinates, effective clipped size, and save/restore methods for partial canvas regions.

πŸ‘‰ Read | Calendar | @mql5dev

#MQL5 #MT5 #algorithm
❀67πŸ‘Œ11
A new technical indicator marks values when they enter oversold and overbought zones, with an arrow signaling when the value returns from an extreme level.

Configuration options cover colors, line width, zone levels, and arrow display, allowing quick adjustment to different chart templates and instruments.

For more stable outcomes, the indicator is designed to be used alongside other signals and broader market analysis rather than as a standalone trigger.

Optional alerts are available to notify on key zone events and return signals, supporting monitoring without constant chart focus.

πŸ‘‰ Read | AlgoBook | @mql5dev

#MQL4 #MT4 #Indicator
❀45✍6πŸ‘€3πŸ‘2😁2πŸ‘Œ2⚑1
Geometric Asymmetry (GA) Breakout frames breakouts as a structural condition, not a volatility event. Consolidations are qualified via fractal swing sequences, ATR-normalized range rules, and internal leg proportion checks to detect directional pressure before any boundary breach.

Decision flow is staged: fractal-based swing extraction, consolidation validation, geometric voting on distance/slope/time asymmetry, then pattern locking to prevent repainting. Signals trigger only on candle close beyond range high/low with a configurable buffer and cooldown.

MQL5 implementation follows a modular layout: fractal detection, range boundary calculation, qualification filters, asymmetry validation, breakout scanning, and pattern lifecycle management. OnTick runs a bar-close pipeline and emits chart objects plus multi-channel alerts without repeated triggers on the sa...

πŸ‘‰ Read | NeuroBook | @mql5dev

#MQL5 #MT5 #EA
❀32⚑2πŸ‘Œ2
Markets often look random, but chaos theory frames them as systems with hidden structure: mean reversion, sensitivity to initial conditions, and fractal self-similarity across timeframes.

The article builds a MetaTrader-style Neural Attractor Oscillator: a small feedforward network trained on price history, using tanh for bipolar dynamics and normalization for stable learning. It predicts a moving β€œattractor” level, then outputs an oscillator as percent deviation from that attractor to flag overextension and potential snap-back.

Signal quality is gated by a Lyapunov exponent to quantify how chaotic the market is, with optional fractal noise (Midpoint Displacement) and momentum optimization to improve training. Practical use includes adaptive overbought/oversold bands, divergence detection, and smoothing choices (EMA/SMA) based on regime.

πŸ‘‰ Read | AppStore | @mql5dev

#MQL5 #MT5 #AITrading
❀29✍2πŸ‘Œ2πŸ‘€2πŸ€”1🀩1