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 - 18

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

Classical Sudoku puzzle right in MetaTrader chart.

Trading the trend

Prices truncated to pips.

Multi-asset cluster indicator taking all currencies as a sum of values forming a whole market, that is unity (1.0)

Range BreakOut EA. The range is defined by the min number of bars and max width in pips. This expert advisor is designed with visual strategy builder - Mission Automate. Code is generated automatically. More info: https://www.mql5.com/en/articles/4951

Grid system with limit orders. This expert advisor is designed with visual strategy builder - Mission Automate. Code is generated automatically. More info: https://www.mql5.com/en/articles/4951

Adaptive (ema) deviation

Classic strategy based on Parabolic SAR indicator. With Auto Lot options and Trailing Stop. This expert advisor is designed with visual strategy builder - Mission Automate. Code is generated automatically. More info: https://www.mql5.com/en/articles/4951

This utility is not a trading information utility. It will only have value for those getting information on the Number of Bars that have terminal data. This utility uses the functions SeriesIntegerInfo and CopyRates to obtain and display information about the availability of bar information from the terminal.

Very popular but dangerous strategy which doubles the stakes after each loosing trade. Finally, if there is enough margin it will reverse into the direction of the current price move and will eventually close in profit. This expert advisor is designed with visual strategy builder - Mission Automate. Code is generated automatically. More info: https://www.mql5.com/en/articles/4951

Classic trading strategy based on RSI levels. Buys when RSI is oversold and sells when RSI is overbought. This expert advisor is designed with visual strategy builder - Mission Automate. Code is generated automatically. More info: https://www.mql5.com/en/articles/4951

This utility is not a trading or market information utility. This will likely only interest those writing (or debugging) indicators using multiple timeframes and collecting information using Bars (or iBars) and CopyRates. The utility creates a list showing the number of Bars reported by the "Bars" function and shows the success of CopyRates for any selected bar by displaying that bar's time from the collected data (or, it shows the error).

Classic and one of the most popular trading strategies based on 2 moving averages crossover. This expert advisor is designed with visual strategy builder - Mission Automate. Code is generated automatically. More info: https://www.mql5.com/en/articles/4951

Arrow trends by iBearsPower and iBullsPower indicator for MT5

The utility will display the high, low, open, close and time statistics for any user selected bar of any timeframe for the symbol of the chart the utility resides on.

This utility allows monitoring of multiple symbols and positions on one chart with one-click switching of the chart symbol.

Indicator Bears and Bulls Power for MT5 together in one separate window.

The code consists of lines created according to the opening, closing, low and high values of prices.

Three Moving Averages Convergence/Divergence - Indicator for MT5

Export tool for OHLC prices, calculated prices & indicator buffers

Multi-asset cluster indicator taking all currencies as a sum of squares forming market unity (1.0)

This indicator shows average and peak speeds of price changes per minute.

Improved version based on RSI_candles by © mladen 2018 https://www.mql5.com/en/code/20968

Smoothed CCI

Random number generation using the 32-bit PCG generator.

Advisor for trading Gbp/Chf. Algorithm for bar opening prices. Timeframe H1.

This indi will draw OBJ_ARROW_BUY/OBJ_ARROW_SELL when find signals on Arrow Indi Buffers.

A fast library for combinations and permutations in MQL.

The script exports summary of closed trades grouped by each trading day to .csv file

Variance (Welford’s method for computing)

The script exports summary of closed trades grouped by each currency pair to .csv file

A script to close all market positions and/or pending orders.

This script will change the SL and TP of all open trades of the symbol to the price where the script is dropped off.

Sell Relative Strengt Index (SRSI)

ATR

Average true range

BB stops of MACD with multiple stops

XO

XO

Hull moving average

The Expert Advisor uses four iMA (Moving Average, MA) indicators from two timeframes. Two indicators with averaging periods 1 and 8 are created on the H1 timeframe and two indicators with averaging periods 1 and 8 are also created on the H4 timeframe.

A class to reconstruct closed trades (paired in/out deals) from history sorted by close time.

1...111213141516171819202122232425...183