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

MQL5 Source Code Library for MetaTrader 5 - 3

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

Strategy based on the standard indicator iCHO (Chaikin Oscillator, CHO) and custom indicator 'CCIDualOnMA'

Panel based on CDialog class. Work on the current symbol. Deleting, setting Take Profit, setting Breakeven on a group of positions

This library allows you to create displays to easily output text information to the chart at the most optimal rate

Multiple runs/optimisations in Tester.

Construct a moving line with a polynomial of 4 degrees. Extrapolates the sinusoidal and its axial. The constructed lines remove one value at each bar and a sliding line of extrapolated values is constructed which is not redrawn.

Trading system by iMA indicator (Moving Average, MA). Development of MA Trend.

Algorithm cycle: when there are no open positions, open two opposite positions. Wait for both positions to close.

This Bot detects the open of a new candle on any set timeframe, thereby making it easier to run a one-time code, place trades and call other functions. The code is written in the OnTick() function.

Detecting the start of a new bar or candle in an Expert Advisor's OnTick() event handler.

Calendar - fundamental analysis on history and real-time.

Tester's single pass data.

A zigzag based on the trend change of the parabolic sar

This MT5 Expert Advisor combines multi-timeframe candlestick pattern analysis with fundamental event filtering to execute trades with disciplined risk management.

An indicator which attempts to highlight a ranging market area

This is a piece of code to add to an existing Expert advisor to track withdrawals from your account where the EA is running. It helps the user to monitor his or her withdrawals from a particular account.

This is the exact conversion from pine script code by LonesomeTheBlue.

This is an indicator that evaluates FVGs in the inputted "window_size" to detect momentum or trend strength.

A static zigzag which connects the intersections of a moving average crossover

A hybrid sorting algorithm that provide fast performance for sorting arrays of simple types, structures or object pointers.

A SuperTrend indicator that plots trend direction using ATR volatility to create dynamic support/resistance levels for MetaTrader 5.

This is a simple indicator to display histogram of custom bars' durations in minutes. Applicable for renko boxes, PnF, equivolume bars, etc.

The EA automatically trades based on trend and mean reversion signals with validated parameters.

Serialization and deserialization of the JSON format

Callback interface for timer

The T3 Indicator is an advanced moving average that combines six exponential moving averages to provide smoother price action with reduced lag compared to traditional moving averages.

Draw daily vertical lines plus the day of week labels on the chart.

BreakRevertPro EA merges breakout and mean reversion strategies with adaptive SL/TP and multi-timeframe ATR trailing stops for flexible trading in volatile markets.

Zig Zag indicator that relies only on a minimum % of retracement to each previous wave , and optionally , being bigger than a specific size measured in atr units.

A zigzag indicator that uses a single input to adjust the step size for detecting wave direction changes

The goal is to make the function readily available for any Telegram integration task in MQL5 development. By adding this file to your CodeBase, you can simply include it in your Expert Advisors and call the function directly from the included module. This eliminates the need to redevelop the code from scratch repeatedly, ensuring reusability across multiple projects.

Time to candle Close. Dynamic text colours. Optimised for back-testing.

Whether you’re running multiple trading robots simultaneously or just one sophisticated strategy, keeping track of each Expert Advisor’s performance can be surprisingly time-consuming. MetaTrader 5 (MT5) conveniently displays orders and positions in its “Toolbox,” but when numerous robots share the same account, it becomes harder to know which EA is generating your profits—or losses. A single account might have dozens or hundreds of trades, each opened by different EAs, making it difficult to separate the results of one robot from another.

Download all the ticks from your broker for all the symbols in the market watch. Download all history or until a specific date in the past if available.

These are some #define statements that are useful to perform operations in your EA. You only need to assign the name of your variables at the beginning of the file, and then let the other #define statements do the work. In order to use this file, add #include <DEFINE_statements.mqh> to the first line in your EA file.

The indicator plots two lines. The lower line is calculated based on the latest SMA period that caused a bounce up. The upper line is calculated based on the latest SMA period that caused a bounce down.

A simple starting-point script to collect data and send to a CSV in oldest-newest ordering. In this example only the close price data is collected.

PrintXYZ() library to print massive information from the terminal.

A script which when dragged onto the chart will print out in the experts window the number of bars that are on that chart - like magic.

An indicator which visualizes how volume changes over time within each bar. It shows tick volume in a rolling histogram format.

This Script & EA enables coders to backtest their news based strategies which use the MQL5 Calendar.

12345678910...189