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


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

Slightly improved version of the previous one.

This script is to get the last deal history data, for example : profit, deal type, etc, and put the Comment on the chart.

Provide a surrogate or placeholder for another object to control access to it

Use sharing to support large numbers of fine-grained objects efficiently

Provide a unified interface to a set of interfaces in a subsystem; facade defines a higher-level interface that makes the subsystem easier to use

This indicator shows the amount of price movement within a certain time, compared to the actual price movement range. Good to detect consolidation areas, as well as new trends being formed

This script displays useful information.

This strategy is the well known set & forget accompanied by the martingale system. It is very useful if you are very busy in which you don't have time, you want to trade the London session while you are sleeping in USA, etc.

Attach additional responsibilities to an object dynamically; and provide a flexible alternative to subclassing for extending functionality

Trading panel that allows user to define levels of trade by simply dragging lines.

This strategy is the well known set & forget accompanied by the anti-martingale system. It is very useful if you are very busy in which you don't have time, you want to trade the London session while you are sleeping in USA, etc.

Create an object tree which represents part-whole hierarchies, so that the client would treat objects and compositions of objects uniformly.

ATR Stop Loss indicator

ATR adaptive SMA (simple moving average)

A native implementation of neural networks in pure MQL, bundled with an easy to use interface, with easy support of saving and loading of the network configurations after training.

Decouple an abstraction from its implementation so that the two can vary independently

Convert MqlTick-s into minified structures to free RAM or store tick arrays in a compact files.

This program lists and shows information about calendar events between specified date range.

This script downloads bars and ticks from EURUSD as required for the correct execution of Kiss on Billions on EURUSD from Saeid Irani.

Simple Simulator is designed to practice manual trading on historical data.

This script opens order with maximal amount of volume available.

required margin and maximum volume calculator.

Convert the interface of a class into another expected interface; classes with incompatible interfaces can work together

Synchronous change of a trading instrument in all charts

A collection of classic creational GoF design patterns

Ensure one instance of a class with a global point of access

Trend Follower Range Breakout System with Martingale.

Price momentum oscillator

Correlation trend indicator

I want to share with you this story. When I started trading, I learnt the scalping strategy in a volatile market. I really loved scalping especially when I see the price is moving fast. However, scalping for a long period of time is exhausting to me especially in a volatile market; volatile market requires fast analysis, actions and reactions; that is why I always reach a point that I loss concentration, focus and I start making those really stupid mistakes. That is why I created this EA, that is based on the indicator Identify potential entries, that helped me to automatically identify these potential entries (based on the formation of candlesticks) instead of doing all the work myself and it will trade these potential entries for me. I know there are plenty of Metatraders who also suffer from this and that is why I would like to share this EA with you, hopefully it will be beneficial. Do not forget to send you comments as well as rate these scripts. Happy trading!

If you can't watch your statistics and your game plan at all time, your emotions will take control and you will start taking ENTRIES such as revenge trade especially when you lose it.

Create objects by copying a prototype

An interface for creating an object that defers instantiation to subclasses. They decide which class to instantiate.

Ocean theory - natural market slope

The story behind this indicator is really interesting. I've published last week a script called "Identify potential Trends/Range (Pivot Points)" and a huge number of MQL5(ers) contacted me to ask if it is possible to have it as an indicator. So I was glad that lot of people actually like my scripts and indicators so that is why I've decided to convert the script to this indicator.

Random walk index (optimized version)

this expert opens trade in the direction of the trend when specific rate of average daily range has been passed.

For a complex object separate its construction from representation. Same construction process can create different representations

Step chart (upgraded version)

When I start learning about trading, I remember the trading pioneer Shawn Lucas (founder of Apiary-fund) saying "trading is simple, you go from bound range market to breakout market and vice versa". I looked at few charts and he was right. So I told myself, I have to always eyeball ranging market and trending market but with the help of an indicator. There are plenty for indicator that help us eyeball these ranging/trending market and they work really well, but I like using Pivot Points.