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

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.


Something for those who wants to try out new Strategy Tester and don't have any EA.

The indicator plots Pivot levels for all available history. There are 5 variants of Pivot levels is supported: Classic, Fibonacci, Demark, Camarilla, Woodies. There are 3 calculation periods: daily, weekly, monthly. For the daily pivot levels it's possible to specify the GMT time shift.

The indicator plots Murrey Math Lines for all available history, it doesn't uses any objects.

The ZeroLag MACD indicator shows the histogram with color of the previous bar.

A simple XML-parser, based on the msxml library.

The indicator plots the Bollinger Bands ®, filled with different colors depending on the trend direction.

The indicator plots the candles with different colors depending on the trend direction and price movement.

This indicator draws pivot points, resistances and supports.

Classes for working with databases through ODBC and OLE DB interfaces

Indicator for Woodie’s CCI trading strategy.

Added colors to Parabolic SAR.

This indicator allows to see the activity of the market.

To demo buffer-pattern: Candles + Fractals + ZigzagColor + ColorMaLine.

Example of a tick chart.

This indicator is based on DRAW_FILLING buffers. The input parameters are absent, the TimeTradeServer(), TimeGMT() functions are used.

It's a well-known indicator that shows maximal and minimal prices (and average values) of the last n bars.

Here is a simple example that shows how to download page(file) from Internet using the library wininet.dll.

The script provides a synchronous scrolling for all charts opened in the client terminal.

Draws 96 line MAs with only 100 lines of code (uses CMyBuffer class).

The indicator prints the time to close of the current timeframe, if it less than H1, it also prints the time to close of the current hourly bar.

The library contains functions that returns description of runtime error codes and trade server return codes.

A very simple sample of clock

The MovingAverages library contains functions for calculation of different types of moving averages.

It's an oscillator of the overbought/oversold market conditions. It can also be used as the Momentum indicator. Triple smoothing is used for removing the cyclic components in price movements with the period less than that of TRIX.

This oscillator measures the ratio between the sum of positive increments and sum of negative increments for a certain period.

TEMA can be used instead of traditional moving averages. It can be used for smoothing price data, as well as for smoothing other indicators.

It is used for smoothing price series and is applied directly on a price chart of a financial security.

The advantage of FRAMA is the possibility to follow strong trend movements and to sufficiently slow down at the moments of price consolidation.

This is a simple example of user interface of information system with possibility to trade by pressing a button.

The script illustrates control of chart properties using the classes from the Standard Library (CChart).

The script illustrates control of graphic objects using the classes from the Standard Library.

An indicator lets you specify the number of bars separately before and after the current High / Low (fractal) can.

The Bulls Power Indicator measures the balance of the bulls strength.

This is a modified version of ZigZag indicator that draws lines with different colors depending on the price movement direction.

The Zigzag indicator is a series of sections connecting significant tops and bottoms at the price plot.

The Williams’ Percent Range Indicator (%R) is dynamic technical indicator, which determines whether the market is overbought/oversold.

The Williams' A/D indicator is the accumulated sum of positive "accumulational" and negative "distributional" price movements. Divergences between the indicator and the price are a signals.

The Volume Rate of Change (VROC) is an indicator of the direction where the volume trend moves.

The Volumes indicator shows volumes with different colors depending on the volume changes.

The Ultimate Oscillator was developed by Larry Williams. It uses the averaging of three oscillators with different periods.