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

ICE Pro v1.0: Momentum Intelligence System. ICE bukan sekadar EA (Expert Advisor) berbasis indikator statis. Ini adalah mesin Adaptive Trading yang menggunakan volatilitas (ATR) dan profil volume sebagai filter utama untuk menyaring mana pergerakan harga yang merupakan "Impuls Sejati" dan mana yang hanya "Market Noise".

Overbought and oversold indicators aim to determine where the price may experience a reversal.

Function of lot calculation by risk percentage

Find Perfect Timeframe to trade

WPR indicator in chart window with TPSL

ZigZag BOS CHoCH Detection indicator is based on the original MetaQuotes ZigZag algorithm and extends it by detecting and marking market structure events. It tracks recent ZigZag swing points and automatically identifies Break of Structure (BOS) and Change of Character (CHoCH) using pivot trend confirmation. BOS and CHoCH levels are drawn directly on the chart with labeled horizontal lines for clearer price action analysis.

This indicator combine WPR and total profit/loss. I don't know how to tell you more about this indicator but you can try it.

Production-ready multi-timeframe RSI scanner with intelligent alert retry system. Monitors up to 7 timeframes simultaneously, highlights convergence zones when 3+ TFs align, and now auto-retries failed notifications to ensure you never miss critical overbought/oversold setups.

Indicator Description – Candle Close Timer Name: Candle Close Timer Version: 1.0 Author: BENTRADE TRADING Link: https://www.mql5.com/en/users/dahmi_benali

Download all OHLC data history available and save it in a file, either for just one symbol or for many in Market Watch

Adaptive Support & Resistance indicator that automatically detects, tracks, and updates the nearest valid S/R levels using configurable confirmation bars. Levels dynamically shift after confirmed breakouts and extend forward in real time.

Price Action Day Trader is a robust, trend-following MQL5 Expert Advisor designed for intraday trading. It focuses on high-probability price action patterns Pin Bars, Engulfing Candles, and Inside Bar Breakouts while filtering trades through a dual Moving Average trend filter.

This is a service to show entry/exit points of existing positions/deals as trend lines and/or arrows on charts.

If you have access to the Expert Advisor code, you can save balance and equity charts and calculate additional optimization criteria by adding additional code from this library.

A simple binary trading strategy that counts candle colors.

Works using a positive lock; the trading robot creates one positive lock, and the trader decides what to do with it.

Allow the EA to determine whether there are duplicate EAs on the chart based on conditions.

This script serves as a practical example of how developers can programmatically work with files using MQL5. One of its key objectives is to demonstrate effective project file organization, which is essential for developers working on large-scale systems or aiming to create portable, self-contained projects. The concept can be expanded further and refined with additional ideas to support more advanced development workflows.

Martingale trend detector use onnx AI

Market Structure Expert Advisor use LightGBM (Light Gradient Boosting Machine)

Automated trend-following EA using EMA, RSI, and Stochastic signals to open trades on the last closed candle with Stop Loss and Take Profit.

A professional on-chart panel for instant lot size and risk calculation. Essential for manual traders using strict risk management.

An advanced, institutional-grade trend-following engine using Z-Score adaptive volatility, smart money volume filters, and a real-time MTF dashboard.

The classic version of the Heads or Tails trading strategy with the analysis of the signal block code.

RiskSizer Panel Lite is a simple MT5 trading panel that calculates an estimated lot size based on your risk percent. Drag two chart lines to set SL/TP, then use one-click BUY/SELL for fast manual execution.

Log

Multi-Mode Logarithmic Transform Indicator.

adoption of Larry William's method using AI Time-Series XGBoost

Hover over any candle to see what MT5 doesn't show: Range size, Body percentage, Wick ratios. Smart, fast, and customizable.

Take it as profit guardian or market reversal detector. It is a script that acts as a safety net to protect profits when you're away. Instead of just waiting for a fixed Take Profit level, it monitors price behaviour and closes the trade if it shows signs of reversing before hitting your Take Profit.

The indicator calculates your risk as a percentage and gives you the lot size that is acceptable for your risk. You only need to specify the risk in per cent and the stop size in pips.

Real-time display of Binance quotes

Adaptive VWAP Institutional: Multi-Asset Auto-Detection & DST-Accurate Session Resets (Forex 5PM NY Standard).

A robust Market Structure analyzer that adapts to volatility. ASZ uses a Hybrid ATR engine to filter noise and detect reliable Swing points. Non-repainting on confirmed bars.

A lightweight chart overlay that paints a smooth “daylight” gradient across Pacific, Asia, London, and New York sessions—plus optional session separators, event labels, and “sunray” highlights for scheduled news. Includes UTC/Broker/PC time modes and a manual DST shift.

Automates MQL5 buffer and plot index management. Eliminates manual counting, simplifies Z-order layering, and handles complex plot types (Candles, Color Lines) with a single line of code.

The Playground EA series was created for experimentation with Fair Value Gaps (FVGs) and liquidity concepts

A compact on-chart dashboard that monitors live spread behavior, tracks rolling Min/Max/Avg, and warns on abnormal spread spikes (news, low liquidity, rollover) using adaptive or fixed thresholds with optional alerts.

Scan multiple symbols and timeframes for wick-based rejection candles and display the latest signals in a clean on-chart dashboard with strength scoring, signal age, optional markers, and alerts.

This EA is intended to test a popular trading strategy. My own backtest shows that this strategy does not work as it was intended

A chart-based risk monitor for prop-firm style rules: draws a live “Dead-Line” price level showing where your Daily Loss Limit or Overall Max Drawdown would be violated, based on equity, open exposure, and optional trailing drawdown.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195