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

This is an indicator that identifies Wolfe waves and plots them

Previous day high and low, previous week high and low and today's open as horizontal lines with small price labels, on any timeframe.

Draws the Tokyo, London and New York sessions of the last few days as boxes from each session's high to its low, with the high and low printed on the chart. Session hours are set in server time.

Countdown to the close of the current bar, the live spread in points and the time left until the next server midnight, when brokers roll positions over and charge swap.

Shows the spread of every bar as a histogram with its average, flags unusually wide spreads, and lists the live spread, swap long/short, the triple-swap day and a bar countdown.

Plans ATR-based stop loss and take profit levels for a buy and a sell from the current price and works out the lot size for the account risk you choose.

A compact dashboard that shows the EMA trend direction and ADX strength of several symbols across several timeframes at once.

Asian, London and New York session boxes with high/low range, plus a clean panel showing ADR, today's % of ADR, spread and time to candle close.

Watches a basket of positions (whole account, one symbol and/or one magic number) and closes all of them together when the floating P/L hits your profit target, loss limit, trailing profit lock or a set time. Does not trade.

Institutional on-chart account inspector, behavioral signature analyzer, EA vs manual breakdown, and prop firm drawdown auditor with 1-click HUD.

Smart Money Concepts (SMC) Expert Advisor and on-chart analysis utility for MetaTrader 5 that detects overlapping M15 Order Blocks and Fair Value Gaps with real-time confluence scoring and daily drawdown protection.

A premium, on-chart analytical dashboard that automatically scans for ICT Order Blocks, Fair Value Gaps (FVG), and calculates real-time AI confluence scores for Smart Money traders.

G7 Pro Trade Manager & Prop Firm Equity Protector is a professional on-chart trading assistant for manual traders and prop firm accounts (FTMO, FundedNext, The5ers). It features a clean obsidian HUD dashboard directly on the MT5 chart with 1-click execution, automated breakeven shield, dynamic trailing stop, and a daily loss circuit breaker to protect your funded account. Compatible with all pairs and accounts.

Order block indicator for MT5 on Gold (XAUUSD), forex and indices: the last opposite candle before a move that breaks a swing becomes a zone, fresh, tested and broken states, closed bars only. Open source code.

Tracks live midnight rollover spread spikes against a self-calibrating daytime baseline and outputs a binary iCustom guard flag (Buffer 0) so EAs can pause entries during liquidity drains.

When I first started scalping, I had a problem: during periods of high volatility, it sometimes took too long to calculate exactly 1%, and I’d end up setting an incorrect stop-loss or using a position size that was too low or too high. But with this calculator, I can do it much faster—I just have to drag a line to the stop-loss zone, and it automatically calculates the position size I should use for my 1%. I hope you find it very useful!

Moving average crossover EA for Gold (XAUUSD), forex and any symbol: one position per cross of two moving averages on the closed bar, exit on the opposite cross, stop loss, take profit and breakeven in points. Open source code.

Auto Fibonacci retracement for Gold (XAUUSD), forex and any symbol: draws the levels on the last completed swing leg by itself, with the 61.8 in its own colour, prices on each level and an optional alert. Open source code.

Forex session boxes for Gold (XAUUSD), forex and any symbol: draws the Asian, London and New York sessions with their high and low extended to the right and the range in points, in your broker server time. Open source code.

An all-in-one Smart Money Concepts (SMC) indicator that automatically identifies Swing & Internal Market Structure (BOS/CHoCH), Order Blocks, Premium/Discount zones, and Equal Highs/Lows. It features a real-time multi-timeframe bias dashboard to help traders make informed decisions.

A free MT5 script to calculate position size, risk amount, and risk-to-reward ratio visually on the chart.

On a linear MT5 chart, a trend that grows or falls by a steady percentage is a curve, and a straight channel misses it. This indicator draws the real exponential curve, fitted on closed bars to the cleanest of 19 look-back windows, with deviation zones, a projection ahead and a card with the fit, the trend pace and the price position.

Real-time tick spread monitor that plots Maximum and Average spread curves per bar with points/pips display and local CSV persistence.

Lightweight Expert Advisor combining Scalp & Swing logic with an "Always-ON" position-securing layer. Includes a fully interactive on-chart panel with manual trade buttons, risk- based lot sizing, partial close, break-even, trailing stop, swing SL/TP switching, and a one-click "Secure All" tool.

Countdown to the next high-impact news from the MT5 economic calendar, with a red NEWS WINDOW warning for prop-firm news rules. Display and alerts only - it never trades.

Drag the MetaTrader 5 chart freely in any direction and stretch the price and time scales with the mouse, the way TradingView does it. One click on ON/OFF returns the normal chart. A small indicator that draws nothing, never trades and works next to any Expert Advisor.

Plots the range of the Asian session and marks breakouts during the London session with arrows, stop and target levels, and alerts

Tick Scalper Helper is a manual trading utility for traders who work on very short time frames and want to see every price change.

Draws the daily opening range and its breakout levels, with a dashboard showing how the range resolved over your lookback: broken up, down, both ways or not at all, and how often a breakout hit its target before the opposite side.

Prop Firm Guard Panel is an on-chart panel for prop firm challenges and funded accounts. It shows in real time the daily loss used and the room left, the max loss room and equity floor, and the progress toward the profit target. The start-of-day balance is rebuilt from today's closed deals, so the values stay correct after a restart. Colors change from green to orange to red as limits get closer, with optional popup and push alerts. Auto, dark or light theme. Display only: it never opens, modifies or closes trades.

Mouse Scroll Zoom in Zoom Out

Trending up, trending down or ranging: a verdict for every bar, and how long it has held. Each stretch of one regime is boxed on the price chart, ADX columns below show how strong it is, and a one-line panel gives the regime, its age and the ADX. Values for Expert Advisors and an alert on closed bars.

Reads your closed positions and the M1 bars after each exit. Shows how many stopped-out trades later reached their take profit, how far take-profit trades kept running and how much move was left after manual or EA exits. Summary panel, per-position log table and CSV.

Free educational EA — a single-position trend-following EMA crossover system for XAUUSD M30, released as open source for beginners to study trade ownership guards, preflight order validation, risk-based lot sizing, and server-time session filtering. This code demonstrates how a strategy - identifies and manages only its own positions and orders through MagicNumber and comment tags, - wraps CTrade with an OrderCheck preflight that blocks invalid or margin-breaking requests, - sizes each trade from a fixed stop-loss and risk percentage, - and restricts entries to a configurable broker session window with a daily close-all — all evaluated on completed bars only, so signals never repaint.

Non-repainting fair value gaps on closed bars, with zone states (active, touched, mitigated) and iCustom buffers for EAs.

Real-time daily drawdown buffer monitor and exact breach price line indicator for prop firm accounts. Features 00:00 server-time deal history reconstruction (including entry commissions), 00:00 HWM snapshot locking, two-stage OrderCalcProfit cross-rate calibration, and iCustom() data buffers for Expert Advisors.

See the real leverage of every Market Watch symbol, including floating margin tiers, with swap, commission and live spread in one panel.

Watches the whole account and closes everything before the daily loss or max drawdown limit is breached, then keeps the account flat until the block ends. Does not trade.

Expert Advisor template that shows safe execution practices: closed-bar signals once per bar, no duplicate entries after an MT5 or VPS restart, spread and stop-level checks, normalised volume and a log line for every decision.

Shows the current spread next to its recent average and maximum and compares it with ATR, so you can see at a glance when trading costs are too high relative to the symbol's normal movement.

123456789101112...217