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

Bidirectional grid EA for Gold (XAUUSD). Ideal for ProCent accounts. Includes Daily Profit Target and Max Drawdown protection.

BEC Trade Manager helps you manage active positions on the current symbol using one-click controls for breakeven, trailing logic, partial close, stop-loss removal, profit-side closing, loss-side closing, and fast scalp entries. It also displays key account and symbol information on the chart, including equity, floating profit, daily profit, stop-loss labels, and basket breakeven preview.

One-click trade panel for MT5 and MT4. Manage entries, exits, SL, TP, pending orders and partial closes without touching the keyboard.

This mini custom-built MetaTrader 5 dashboard is a robust, comprehensive risk management and performance based monitoring tool and utility created to give both Prop firm and personal funded traders full visibility and control over their trading activity in real time.

RSI Grid Overlap Pro is a professional MT5 Expert Advisor combining RSI-based market entries with an adaptive grid recovery system. It features intelligent overlap order management to reduce drawdown, plus virtual trailing stop, breakeven, and three lot sizing modes — fixed, balance-proportional, and risk-based — making it suitable for both conservative and aggressive trading styles.

Economic calendar trading guard library for MetaTrader 5 with live MQL5 Calendar API integration.

A Market Structure indicator featuring Fibonacci Intelligence to provide accurate Buy/Sell signals.

Symbol Summary is an MT5 service that opens a separate viewer window and displays a detailed report for a trading symbol. It supports Russian and English, window resizing, scrolling, and automatic report updates when the watched chart changes symbol or timeframe, without restarting the service.

BEC is an advanced trade management Expert Advisor designed to automate breakeven, trailing stop, and position control — all from a powerful on-chart dashboard.

ASQ PropGuard is a real-time prop firm rule monitor for MetaTrader 5. It tracks daily loss limits, maximum drawdown, profit targets, and trading day requirements — all displayed on a dark-themed chart overlay with color-coded progress bars and a live pass/fail verdict.

Hon-Matrix is an advanced algorithmic trading system that combines Price Action, Volatility Analysis, and Real-Time News Filtering. Unlike standard "static" EAs, Hon-Matrix utilises a dynamic decision-making engine that identifies the current market phase (Trending vs. Ranging) and switches its entry logic accordingly. It features a professional-grade on-chart dashboard allowing for live parameter adjustments without restarting the EA, making it a powerful tool for both automated prop-firm passing and personal capital growth.

An unsupervised machine learning indicator that applies the K-Means clustering algorithm to historical price action, mathematically detecting and plotting the true institutional liquidity pools without human bias.

A multi timeframe indicator which features RSI divergence. + Buy/Sell signals Inspired from trading view.

Hon-APS (Advanced Pattern Scanner) is a sophisticated, open-source Expert Advisor for MT5. Unlike typical retail bots relying on lagging indicators, Hon-APS trades structural breakouts backed by quantitative Order Flow algorithms. It actively scans for classical chart patterns (e.g., Head & Shoulders, Bottoms, Triangles) and validates entries using L2 Order Book absorption and bid/ask imbalances. Complete with a polished on-chart UI, true Kelly Criterion risk management, and a robust macroeconomic news scraper, it's designed for prop-firm viability and high-end capital preservation.

A comprehensive stop-loss and trade management module offering multiple stop-loss methods (Fixed Pips, ATR-based, Swing High/Low, and Percentage) and trailing stop options (Fixed, ATR, Step, and Breakeven). It includes automatic broker stop-level adjustment, risk-reward–based take profit calculation, and visual stop-loss lines on the chart. The code follows a clean, structured architecture with a dedicated `CStopLossManager` class, standardized enums and structures, and fully documented English comments for clarity and maintainability.

KSQ Command Centre is a production-ready, two-way bridge between MetaTrader 5 and Google Sheets. It was originally designed to help fund managers and quantitative traders remotely monitor and manage large, funded accounts (e.g., Darwinex Zero, Prop Firms, PAM, MAM) directly from a mobile browser, without needing to log in to a VPS. This Expert Advisor not only exports data—it actively listens for commands typed into your Google Sheet and executes them in MT5 in near real-time.

ASQ CommandDesk is a professional order management panel for manual traders on MetaTrader 5. You make the trading decisions — CommandDesk handles execution, risk control, and exit management automatically.

On-chart candle analysis indicator with structure tags, sentiment, and trend arrows for MetaTrader 5.

An advanced quantitative filter based on Chaos Theory and fractal geometry, it calculates the intrinsic dimensionality of the price curve to instantly classify market regimes into trending or mean-reverting states.

Imbalance Finder is an MT5 indicator that automatically detects bullish and bearish Fair Value Gaps (FVGs) and tracks whether each imbalance remains active, gets tapped, or becomes fully filled. It draws clear chart zones in real time, helps traders identify potential support and resistance areas, and also provides data buffers for Expert Advisors and automated strategies.

Institutional prop firm protection library for MetaTrader 5.

Intelligent anti-tilt risk management library for MetaTrader 5.

An indicator which features full Smart Money Concept (SMC) + Break Of Structure (BOS) + Change Of Character (COC) + Fair Value Gap (FVG) Detection and Buy/Sell signals.

Professional Telegram integration library for MetaTrader 5 EAs.

Runtime trade frequency adjustment library for MetaTrader 5.

Institutional risk analysis library for MetaTrader 5. Zero external dependencies. Pure MQL5 mathematics.

Centralized indicator handle management library for MetaTrader 5 EAs.

Line to change direction

KSQ Fair Value Gap EA automatically trades institutional FVG zones with built-in regime detection to filter out low-quality setups in ranging markets. STRATEGY Detects 3-bar bullish and bearish FVG patterns. Enters on confirmed pullbacks into the zone. Each FVG fires once only. REGIME FILTER EMA trend bias, ADX strength filter, or both combined. Configurable higher timeframe (M15–D1). SL & TP Both support ATR-based or fixed-points mode, set independently. LOT SIZING Fixed lot or % risk-based — switchable from inputs. TRADE MANAGEMENT Break-even stop, partial close, and ATR/points trailing stop. RISK PROTECTION Daily and total drawdown kill switches. Max trades per direction cap. Session time filter. It's not yet optimised for any pair

MT5 indicator showing bar index, price difference in points, and percentage change. Ideal for EA integration and fast analysis.

Complete deep learning library in pure MQL5. Build, train and deploy neural networks natively in MetaTrader 5. No DLLs, no Python, no external APIs.

Detects and draws Fair Value Gaps (price imbalances) on your chart — a core concept in ICT/Smart Money methodology. Tracks when price returns to fill the gap.

An object-oriented MQL5 library (.mqh) that replaces static retail risk models with institutional Volatility-Adjusted Position Sizing (VAPS) and Kelly Criterion mathematics.

ExMachina CandleTimer Lite - Free candle countdown timer for MetaTrader 5 with the ExMachina steel palette theme.

A quantitative machine learning envelope that utilizes Nadaraya-Watson kernel regression math to dynamically project statistically significant mean-reversion zones without relying on traditional standard deviation.

An indicator to watch highs/lows of all markets simultaneously.

A quantitative Gaussian filter designed to replace lagging retail moving averages by applying advanced digital signal processing to eliminate market noise without sacrificing responsiveness.

One-click CSV export of trade history with P&L, duration & stats

Real-time spread monitor with statistics panel, CSV logging & alerts

Portfolio Scorer is a standalone MQL5 script that evaluates the quality of a multi-EA portfolio across three critical dimensions that most algo traders overlook. The script reads daily profit and loss data from CSV files (one per Expert Advisor), computes a full Pearson correlation matrix between every strategy pair, maps trading activity by UTC hour and weekday, detects asset class diversity, and produces a weighted composite score with a letter grade from A+ to F. How it works: The tool runs in four sequential stages. First, the Data Loader reads and validates CSV files containing daily returns for each EA in the portfolio. Second, the Correlation Engine calculates the complete NxN Pearson correlation matrix and flags pairs that exceed a configurable threshold. Third, the Coverage Analyzer maps which hours and weekdays have active trading and identifies blind spots. Fourth, the Scoring Function combines all three dimensions into a single composite score using adjustable weights.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197