Watch how to download trading robots for free
Find us on Telegram!
Join our fan page
Access the CodeBase from your MetaTrader 5 terminal
Couldn't find the right code? Order it in the Freelance section
How to Write an Expert Advisor or an Indicator

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

Displays a complete trading statistics table directly on the chart — Net Profit, Profit Factor, Drawdown, Win Rate and more — calculated from your full account history. Purely informational, free for everyone.

Locks in the high and low of any user-defined session — Asian, London, New York, or a fully custom window — and draws it on the chart as a live-updating box or line pair. No repainting, no discretion — the range is measured directly from the bars, not estimated.

Professional open-source Candle Countdown for MetaTrader 5. Displays a live digital candle timer, progress bar, elapsed and remaining time, market status and configurable countdown alerts with a modern Quantora dashboard.

Professional open-source Margin Calculator for MetaTrader 5. Calculates required margin, Free Margin impact, Margin Level, position value and margin safety with a modern Quantora dashboard.

Professional open-source Risk Calculator for MetaTrader 5. Calculates money risk, account risk percentage, potential profit, Reward-to-Risk ratio, margin requirement and risk level.

Professional open-source Position Size Calculator for MetaTrader 5. Calculates broker-compatible lot size using account value, risk percentage, fixed risk amount and Stop Loss distance.

Professional open-source Trailing Stop manager for MetaTrader 5 with adjustable start, distance, step, profit filter, Magic Number filtering and a modern Quantora dashboard.

Professional open-source Break Even manager for MetaTrader 5. Automatically moves Stop Loss to Break Even with adjustable trigger, offset, Magic Number filtering and a modern Quantora dashboard.

Professional open-source trade management utility for MetaTrader 5. Automatically manages Stop Loss, Take Profit, Break Even and Trailing Stop for existing positions while providing a professional real-time dashboard.

The Spread Monitor is a professional statistical dashboard that evaluates the current market spread relative to its recent historical behavior. Instead of simply displaying the current spread, it determines whether the spread is unusually high, unusually low, or within its normal statistical range.

This is a volatility regime indicator, displayed in a separate window below the chart. The core idea: it calculates a historical percentile of the current volatility (0-100%) and classifies the market into 5 "regimes" — from extreme calm to extreme chaos. On top of that, it has a full visual dashboard (a text panel on the chart) with a trading signal, SL/TP, MTF (multi-timeframe) filters, volume, VIX, and, in the current version, a probabilistic "confidence meter" score.

Global Macro Soros. A multi-timeframe trend-agreement indicator inspired by George Soros's macro trading style.

An Simple MQL5 trade management panel featuring drag-and-drop chart lines, dynamic lot sizing based on risk percentage, ATR/Point Stop Loss modes, and real-time floating P/L monitoring.

Bands StochRSI Extreme Reversal — spots mean-reversion signals where price closes back inside the Bollinger Band after Stochastic RSI hit an extreme zone, with an on-chart status panel.

The SMC Order Block Detector indicator features an Advanced Smart Money Concepts (SMC) Order Block (OB) Engine inspired by the TradingHub 3.0 methodology. It is specifically engineered to automatically detect, track, and manage institutional Order Blocks with high precision on MetaTrader 5. A key highlight of this indicator is its Smart Overlap Management: when new Order Blocks form and overlap with existing active zones, the algorithm intelligently evaluates their Fair Value Gap (FVG) sizes. It automatically filters out and deactivates weaker or redundant zones, ensuring that only the highest-probability institutional levels remain on your chart.

Read-only analytics for accounts that run several Expert Advisors. It groups closed trades by magic number and measures what running those systems together actually saves you: standalone versus combined drawdown, the pairwise correlation matrix drawn as a heat map on the chart, and a Monte Carlo reshuffle of the portfolio's period returns.

A MetaTrader 5 chart indicator that draws Heikin Ashi candles, confirmed buy and sell arrows, optional MACD histogram divergence filtering, and configurable alerts.

Locks in the Asian session range on XAUUSD, then places an OCO breakout pair (BuyStop/SellStop) for the London open, with ATR-based stops and risk-percent position sizing. No indicators, no discretion — the range is measured, not guessed.

This is an MQL5 custom indicator for MetaTrader 5 called RSI Histogram. It plots the standard RSI line in a separate window, plus a color-coded histogram version of the same RSI values that changes color based on momentum:

Extreme Value Theory (EVT) ported into MQL5 for gauging potential crashes and upsets in the market.

Shows average price range per hour of the trading day as an on-chart heatmap, plus Asian/London/New York session shading behind the candles — so you can see when a symbol actually moves, not just guess.

A lightweight on-chart dashboard that reads your closed trade history and shows win rate, profit factor, streaks, and an equity curve — no strategy inputs, just your own numbers, refreshed automatically.

A forecaster made from Symbolic Aggregate approXimation (SAX)

Session-Based Scalping Indicator for MetaTrader 5. It automatically marks the Asian session high and low, then generates scalping signals at the London open when price breaks or retests those levels. The indicator draws dynamic session ranges, sends alerts and push notifications, and includes optional trend, volume and time filters. Works on M1, M5 and M15 charts for any symbol.

An MQL5 implementation of all four cross-strategies from Bloch's Relative Moving Average framework, with his Adaptive Crossover Exit switching rules by volatility regime. Entries and exits are taken in fractile space, so thresholds mean the same thing on every symbol.

A faithful MQL5 port of Daniel Bloch's Relative Moving Average framework. It ranks the current close inside its own window's distribution on a [0, 1] scale comparable across symbols, publishing the fractiles, regime classification, and directional consistency as readable buffers.

Pro Manager is an all-in-one MT5 trading assistant built for prop firm and professional traders. Execute trades faster, manage positions smarter, control risk efficiently, and automate daily trading tasks with powerful tools such as Break-even, Average TP, Magic Number management, and Auto Grid.

SMC chart indicator: market structure (BOS/CHoCH), volume weighted order blocks, multi timeframe FVG, equal highs/lows, liquidity sweeps, premium/discount zones, a 3 time frame bias panel and an optional trade setup readout. Closed bar logic only (no repaint). It draws and alerts, it does not place trades.

What this indicator does Clock (Spread).mq5 is a MetaTrader 5 chart indicator that displays a small text label in the corner of the chart showing: Countdown timer until the current candle closes (in HH:MM:SS or MM:SS format, depending on timeframe) Current spread (Ask − Bid, in points), shown in parentheses next to the timer. Changelog: Version 2.20: - Spread now colors dynamically based on direction (green = increasing, red = decreasing) - Added configurable inputs for the spread colors

Draws parallel trend channels (Median, High, Low) on the current chart based on the last two closed candles of up to 7 higher timeframes (MN1, W1, D1, H4, H1, M30, M15), with individually configurable colors and line styles for each timeframe.

Advanced MQL5 risk management class providing deterministic lot sizing, auto-suffix detection, and cross-currency triangular conversion.

Overview Channel Sun Signals plots an adaptive, triangular-weighted moving-average channel (a center line plus an upper and lower band) around price, and marks potential reversal points where price pierces a band and then closes back inside it. It is built on the same "band-break-then-reversal" logic used by classic TMA/CG-style channel indicators, but rewritten natively for MT5 — including its own multi-timeframe engine that does not rely on iCustom() or an external .ex5 file, so the indicator works standalone once compiled.

Statistics on closed trades. The indicator shows trading results, filtered by magic number.

SteepMA V0.7 is a trend-following EA that uses ‘moving average steepness’ as its core entry criterion. It screens for high-certainty market conditions by quantifying trend strength, and locks in profits through a dynamic stop-loss system that tightens progressively. It also features a built-in SQLite database to ensure full traceability of the entire trading process.(Some code has been omitted to facilitate approval.)

Reads a closed-position trade history (a CSV file, or one generated automatically from the current account's deal history by the companion RuinExport.mq5 script) and reports four independent risk fingerprints: volume escalation after a loss, overlapping same-direction exposure that averages into a worse price, payoff asymmetry between wins and losses, and a classical risk-of-ruin estimate at a stated risk per trade. The four scores combine into a single A-to-F grade with plain-language recommendations. If no CSV is found, the script generates a reproducible demonstration book automatically, so the report is visible on the first run.

Smart Trend Score is a clean and lightweight MetaTrader 5 indicator designed to identify high-quality trading opportunities using multiple trend and momentum filters.

Session-Based Liquidity Breakout & Fibonacci Retracement Strategy (often used in Forex or Crypto trading). It simplifies trading by avoiding complex Smart Money Concepts (SMC) like Order Blocks or Fair Value Gaps, relying instead on Asian Session liquidity, timing (session open), and Fibonacci levels.

Stop trading retail noise. This is an institutional-grade, asynchronous multi-asset scanner. It combines True Fractal CHOCH, Z-Score volumetric anomalies, and Fair Value Gap (FVG) validation to detect high-probability Order Blocks without freezing your terminal.

The Nikkei 225 Gap Continuation EA is a MetaTrader 5 Expert Advisor that trades bullish and bearish continuation movements after the cash-session opening gap. It combines an opening-range breakout with VWAP confirmation, automatic risk-based position sizing, partial profit-taking, break-even management and a forced session exit. The EA supports both netting and hedging accounts.

BlueMoon EA is an MT5 Expert Advisor that combines EMA Envelope entries with adaptive basket management, progressive position sizing, spread filtering, drawdown protection, and automatic trade recovery for hedging accounts.

123456789101112...206