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

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
latest | best

A channel using a non-smooth and steady approximation error, in which the exponential moving average with a variable smoothing factor is used as the midline.

The EA determines the overbought (OB) and oversold (OS) zones, for which it generates trading signals for selling or buying.

Indicator StopLoss Calculator.


Indicator Trend Quality.


Indicator Price Cycle.


Indicator MI (Mass Index).


Indicator Arms' Ease of Movement Value (EMV).

Exponential moving average with a variable smoothing factor.

The Coppock Indicator of Bullish Signals.

Average Modified Moving Average.

Sherman and Marian McClellan Summation Index.

Sherman and Marian McClellan Advances/Declines Indicator.

Sherman and Marian McClellan Oscillator.

A script for showing the swap value on a financial instrument. The texts of positive and negative swaps are shown in different colors.

Trading on indicator Heiken Ashi Smoothed Oscillator. Settings for placing Stop Loss, Take Profit, and Trailing the positions.

Working with pending Buy Limit and Sell Limit orders. Trailing the positions is possible.

Sherman and Marian McClellan Ratio Adjusted Net Advances Indicator.

John Ehlers Modeling The Market Indicator.

An Expert Advisor based on indicator SAR.

A financial asset strength indicator as a candlestick chart.

The EA uses indicator Awesome Oscillator.

A trading system based on detecting the market volatility.

A trading system based on the KWAN_RDP indicator signals.

A trading system based on the KWAN_CCC indicator signals.

Placing Buy Stop and Sell Stop on the 5-minute timeframe.

A trading system based on the KWAN_NRP indicator signals.

Indicator XStdDevSpeed with the timeframe selection option in input parameters.

Smoothed standard deviation changing rate.

Indicator SSL2 with the timeframe selection option available in input parameters.

Two different-period indicators SSL, implemented as a colored cloud.

The Expert Advisor places pending Buy Stop and Sell Stop orders. If orders execute, the trailing stop is run for the positions.

An assistant Expert Advisor. It moves positions to a breakeven and then enables trailing.

The EA compares the opening prices of the zeroth and the second bar. It moves positions to a breakeven and/or enables trailing.

The EA uses a virtual Take Profit for closing gaining positions. Opening positions with a step. Catch the type of the last position and its price in OnTradeTransaction.

A trading system based on indicator signals Parabolic Stop and Reverse system with the possibility to set a fixed position holding time.

The EA is based on Moving Average.mq5 from standard delivery. Working with OnTradeTransaction to get the price of the last closed position.

Indicator iSAR with the timeframe selection option in input parameters, implemented in color, with the possibility to generate alerts when the trend changes its direction.

The EA based on two iMA (Moving Average, MA) indicators. Selecting the lot calculation mode: Manually or in the risk percentage per trade. Position trailing.

Indicator 2XMA_Ichimoku_Oscillator with the timeframe selection option available in input parameters.

An oscillator based on the difference of two smoothed, different-period Tenkan-Sen lines in form of a colored histogram.