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

MQL5 Source Code Library for MetaTrader 5 - 2

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

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.

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.

Utility MT5 EA that sends BUY/SELL deal notifications to Telegram via Bot API (WebRequest)

The script provides a quick estimation of an exponent/power factor for transformation of variable-length price increments into uniform distibution, that makes them a "random walk". The estimated value characterizes current symbol as more profitable when using in a particular trading strategy.

This is a simple price channel indicator allowing user to customize period and line colours. Often used in channel break strategies.

This function gives me the shortened names of the timeframes Example: "M1" instead of "PERIOD_M1"

It's like a bird's-eye view for BBMA Oma Ally fans. ust drag it onto the chart and you'll get all the BBMA signals running on the chart.

Securing data transfer between client and Server could be a big challenge for you as MQL5 programmer. You may have experience in using built in MQL5 encryption systems like AES.AES can securely encrypt your data but on the other hand is not secure when it comes to sending the AES key through insecure channels. You can only rely on asymmetric encryption systems Like RSA in such cases. you keep the private key at your server side and only share the public key with your clients. Even more you can use hybrid RSA_AES approach to archive more performance

Multisymbol OnTick.

iMy

In the graphical representation, techanalysis represents the trend line to the right of the candles on the breakdown (in green). After the breakdown, the movement along the red line is assumed.

Fox Wave Clean - Professional Order Manager Professional EA for efficient trade management with one-click position control. Clean design, powerful functionality.

A simple indicator based on Bollinger Bands showing its narrowing and widening phases with red/green colours.

The indicator is written by request on the forum.

Structure of input parameters

The Expert Advisor works with pending orders Buy Stop and Sell Stop according to the time specified in its input parameters.

The simplest Expert Advisor that analyses the price movement on a given number of bars and opens a corresponding position.

Library for trading session control. At startup it counts the time of trading sessions for all 7 days of the week (on Sat and Sun there can be cryptocurrency trading), up to 10 sessions per day. Then in OnTick() you can do checks, and if a tick came in outside the trading session, you can exit further processing of it.

Overview Grid Master EA is an automated trading system that implements a bidirectional grid strategy. It places multiple pending orders above and below the current market price, capturing profits from market oscillations in both directions.

123456789...195