Download MetaTrader 5

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

MQL4 Source Code Library for MetaTrader 4 - 7

The largest library features codes of free trading Expert Advisors, technical indicators and scripts. With the available applications you can trade in automated mode and analyze price dynamics. Use the library of codes to learn more about financial market sentiments.

Download free applications, test them and run in your MetaTrader 4. You can access them from the MetaTrader 4 platform and the MetaEditor development environment.


As I'm currently developing an Expert Advisor for Crude Oil and Brent, I wanted to get from the exact date and time of the 'Crude Oil Inventory' report. This report is typically issued on Wednesday's at 10:30am Eastern but when there's a holiday, the release date can change. As this is an important report for my EA, the only way was to check an online service to validate the release date.

In the futures markets data on trade volumes a reported with a one day delay. To compensate for this, many analysts use the tick volume indicator (tick volume).

The Universal_1.64 EA. It has a lot of settings.

Parabolic SAR Indicator was developed for analyzing the trending markets.

The Ang Autoch HL.v1 indicator. Draws a channel.

The indicator colors rising and falling candlesticks.

The XOdiagram 1 indicator. It plots the Х0 charts by close prices.

The Momentum Indicator measures the change of price of a financial instrument over a given time span.

Opens a BUY position with the size of a percentage of the maximum allowed size.

Automatic Trailing Stop for all open positions. Attach to one chart only.

The script opens a SELL position with the size of a percentage of the maximum allowed size.

The ADXdon indicator. Another version of the ADX indicator, which shows the strength of the trend.

The indicator shows the gaps between the closing price of the previous bar and the opening price of the current bar.

Lot sizing library. 29 money management options.

A set of functions to emulate the dynamic arrays.

Example of working with objects: creating object, changing properties, redrawing the chart.

Indicator 5_34_5

I am not a programmer, so I apologize for mistakes. This is my first EA, please rate it. And also its reliability.

Simple EA, but such efficiency for the year 2007!

Expert Advisor from the ATC-2007. Buys/sells when the price crosses the line of a moving average with the period (590)

The FarhadCrab1 EA. It has a lot of settings. It also uses a large number of indicators. Some of them: MA, Stochastic, Macd, RSI.

A modified version of the FlatTrend indicator, shows the beginning and the end of a flat.

The Farhad EA. It has a lot of settings. It also uses the indicators: MACD, Stochastic, SAR, Momentum, MA.

Expert Advisor based on two indicators (ADX and Momentum) with a built-in optimizer. Based on the optimization results it selects the best period for indicators and the trading direction or refrains from trading.

Relative Strength Index technical indicator.

The Ikarakatica indicator. It shows when to buy and when to sell.

Classic signals for opening positions on the intersections of two moving averages.

The Blockbuster EA.

Binario is not an automated trading system but a trading idea. It consists of entering at a breakout and following the trend. The suggested method can be used on all time frames.

The Avalanche_v1.0 Expert Advisor.

The Expert Advisor using artificial intelligence - a single-layer neural network. The "Perceptron" is used for identification of the quotes movement direction.

This indicator version was created using the code for Omega, written by John Ehlers

Universal Expert Advisor for working with any Custom indicator, that draws buy/sell arrows.

Expert Advisor that has been repeatedly discussed on the forum.

The NinaEA Expert Advisor. It uses the NINA indicator. And NINA uses 0_IndInverse.

The indicator of trading signals based on the divergence of the RSI and CCI values

This EA was discussed at Alpari. Opening when moving against the trade for the period of 0-n1 by p1 points after moving towards the trade for the period of n1-n2 by p2 points. Closing by TP or SL.

The program is designed to facilitate the routine work of the trader on testing and optimization of experts, performing sequential multi-currency, multi-timeframe and other types of tests and optimizations.

The EA uses the values of the Stochastic indicator on the H4 timeframe to open a position, and after that it builds up based on the martingale principle.

Example of an equity indicator based on the market profile