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

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

DeltaFusion Lite is the simplified version of the DeltaFusionPro indicator for MT4. It calculates and displays Cumulative Delta and Net Delta, giving traders a clear view of buying and selling pressure within each candle. By analyzing the distribution of volume between bid and ask, it helps identify market sentiment shifts, potential reversals, and various types of divergences between price and volume.

Functions for use instead of ChartXYToTimePrice and ChartTimePriceToXY, working correctly and quickly over the entire range of input parameters

Source codes written in the process of developing a library for creating multi-currency Expert Advisors combining multiple instances of different trading strategies.

The indicator allows you to estimate the probability that the price has reached its maximum or minimum.

Working with keyboard data

This library is an updated version of the ErrorDescription.mqh library published by MetaQuotes, with some features included.

An example of a bot with an embedded machine learning model that is trained in python and saved in ONNX format.

The script calculates the autocorrelation and partial autocorrelation functions and displays them on a graph

Tillson T3 with EMA calculations done without auxiliary indicator buffers.

Script for displaying updating data on open positions.

This indicator builds a dynamic price channel using Gaussian smoothing to determine support and resistance lines. It calculates smoothed high and low price values for a given period, finds their extrema and displays three lines: upper resistance (maximum of smoothed high), lower support (minimum of smoothed low) and the middle line between them, forming an adaptive trading channel.

A simple signal indicator based on RSI and Moving Average. Draws Buy/Sell arrows when RSI is above/below 50 and Price is above/below MA.

A simple comment.

MT5 version of the indicator https://www.mql5.com/ru/code/25465

The script provides a set of functions for creating all standard graphical objects for use in your own developments. The functions presented in the script can be used "as is" or modified to your requirements.

The simplest indicator showing on the current symbol the price change in % since the opening of the trading session.

The two moving averages crossover strategy is one of the most common trading strategies in the financial market. It is based on the use of two moving averages (usually long and short term) and signals an entry into a position based on their crossover.

MULTI TF Confluence Index Stoch+RSI+MACD

Average Daily Range Indicator.

Closing martingale trades

Modern indicator that displays your daily trading statistics directly on your MT5 chart. Track your trading performance with a beautiful flat design panel showing lots traded, number of orders, and profit/loss for each day.

This script helps traders understand the distribution and breadth of candlesticks over a specific period, which can be useful in making trading decisions such as which Take Profit or Stop Loss to use based on historical values.

The Clean Market Watch script is a simple utility tool designed to quickly remove all symbols from your MetaTrader 5 Market Watch window with a single click. This is particularly useful when you want to start fresh with a clean workspace or when your Market Watch has become cluttered with too many symbols. Purpose Over time, traders often accumulate numerous symbols in their Market Watch window, making it difficult to focus on the instruments they actively trade. Manually removing symbols one by one can be tedious and time-consuming. This script automates the entire process, clearing all symbols in seconds.

EA Tools tính toán Margin theo lotsize, có thể tùy chỉnh đòn bẩy

The Open Range Breakout (ORB) indicator is a powerful technical analysis tool that identifies and tracks price breakouts from the opening range of trading sessions. This indicator is based on the concept that the high and low prices established during the first minutes of a trading session often serve as significant support and resistance levels throughout the remainder of the day. The indicator automatically calculates the opening range based on user-defined time periods, plots multiple price targets, and provides visual and audio alerts for potential trading opportunities. It is designed to help traders identify high-probability breakout trades and retest scenarios.

A simple Expert Advisor that trades when the price forms the "Three From Within" pattern.

A volatility filter based on 3 ATR's: a fast ATR, a middle ATR, and a slow ATR

It is a zigzag which creates new zigzag turning points based on passing a volatility threshold

It is a script to display the time remaining until next bar arrives.

Probability Theory Advisor

KopierMaschine is a local copier of trades between different MetaTrader 4 and MetaTrader 5 accounts in any direction located on one computer with an intuitive interface.

This indicator calculates and displays the Exponential Moving Average (EMA) on the MetaTrader 5 chart. Fully customisable period. Allows selection of the applied price (Close, Open, High, Low, Median, Typical, Weighted). Uses the standard EMA formula, initialised from an SMA of the first bars. Can be used as a standalone technical analysis tool or integrated into automated trading systems for trend-following and moving average crossover strategies.

Lightweight CVD (Cumulative Volume Delta) for MT5 — M1-based, shows buy/sell pressure as candles with optional resets.

One of the simpler chips for machine learning

A simple signal indicator based on RSI and Moving Average. Plots Buy/Sell arrows when RSI is above/below 50 and Price is above/below the MA.

WaveWeisBarForce is a custom indicator based on Weis Waves logic. It accumulates volume into directional waves (bullish or bearish) and displays them as histograms with intensity levels. Bullish waves: 4 levels of green, from light to Lime. Bearish waves: 4 levels of red, from light to Red. WaveMax (white): shows the bar with the highest volume inside each wave. WaveClimax (yellow): highlights record accumulated volume across waves. This indicator helps traders visualise market pressure by volume accumulation and wave intensity, improving intraday and swing analysis.

The goal is to show a code that shows the calculation of the ATR with Wilder smoothing

Expert Advisor based on iPinBar Pin Bar Finder + several different trailing indicators

A simple strategy based on the signals of two indicators: Williams' Percent Range (WPR) and Bollinger Bands (BB). A position is opened only when the signals of both indicators coincide.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193