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!

EMA Levels multi timeframe version.

Schaff Trend RSX multi timeframe version.

Schaff Trend RSI multi timeframe version.

A library for working with a third-party tick archive.

An Expert Advisor based on two iMAs (Moving Average,MA) and one iRSI (Relative Strength Index, RSI). It tracks virtual profit. Works on two symbols.

Stochastic on the price chart.

A signal indicator for opening/closing positions.

A trend signal indicator.

The indicator displays the ratio of two LSMAs.

Linear regression line (LSMA) - a moving average calculated by the linear regression method.

A Moving Average based on Heiken Ashi candlesticks.

Modified BW Zone Trading - a modified indicator of Bill Williams' zone trading.

Detrended Price Oscillator Bar - price chart without a trend.

The Expert Advisor opens no more than one position per day. Positions are opened at the specified time. It searches for the Highest and Lowest price in an interval. Data of two iMA (Moving Average, MA) indicators are used.

A colored histogram of the days of the week. Uses the drawing style DRAW_COLOR_HISTOGRAM.

An arrow indicator, which compares the daily open price with the close price of an hour.

A utility for applying trailing stop based on the "Parabolic SAR" indicator.

The Expert Advisor places pending Buy Stop and Sell Stop orders. Includes checks for the minimum distance of orders in points (SYMBOL_TRADE_STOPS_LEVEL).

Trend detection based on the last three bars.

A histogram of the days of the week.

An Expert Advisor based on two iMAs (Moving Average, MA) and one iSAR (Parabolic SAR). Position trailing.

The Expert Advisor opens positions when the price crosses line objects.

Simultaneous opening of two opposite positions. Trailing Stop.

A module of trading signals based on the Moving Average indicator signal module.

VSI - Volatility Switch Indicator.

The IDayIIndex (Intraday Intensity Index) oscillator indicator.

A stochastic momentum.

A colored histogram drawn using the High/Low prices.

The indicator adds signal marks to a price chart when the CCI indicator crosses its zero line.

An indicator of the market state.

Gap searching indicator.

SZO (Sentiment Zone Oscillator) is an indicator of market sentiment, which has overbought and oversold zones.

CVI (Chartmill Value Indicator) shows the value of price deviation from the Moving Average.

Pending Buy Stop and Sell Stop orders. The EA trades in the specified time period. Determines the highest and lowest prices in the specified range of bars. Position trailing.

An Expert Advisor based on the iIchimoku (Ichimoku Kinko Hyo) indicator. Separate Stop Loss, Take Profit and Trailing Stop for BUY and SELL positions. The EA operation time is configurable. A check is performed on the current bar: only one position can be opened.

An indicator for automatic drawing of trendlines based on fractals of a given timeframe.

The EA trades using pending Buy Stop and Sell Stop orders, applying the iAMA (Adaptive Moving Average, AMA) indicator based on a "round price". Position trailing.

Example of functions MathCeil, MathRound and MathFloor.

The Expert Advisor uses the Fractals indicator signals to place pending orders and trail the Stop Loss level of positions.

The AD (Accumulation Distribution) indicator with three calculation methods.