Watch how to download trading robots for free
Find us on Facebook!
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

MQL4 and MQL5 Source Code Library

icon

You don't know where to start learning the MQL5 or MQL4 programming language? Various programs for your MetaTrader terminal are available here. Download and study published code examples, develop your own indicators and Expert Advisors. Publish your applications in the largest library of MQL5 and MQL4 codes, and they will be available in every MetaTrader terminal and MetaEditor.

Your code examples in MQL4 and MQL5 will be distributed worldwide, and thousands of traders will know about you!

Submit your code

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

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.

Take control of your trading performance with the Pro Dashboard Screener Designed for serious traders, this utility provides a clean, professional, and real-time overview of your account's health directly on your chart.

Most channel indicators tell you where the breakout level is. This one tells you how far away from it you are, right now, in a form you can act on. The panel shows, for both the upper and the lower channel edge: the level itself the distance from the current price, in the symbol's own price units the same distance expressed in ATR units a proximity bar that fills as price approaches the trigger Why the ATR column matters. A distance of 8 dollars from a breakout means something completely different in a quiet Asian session than it does during a news release. Dividing the distance by the current ATR makes the number comparable across sessions, across volatility regimes and across symbols. A reading of 0.30 ATR means the same thing on gold as it does on EURUSD. Colour coding: normal text : more than InpNearATR away (default 1.0 ATR) gold : within InpNearATR orange red : within InpVeryNearATR (default 0.5 ATR)

The Draw On Liquidity (DOL) indicator automatically plots these essential levels on your chart and highlights high-probability trading windows through session kill zones. With full customization options, it provides a clean, professional, and highly informative display to enhance your trading decisions.

Asian Session Breakout identifies the price range formed during the Asian trading session and monitors how price behaves after that session ends. The Asian High and Asian Low remain extended until the end of the broker trading day. This makes the range useful as an intraday support-and-resistance zone during the European and US sessions. A compact dashboard displays the current range values, configured session time, breakout status, breakout confirmation method, and confirmation timeframe. The indicator does not open or manage trades. It provides market structure and breakout information for discretionary trading or EA development.

A simple indicator based on trend criteria

An institutional-grade order flow and footprint chart indicator ported from Pine Script to MQL5. It dynamically deconstructs major timeframe bars using lower timeframe (LTF) historical tick/real volume to compute buy/sell volume delta at each price level. The indicator features automatic timeframe selection, Point of Control (POC) highlighting, Stacked Imbalances, extreme Absorption detection, Unfinished Business (UB) tracking with live mitigation, and real-time alert triggers.

Value Area Levels is a session-based Value Area indicator for MetaTrader 5. It calculates and displays Value Area High, Point of Control, and Value Area Low levels for the developing, previous, and historical profiles.

This release introduces a lightweight automated trading prototype built on top of the Interactive Supply and Demand Zone Manager framework. The framework allows traders to draw and manage their own supply and demand zones, while each zone maintains its own lifecycle, interaction history, and evolving state as market conditions change. The hybrid approach combines user-defined zones with automated monitoring, validation, and trade management. The strategy evaluates qualified zones through a structured decision process before generating trade actions. Detailed logging provides visibility into zone behaviour, allowing traders to study interactions and build their own approaches using the collected information.

Computes the historical Pearson correlation between any set of instruments and the combined margin your account would need to hold all of them at once, as a percentage of your equity. Runs natively in MetaTrader 5 with no external libraries, no Python, and no AI — set your symbol list and lot sizes as inputs and it reports the full matrix in the Experts tab and on the chart, refreshing on a timer.

Volume Strength Compass is a volume-analysis indicator for MetaTrader 5 that evaluates market activity using Relative Volume, candle body strength, close position, and volume intensity. The indicator classifies each candle into different volume conditions such as normal volume, low volume, high volume,climax volume, bullish effort, bearish effort, and absorption. The results are displayed using colored volume columns, background highlights, signal labels, an average-volume line, and a real-time dashboard. The indicator can use tick volume, real volume, or automatically select real volume when available. It also supports alerts on either the current live candle or after candle closure.

SMMA Levels MTF is a multi-timeframe Smoothed Moving Average indicator for MetaTrader 5. The indicator calculates SMMA values from several selectable timeframes and displays them together on the current chart.

Pivot SuperTrend BhanuCodeLab is a trend-following indicator that combines confirmed pivot points with an ATR-based trailing trend line to identify market direction, trend reversals, and potential BUY or SELL signals.

An institutional-grade trading journal and behavioral analytics suite designed to run entirely inside MetaTrader 5. The application is built as a single-file, zero-dependency dashboard that replaces standard terminal objects with a high-performance, double-buffered vector graphics pipeline (CCanvas). It provides real-time quantitative analysis, behavioral risk auditing, a vertical scrollable monthly calendar, and interactive log cards with inline note editing directly on the chart.

This indicator is essentially a GPS based on envelope as channel gauging and weather radar for the market wrapped into one. Instead of just giving you a bunch of lines to guess at, it calculates the mathematical "stretch" of the market and combines it with a multi-timeframe trend analysis to tell you exactly where you are. if price is outside band it is some fundamental shift in momentum happening if you are on wrong side then quit and stay away or go with trend on pull backs

MACD indicator replicating TradingView’s visual style for MT5. 4-colour histogram, SMA-based signal line — values match TradingView bar-for-bar.

This indicator displays the smoothed value of the linear trend

Dynamic approach vastly outperforms relying on a single MA.

Educational MT5 Expert Advisor using completed-candle EMA 9/21 alignment and RSI 14 filtering, with fixed-lot execution and a compact black-and-gold dashboard.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201