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

MQL5 Source Code Library for MetaTrader 5 - 79

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.


An indicator that uses tick volume for calculations.

Three Bollinger Bands with different timeframes with the same parameters on one chart.

Three RSI oscillators with three different timeframes on one chart.

A semaphore signal indicator forming signals when price gaps appear.

The indicator analyzes the latest three bars on the basis of a quadratic function and is displayed as a histogram with two signal lines with different periods.

A semaphore signal indicator. Its signals are calculated similarly to the Fast2 indicator. The difference is that trade signals are shown on the chart as corresponding arrows.

The indicator displays DiNapoli levels on the current chart using alerts.

The indicator draws trend support and resistance lines.

A semaphore arrow indicator using two moving averages.

The MDAC indicator with bar coloring according to Elder.

The indicator shows the method of drawing gradient semitransparent areas with independent update rate.

Barishpolts' moving channels on fractals.

The NRTR indicator based on Average True Range technical indicator.

The indicator displays the support and resistance levels calculated on daily prices.

A semaphore signal indicator using the Commodity Chanel Index oscillator.

An indicator of trend strength.

The Commentator indicator analyzes a group of technical indicators and displays information about the current state of the market and trade recommendations.

A digital momentum in the form of colored characters.

An example of how to create a multicurrency Expert Advisor that trades using the Bollinger Bands indicator.

Donchian Channel is a volatility indicator based on the calculation of the current price range with the recent highest and lowest prices.

This indicator is useful for correlation analysis and also for cross pair analysis.

There are a lot of users who searched for iBarShift function like in MQL4. But this function is no more include in MQL5, mainly because MQL5 provides all necessary basic, low-level, functions to process such thing in a library.

Trend indicator, based on crossover of pivot level and its median.

The QStick indicator is a simple n-period moving average of the price difference.

A trend indicator implemented in the form of NRTR.

An indicator of the trend power drawn in the form of a colored cloud.

A smooth non-normalized oscillator implemented in the form of a color histogram.

A non-normalized oscillator.

A trend indicator that uses the oscillator analogue of RSI and its signal line. It is drawn as a colored cloud.

An indicator of trend power with four states.

Trading signals of candlestick patterns with confirmation by Stochastic indicator.

IREA is an automated trade algorithm based on the idea of that an unusual impact in price changes will be adjusted by an inverse movement.

This indicator will plot divergence lines on the Awesome_Oscillator indicator and will give buy and sell signal by displaying arrows.

The script calculates candles statistics (the minimal, maximal and average values of candles body and shadows) of the current chart.

The indicator shows the current date, time, the current spread and stop levels.

The script is assigned to a hot key for quick change of charts around in a circle.

The indicator "predicts" the color of the next bar with the probability specified in the settings. It is useful for the evaluation of strategies aimed at such a prediction when choosing trading instruments / timeframes for strategies. Caution: The indicator "looks into the future", so do not apply it in real life or in the strategy tester!

Easier visual analysis of graphical objects created by the strategy tester.

An indicator in the form of arrows on the basis of Elder's trading system.

Another version of the indicator that calculates support/resistance levels.