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

The expert advisor moves stop loss of position at user-defined breakeven.

A library for common rounding methods used in MQL development, primitive wrapper class for type (double), and vector for CDouble objects. MQL5 and MQL4 compatible!

A complete Renko chart indicator with wicks. Configure using Tick Size, Pip Size or Points.

Simple Expert Advisor based on the Larry Conners RSI 2 strategy.

Script for checking the LeadLagRelationship indicator (

PS Magicas - Three moving averages that give target and possible entries.

An implementation of the dictionary (associative array) data structure in MQL5, based on CArrayObj and CList.

The indicator of support and resistance lines calculated based on the iFractals (Fractals) indicator values.

The trading system is based on iMACD (Moving Average Convergence/Divergence, MACD) and iStochastic (Stochastic Oscillator)

The Expert Advisor checks the direction in which the price has been moving for the last 10 seconds, and opens a position in accordance with the movement. The EA sets Stop Loss and Take Profit.

Works with pending stop orders (Buy Stop and Sell Stop). Monitors spread %.

The EA lock positions.

A trading system based on the Alligator indicator. If possible, the EA moves positions to breakeven and then enables trailing stop.

The Expert Advisor uses the following indicators: Moving Average Convergence/Divergence, MACD; Moving Average, MA; Average Directional Movement Index, ADX. It closes half of the profitable position.

The Expert Advisor trades in a channel. When a flat channel is found or when the market slows down, the EA places a pending order expecting the channel breakout.

Displays average values ​​of the bulls and bears power.

The script has three independent functions for determining the current FORTS futures.

A trading system based on the Vortex indicator signals.

A library for creating icons in the Windows taskbar and for sending text alerts. The use of this library will help you make your MQL programs more informative.

The Momentum indicator implemented in the form of a color histogram.

An indicator from "Technical Analysis of Stocks & Commodities" (January, 2010).

A multi-currency Expert Advisor based on the iStochastic (Stochastic Oscillator) indicator signals.

A library for working with chart subwindows.

The Expert Advisor trades based on the i-Regr indicator signals.

The МТ45 Expert Advisor is based on the Martingale strategy. It is designed for trading in the МetaТrader 4 and МetaТrader 5 terminals.

The Expert Advisor trades using the signals of the following indicators: iStdDev (two indicators), iMACD, iCCI, iATR. Moving positions to breakeven.

Opening and closing positions at a specified time.

The Expert Advisor sets pending Buy Stop and Sell Stop order at a specified time.

An expert advisor based on the TRIX ARROWS indicator.

The Triple Exponential Average (TRIX) indicator + the signal line + arrows at the intersection of the signal and the main lines.

The Expert Advisor sets a grid of pending Sell Limit and Buy Limit orders.

The Expert Advisor uses Burg's method for linear prediction.

The scripts places multiple pending orders lower than the current price.

The scripts places multiple pending orders higher than the current price.

The 'History Deals and Orders' script shows absolutely all properties of deals and orders from the trading history over a given time interval.

A library for reading/writing the parameters of arbitrary Expert Advisors.

The Psychological indicator implemented as a color histogram, featuring alerts, push and email notifications.

This is an implementation of the market cycle indicator described by Raghee Horner.

A trading system based on the Stopreversal indicator signals.

The indicator implements a breakout system using the Zigzag2_R_channel indicator channel, as well as generates alerts, sends push and email notifications when the price breaks the channel drawn through the zigzag peaks.