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 and MQL5 Source Code Library

You don't know where to start learning the MQL5 or MQL4 programming language? Various programs for your MetaTrader terminal are available here. Download and study published code examples, develop your own indicators and Expert Advisors. Publish your applications in the largest library of MQL5 and MQL4 codes, and they will be available in every MetaTrader terminal and MetaEditor.

Your code examples in MQL4 and MQL5 will be distributed worldwide, and thousands of traders will know about you!

To post a new code, please log in or register

This script opens random position at market price on all symbols having spread below specified value.

BitMEX Trading API Header files and example codes to trade on BitMEX exchange.

Simple risk management tool.

This script opens a buy or sell order randomly having equally spaced take-profit and stop-loss levels.

Simplified Script to find signals based on user parameters

First script selects symbols having spread below specified value on the marketwatch, then opens corresponding charts by appyling timeframe and template stated.

This script allows a user to find out instance_id of the running MetaTrader instance/installation.

Custom Price Chart using a simple Artificial Neural Network that tries to project price movements into the future. Not very useful for trading, but fun to watch and learn ;)

Indicator calculate the average price

Scans multiple symbols looking for when the price crosses a pivot point or when xxPoints Near or bounce off pivot then it alerts the trader.

Monster Trend indicator that uses data from several time periods.

Trend indicator similar to Ichimoku Kinko Hyo, with a number of drawing options and calculation parameters.

NELODI Trading Terminal is a collection of Indicators and an Expert Advisor, which work together to provide a complete solution for manual Trading, primarily designed for Scalping.

Separate the construction of a complex object from its representation so that the same construction process can create different representations.

Define an interface for creating an object, but let subclasses decide which class to instantiate. Lets a class defer instantiation to subclasses.

Provides an interface for creating families of related or dependent objects without specifying their concrete class.

Rma MACD

When the subject changes, it notifies and updates its observers, who know nothing about each other.

Encapsulating a family of interchangeable algorythms which can be modified independently from the client.

A way of sub-classing more functional objects, dynamically.

Classical Sudoku puzzle right in MetaTrader chart.

Trading the trend

Prices truncated to pips.

Multi-asset cluster indicator taking all currencies as a sum of values forming a whole market, that is unity (1.0)

Range BreakOut EA. The range is defined by the min number of bars and max width in pips. This expert advisor is designed with visual strategy builder - Mission Automate. Code is generated automatically. More info: https://www.mql5.com/en/articles/4951

Grid system with limit orders. This expert advisor is designed with visual strategy builder - Mission Automate. Code is generated automatically. More info: https://www.mql5.com/en/articles/4951

Adaptive (ema) deviation

Classic strategy based on Parabolic SAR indicator. With Auto Lot options and Trailing Stop. This expert advisor is designed with visual strategy builder - Mission Automate. Code is generated automatically. More info: https://www.mql5.com/en/articles/4951

This utility is not a trading information utility. It will only have value for those getting information on the Number of Bars that have terminal data. This utility uses the functions SeriesIntegerInfo and CopyRates to obtain and display information about the availability of bar information from the terminal.

Very popular but dangerous strategy which doubles the stakes after each loosing trade. Finally, if there is enough margin it will reverse into the direction of the current price move and will eventually close in profit. This expert advisor is designed with visual strategy builder - Mission Automate. Code is generated automatically. More info: https://www.mql5.com/en/articles/4951

Classic trading strategy based on RSI levels. Buys when RSI is oversold and sells when RSI is overbought. This expert advisor is designed with visual strategy builder - Mission Automate. Code is generated automatically. More info: https://www.mql5.com/en/articles/4951

This utility is not a trading or market information utility. This will likely only interest those writing (or debugging) indicators using multiple timeframes and collecting information using Bars (or iBars) and CopyRates. The utility creates a list showing the number of Bars reported by the "Bars" function and shows the success of CopyRates for any selected bar by displaying that bar's time from the collected data (or, it shows the error).

Classic and one of the most popular trading strategies based on 2 moving averages crossover. This expert advisor is designed with visual strategy builder - Mission Automate. Code is generated automatically. More info: https://www.mql5.com/en/articles/4951

Arrow trends by iBearsPower and iBullsPower indicator for MT5

The utility will display the high, low, open, close and time statistics for any user selected bar of any timeframe for the symbol of the chart the utility resides on.

This utility allows monitoring of multiple symbols and positions on one chart with one-click switching of the chart symbol.

Indicator Bears and Bulls Power for MT5 together in one separate window.

The code consists of lines created according to the opening, closing, low and high values of prices.

Three Moving Averages Convergence/Divergence - Indicator for MT5

Export tool for OHLC prices, calculated prices & indicator buffers

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166