MQL5 Algo Trading
586K subscribers
4.89K photos
7 videos
4.89K 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
News Event Marker is a MetaTrader 5 chart indicator that reads the terminal’s built-in economic calendar and renders selected releases directly on the chart. It draws a vertical line at each scheduled time, with coloring by importance, plus an optional shaded time window and short labels for higher-impact items.

A corner panel lists upcoming and recent releases with countdown or “ago” timing and shows actual and forecast figures when available. It can raise optional alerts a configurable number of minutes before high- or medium-impact events. The tool is display-only and does not place, modify, or close orders.

Filtering supports importance levels, a configurable lookback/lookahead horizon, and an event cap to avoid clutter. Currency selection can be automatic by parsing the chart symbol for 3-letter codes, or manual via a comma-separated list.

Data...

👉 Read | VPS | @mql5dev
❤17👍16🔥15🤩14
IndexGapMarker scans daily candles and marks each opening gap above a configurable minimum. For every detected gap, it draws a box that remains green or red while unfilled, then switches to grey once price trades back to the prior close. A label reports the gap size in percent and the current fill status.

Key inputs include scan depth in days, minimum gap threshold, color settings, optional display of filled gaps, and label on/off control.

Best suited to stock index CFDs with defined closing sessions (DAX, Euro Stoxx, FTSE). Instruments trading nearly 24/7 typically show fewer gaps. The indicator can run on any chart timeframe since calculations use daily data. It is informational and not a trading system.

Deployment: copy IndexGapMarker.mq5 to MQL5\Indicators, compile in MetaEditor, then attach to an index chart. H1 is a practical default.

👉 Read | CodeBase | @mql5dev
👍15❤13🔥11🤩9
Fair Value Gap (FVG) detector for identifying 3-candle price imbalances and managing them as chart zones. A bullish FVG is flagged when the third candle’s Low is above the first candle’s High. A bearish FVG is flagged when the third candle’s High is below the first candle’s Low. Zones are drawn on closed bars only, preventing repaint during formation.

Active gaps are tracked in a list. On startup, a limited lookback is scanned; afterward, each closed bar is processed once, while ticks only validate existing zones against current High/Low. No full-history rescans are performed, and the oldest zones are dropped when InpMaxZones is exceeded.

Fill handling is configurable: TOUCH (entry), HALF (midpoint), or FULL (complete cross, default). Filled zones are removed automatically, or optionally kept as dotted, truncated boxes. Key inputs include InpMinGapPo...

👉 Read | Signals | @mql5dev
🔥19👍15❤11🤩11
Order Block Marker adds rule-based order block detection with mitigation tracking, aimed at reducing subjective marking.

A block is defined as the last opposite-color candle before a confirmed displacement. Confirmation requires the next candle to close beyond the block’s high/low, followed by an impulse within InpImpulseBars that reaches at least InpImpulseMult times the average range over InpAvgPeriod, with no prior return into the zone during validation.

Each zone is tracked as Fresh (untouched), Mitigated (price re-enters or reaches midpoint, per InpMitigation), or Broken (a closed bar breaches the far side). Fresh and mitigated zones remain visible with separate styles; broken zones are removed.

Processing is incremental: limited startup scan (InpLookbackBars), then one pass per closed bar with tick-level state updates for a capped list (InpMax...

👉 Read | Signals | @mql5dev
👍12🤩12❤9🔥9
Fair Value Gap (FVG) detector focused on imbalance zones and automatic cleanup after invalidation.

An FVG is detected on closed bars using a 3-candle pattern. Bullish FVG triggers when candle 3 Low is above candle 1 High. Bearish FVG triggers when candle 3 High is below candle 1 Low. A zone is drawn as a box between those two prices and extended right.

The tool maintains an active zone list, scans only a configurable lookback at startup, then processes each new closed bar once. On ticks, only active zones are checked, avoiding full-history rescans.

Fill logic is selectable: TOUCH (first entry), HALF (midpoint), or FULL (complete cross, default), using wick High/Low. Filled zones are either deleted or retained as dotted, time-limited boxes. Limits include MinGapPoints, LookbackBars, MaxZones, optional new-gap alerts, and styling controls.

👉 Read | Signals | @mql5dev
❤22👍13🔥12🤩8
BOS and CHoCH labeling formalizes market-structure breaks using confirmed swing points. A swing high/low is detected when the current bar exceeds InpSwingBars bars on both sides, and becomes valid only after the required bars close.

The last confirmed swing high and low act as structure levels. When a closed bar breaks a level, trend state is updated. Breaks aligned with the current trend are labeled BOS; breaks against it are labeled CHoCH. The first break only sets the initial trend and is not labeled. Each swing can be broken once; new labels require a new confirmed swing.

Operation is close-based and non-repainting. State is retained between calls, with a one-time lookback scan and then single-pass processing per new closed bar. Options include break-by-close vs break-by-wick, label limits, styling, and optional alerts. Recommended use spans any ...

👉 Read | Freelance | @mql5dev
❤15👍14🔥7🤩4😁3
Premium/Discount zones can be derived from the current swing range by splitting the active range at 50%. Prices above equilibrium are treated as Premium (often used for sells or taking profit on longs), and prices below as Discount (often used for buys or taking profit on shorts). The chart also reports the current Bid position as 0–100% of the range.

The swing range is built from the last confirmed fractal swing high and swing low (higher High / lower Low than InpSwingBars bars on both sides). Confirmation requires the following bars to close, so the range updates with a delay. Range start is the older swing; High/Low are the extremes since that point and can expand on breakouts until a new swing is confirmed.

Runtime behavior is optimized: limited lookback on startup, then one-pass processing per closed bar; redraw occurs only when the range change...

👉 Read | Quotes | @mql5dev
❤16🔥14👍8🤩5
EA Safety Check is a static scanner for EA/indicator source code (.mq5, .mq4, .mqh) before execution. Files are read as plain text and never run. Output is a per-file report listing risky lines, the rationale, and a verdict, aimed at quick triage of code from forums, chats, or third-party sellers.

Usage: create MQL5\Files\SafetyCheck\ and copy target sources into it. Run the script on any chart. Results appear in the Experts tab, are saved to MQL5\Files\SafetyCheck_report.txt, and a summary alert shows verdicts.

Checks include HIGH findings (DLL imports, process launch calls, Windows internet APIs, delete operations, martingale multiplication, numeric arrays decoding to URLs/DLL/.php/.exe). MEDIUM findings include WebRequest, sockets, SendFTP/SendMail, URLs, Common folder access, account data reads, string conversion obfuscation, grid logic, SL=0 trades, an...

👉 Read | Forum | @mql5dev
❤6🤩5👍4🔥4
A currency strength indicator renders a compact panel that ranks eight majors: USD, EUR, GBP, JPY, AUD, NZD, CAD, CHF.

For each currency, it computes the rate of change versus the other seven across the last InpLookback bars on InpTimeframe, then averages the results. The latest price is compared to the close InpLookback bars ago, so values update while the current bar is forming. Positive/negative values are colored as strong/weak, and bar lengths are normalized to the panel’s max value.

It reads the 28 cross pairs derived from the basket; missing broker symbols are skipped, and an optional InpSuffix supports symbol suffixes. On first attach, values can remain zero until history loads.

Key inputs include Lookback (24), Timeframe (H1), panel corner/offset, font size, and color settings. Display-only; no trade execution or management.

👉 Read | AppStore | @mql5dev
❤12👍9🤩7🔥5👨‍💻3⚡1
An intraday indicator tracks the previous day’s high (PDH) and low (PDL) across the last N sessions and flags the first touch of each level within its session. It targets workflows that use yesterday’s extremes as reference points and need consistent historical and live marking.

PDH/PDL values are read from the prior D1 bar using broker server time. Levels are drawn only over their corresponding day (PDH red, PDL blue). A touch is counted only after price has moved at least MinDistPct away from the level; sessions that open on a level require a move away and a return. Only the first touch per level per day is marked with a gold arrow, with an optional one-time alert for today.

Designed for H4 and below. Uses objects only (PDFT_ prefix), no buffers, and cleans up on removal. If D1 history is missing, it retries until available. First touch is a refere...

👉 Read | Docs | @mql5dev
👍6❤5🔥5🤩2
An intraday session-box indicator plots Tokyo, London, and New York trading windows as colored rectangles directly on the chart.

Each box starts at the configured session open, ends at the session close, and vertically spans the session high-to-low range. This makes session ranges and overlap periods easy to read.

Session hours are entered in broker server time and must be aligned to the broker’s GMT offset. Defaults target GMT+2 servers. Active sessions extend to the current bar and update on each new bar; weekends and holidays with no bars are skipped.

Designed for M1–H1, it redraws once per bar for low terminal load and removes all chart objects on deletion. It is visualization-only and does not execute or manage trades.

Key inputs include days-back (15), per-session enable switches, start/end hours, per-session colors, and optional fill vs outl...

👉 Read | VPS | @mql5dev
❤16👍13🤩9🔥5👨‍💻2
A utility script for one-pass position cleanup with explicit filters, avoiding blanket close-all behavior. Selection criteria include chart symbol only vs all symbols, magic number targeting (-1 any, 0 manual), trade direction (buy/sell/both), and P/L state (all, profit only, loss only). Floating P/L calculation includes swap.

Execution requires enabling algo trading and allowing it in the script settings. After running, the terminal reports counts of closed and failed positions, while each ticket is logged with the server return code. Closing requests use the broker-supported filling mode per symbol, apply a configurable max slippage, iterate positions from last to first to avoid index gaps, and skip pending orders entirely.

👉 Read | AppStore | @mql5dev
🔥9❤7👍6🤩6
A chart-side indicator panel reports trading costs for the active symbol in real time.

The display includes current spread in pips and points, average spread since attachment, and the spread cost of a 1-lot trade converted to the account currency. Updates run on every tick plus a 2-second timer.

Cost is derived from spread, tick size, and tick value, so it supports FX, metals, indices, and crypto. Average spread is accumulated from incoming ticks and resets when the indicator is re-attached or inputs change.

A status line shows Normal while spread is at or below InpWarnSpread points, switching to Wide with the warning colour above that threshold. Typical use cases include validating broker conditions before running a scalping EA and tracking spread behavior around news and daily rollover.

Key inputs: InpWarnSpread (default 30), panel corner and pixel...

👉 Read | AlgoBook | @mql5dev
❤17🤩12👍10🔥5
A chart indicator renders a compact account status panel with balance, equity, used margin, margin level, floating P/L, today’s closed P/L, and equity drawdown from peak. All values are displayed in the account deposit currency.

Today’s P/L is calculated from history as the sum of profit, swap, and commission for all buy/sell deals closed since 00:00 server time. Drawdown tracks the highest equity observed since the panel was attached and increases only when equity drops below that peak.

Data refreshes on every tick and via a 3-second timer. Margin level is shown only when margin is in use. Floating P/L and today’s P/L use profit color at zero/positive and loss color when negative; drawdown switches to loss color when it reaches the InpDDWarn threshold.

Layout supports any chart corner, DPI-scaled sizing and offsets, and full cleanup on removal. The i...

👉 Read | VPS | @mql5dev
👍8❤6🔥4💯2🤩1👨‍💻1
Thanos AI Level Strength ranks unbroken swing highs and lows on a selectable level timeframe (H1 default) and draws them with intensity based on a 1–5 score. Each level is tagged with a five-bar meter plus age and hold count (example: 6d · 2). Weak levels are faint; higher-scored levels are brighter. Levels are removed after a confirmed close through them, and calculations use closed bars only to avoid repainting.

Scoring uses two inputs: age (older than 1 day adds 1 point, older than 1 week adds another) and holds (1 hold adds 1 point, 2+ holds add another), with every unbroken level starting at 1. “Test”, “hold”, and “broken” states are defined via ATR thresholds on the level timeframe, with nearby levels merged when closer than ~0.33 ATR.

UI updates in 2.02 focus on controls: movable/dockable panel listing nearest levels, clickable price tags, min...

👉 Read | VPS | @mql5dev
❤20👍15🤩5🔥4🎉2
An on-chart position-size calculator displays ATR from the last closed bar in price units and pips. Stop-loss distance is computed as ATR multiplied by InpAtrSlMult, while risk is InpRiskPercent of account balance in deposit currency.

Suggested volume is derived by dividing the risk amount by the projected one-lot loss at the stop distance. One-lot loss uses the symbol’s tick size and tick value, supporting metals, indices, and cross pairs where the quote currency differs from the account currency.

Volume is floored to the symbol’s step and constrained to min/max. Pips are defined as 10 points on 3/5-digit quotes, otherwise 1 point. Minimum-volume constraints can increase actual risk on small accounts.

Values refresh on every tick and via a 5-second timer. Panel layout scales by DPI, supports all chart corners, draws objects only, uses no buffers, does n...

👉 Read | NeuroBook | @mql5dev
❤7👍7🔥4🤩4
Prop Firm Equity Guard enforces two common prop firm constraints: daily loss and maximum overall loss. Attached to a single chart, it monitors the entire account across all symbols, including manual trades and other EAs.

On breach, it closes all open positions, removes pending orders, and keeps exposure at zero until the next trading day for daily limits, or until manually reset for max-loss. An optional profit target can also flatten the account when equity reaches the configured threshold.

Limit floors are derived from a day-start reference (max of balance/equity at the reset hour) and from the initial balance, each adjusted by a safety buffer to reduce slippage risk. State is persisted via terminal global variables, and close requests are rate-limited to one pass per 2 seconds. Supports hedging/netting; configurable filters, alerts, and post-breach trade...

👉 Read | AppStore | @mql5dev
❤21🔥10🤩8👍7
A compact multi-timeframe trend panel aggregates EMA direction for six fixed periods: M5, M15, M30, H1, H4, and D1. Each state is derived from a fast EMA versus a slow EMA on close prices, so the panel remains consistent regardless of the chart’s current timeframe.

Signals are evaluated on the last closed bar per timeframe to prevent intra-bar toggling. Output states are UP when fast EMA exceeds slow EMA, DOWN when below, and FLAT when equal. A loading state is shown with three dots until history becomes available.

Implementation details include creating 12 EMA handles once on initialization and releasing them on deinit. The display updates on every tick and also on a 5-second timer. Layout supports DPI scaling, configurable offsets, and anchoring to any chart corner. The indicator uses chart objects only, with no buffers and no trading logic.

👉 Read | NeuroBook | @mql5dev
👍8❤7🔥4🤩4⚡1
Smart Break-Even & Partial Close is an EA that manages open positions regardless of whether they were placed manually, from the mobile app, or by other EAs. Logic is based on R multiples, where 1R is the entry-to-original stop distance captured the first time a stop is detected.

Sequence: partial close at InpPartialAtR (default 2R) closes InpPartialPercent (50%) once per position, rounded to lot step and skipped if volume cannot be split. Break-even at InpBreakEvenAtR (1R) moves SL to entry plus InpBreakEvenOffset points; positions without SL can use InpBreakEvenPoints. Step trailing starts at InpTrailStartR with a distance and step filter.

Controls include magic filtering (-1 all, 0 manual), optional all-symbol management, broker stop-distance validation, and “better-only” SL updates to reduce server requests. State persists via terminal global variables w...

👉 Read | Freelance | @mql5dev
❤10👍9🔥8🤩4
An MT5 chart indicator plots economic calendar releases as dotted vertical lines. Data is sourced from the terminal’s built-in economic calendar, covering events from InpDaysBack before current server time to InpDaysForward after it.

Filtering supports a comma-separated currency list (InpCurrencies, for example USD,EUR,JPY). When empty, events for all currencies are shown. Events are also filtered by minimum impact (InpImportance: 1 low, 2 medium, 3 high). Line colors map to impact level via InpHighColor, InpMidColor, and InpLowColor. Tooltips display currency and event name.

Objects are rebuilt on each new bar and every five minutes via timer to pick up newly scheduled releases without reload. Lines are drawn in the background, non-selectable, and are removed when the indicator is detached.

Requires a live server connection. The economic calendar is...

👉 Read | Docs | @mql5dev
❤8👍5🔥4🤩2
Equivalence Checker provides regression testing for MQL5 indicators by comparing full-history calculation against true tick-by-tick incremental updates, where most state bugs occur. It runs two independent paths: an incremental CalcIncremental() under test that persists state in buffers, and a reference path that recomputes from scratch (direct SMA window summation plus separate recursion chains for EMA and Wilder/RMA).

On every OnCalculate() call, the live bar values are compared and the worst deviation observed during the bar’s lifetime is retained and merged at close, preventing tick-only defects from disappearing in history. A fixed synthetic dataset mode makes inputs deterministic across symbols and terminals, enabling repeatable runs.

A 32-bit FNV-1a digest over a closed window anchored at a fixed bar time supports “golden” regression checks, r...

👉 Read | VPS | @mql5dev
👍13❤10🔥9🤩4