MQL5 Source Code Library for MetaTrader 5 - 5

icon

This is the largest free source code library for MetaTrader 5 platform programs. Here you can find ready-made Expert Advisors, technical indicators, scripts and libraries. Use the code library when learning MQL5 language and develop your own automated trading applications based on the provided codes.

You can freely download and test published codes, as well as launch them in MetaTrader 5. The library is also available directly from MetaTrader 5 platform and MetaEditor development environment.

Submit your code

Script that exports the closed trades of your account to a CSV file and prints a short summary: trades, win rate, net result and profit factor.

An account-wide MetaTrader 5 utility that tracks daily loss from the chosen start-of-day equity and intraday equity peak. Shows warning and critical levels with optional money and percent limits plus terminal, sound or push alerts. It never places, modifies or closes trades.

Draw Asian, London and New York session ranges as chart boxes with high/low lines, labels and an optional London–New York overlap. Configure GMT or broker-server hours and review the latest session statistics in a panel.

A small script that turns "risk in % of the account" and "stop loss in pips" into a lot size. It only calculates and prints; it never opens, modifies or closes trades.

Session windows are quoted in GMT; the chart runs on the broker's clock. This indicator takes each window in GMT, applies your broker's offset, and draws the box over that window's bars. It adds the high and low lines to every enabled window unless you switch them off, prints the session name and range only on that session's newest box when there is room, and never trades.

Chart panel that calculates position size from risk % and stop-loss in points, with tick value, margin and money at risk. Does not place orders.

Marks previous day, Asian and London session highs and lows from chart bars and flags closed-bar, ATR-filtered liquidity sweeps. Non-repainting, with EA-readable buy/sell buffers and an on-chart display panel.

Auto-scaled round-number grid for any symbol — big figures and half levels drawn to the right spacing whether you're on EURUSD, USDJPY, XAUUSD or an index, plus a live "distance to nearest magnet" readout.

Compact zero-buffer MetaTrader 5 on-chart HUD displaying live Spread in points and pips, Daily ATR(14) range consumption percentage, broker Stops/Freeze levels, and 1R lot size.

Shows the risk every past trade really took (the loss at its stop loss as a % of the balance at entry) and how far a fixed lot drifted from the tested risk. Read-only.

Draws the previous day High, Low and Close as horizontal levels on the chart, with optional history for several past days, extension of today's levels to the right and price labels.

TradingView-style Long/Short position tool for MT5: drag the Entry, Stop and Target lines and get lot size, risk, reward, R:R and margin instantly.

MA Toolkit: a compact moving average indicator written from scratch. Choose SMA, EMA or LWMA for a fast and a slow line, see the fast line colored by its slope, and get optional crossover arrows, alerts and an info panel.

Horizontal lines at round figures around the displayed price, with a spacing that adjusts according to the zoom level.

A basic expert advisor that trades in the direction of the 9.30 am New York 5-minute candle on index CFDs (US100 / NAS100). One trade per day, fixed stop-loss and take-profit levels, forced closure; no martingale or grid strategy.

Exports bars of any timeframe and, optionally, every tick from the Strategy Tester to CSV, without the chart's 100,000-bar limit. Reports gaps inside trading sessions. Places no orders.

MTF order blocks from the chart timeframe or a higher one, shaded on the chart and followed bar by bar: fresh until price comes back, tested after that with every return counted, broken once a close goes through. Sizes are measured in average ranges, so the defaults fit any symbol, and a new zone absorbs the ones it overlaps, so zones never stack.

Panel showing a candle countdown, spread, daily ATR and the proportion of the daily range already used.

An animated 24-hour dial of the Sydney, Tokyo, London and New York sessions with automatic daylight saving time, a countdown to the close of the current candle, and live spread and day range. The panel collapses into a bar and can be dragged on the chart.

An animated one-click trading panel for the chart symbol: buy and sell with live prices, lot stepper, close all, close profit, close loss and breakeven, with confirmations, a practice mode and a collapsible, draggable panel.

An animated chart panel that shows the equity drawdown of the account in real time, the closed result of the day, week and month, and one line for every Expert Advisor running on the account.

Live rolling-correlation heatmap across your watchlist — spot hidden overlapping exposure before you stack three “different” trades that are secretly one trade.

Local MT5-to-MT5 trade copier through the Common files folder. One EA in Master or Slave mode: lot multiplier or fixed lot, symbol prefix/suffix, reverse, SL/TP and partial close sync.

Logs the slippage, fill delay and spread of every deal on the account (manual, EAs, SL/TP hits) to a CSV file and shows a live summary. It never trades.

Closes all positions and pending orders when the account profit or loss reaches your target, in money or % of balance. Floating or full-day P/L, symbol and magic filters.

Minimal include file to license your own EAs and indicators: allowed account numbers, expiry date, demo-only trial mode and broker server filter. Example EA included.

Account guardian for prop firm rules: closes all trades and blocks trading before the daily loss or max loss limit is hit, with an optional profit target lock.

Finds out why an EA or trade copier cannot trade on your account. Read-only script, never trades.

Opening range breakout indicator for MT5 on Gold (XAUUSD), forex and indices: box of the first minutes of up to three sessions, breakout levels, two targets by range height, arrows and alerts on the closed candle. Open source code.

Records the spread of one or many symbols to CSV every minute (min, time-weighted average, max), with ready tables per hour of day and per trading session. Restart-safe, never trades.

Draws non-repainting Tokyo/Asia, London, and New York intraday session high/low range boxes, exposes running session High/Low buffers for EAs via iCustom, and displays a live Spread, Broker StopsLevel, and ATR(14) points HUD.

Protects your account from a prop-firm rule breach: daily loss limit, max drawdown (static or trailing) and profit-target lock. On a breach it closes all positions and pending orders, then blocks new trades until the lock resets.

Tests any MT5 indicator for repainting: records what every buffer showed when each bar closed, reads the same bars again later and reports values that changed, signals that appeared late and signals that vanished, with dates.

Supertrend indicator for MT5 on Gold (XAUUSD), forex and indices: ATR trailing line in two colours, buy and sell arrows only on the closed candle of the flip, popup, push and sound alerts. Open source code.

Free breakout EA: Asian range, London breakout, one trade a day, stop loss always set, lot size based on risk percentage. No grid, no martingale. / Free EA: Asian range breakout during the London session, one trade a day, stop loss always set, lot size based on risk percentage. No grid or martingale.

Persistent MQL5 outbox with a Telegram demo and offline tests. An uncertain result is never retried automatically. Manual retry may duplicate a message; SENT means API acceptance, not a read receipt.

Lot size calculator panel for MT5 on Gold (XAUUSD), forex and indices: risk in percent of balance, percent of equity or money, stop in points, exact loss per lot, one click Buy or Sell with stop and target. Open source code.

Liquidity indicator for MT5 on Gold (XAUUSD), forex and indices: equal highs and equal lows from swings, marked as swept when a wick runs the level and the candle closes back. Open source code.

Fair value gap (FVG) indicator for MT5 on Gold (XAUUSD), forex and indices: three candle gaps on closed bars, ATR size filter, the open part shrinks as price fills it, mitigation by touch, midline or full fill. Open source code.

Структура M5 как при ручной разметке: развороты берутся по фракталам H1, точки ставятся на настоящие экстремумы свечей M5. Волна никогда не проходит мимо экстремума, подтверждённые точки не перерисовываются.

123456789101112...218