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

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.

latest|best

The indicator shows a text block with the values ​​of the user defined Stochastic Oscillator period for each timeframe.

Maximum lot calculated based on free margin.

A semaphore signal indicator using Average True Range.

The Expert Advisor is based on the signals of the Stopreversal indicator and is provided with the possibility to set a strict trading time interval.

A real-time indicator showing the lag of quotes inside the terminal.

The indicator sets indexes for candlesticks in the price movement direction.

The Expert Advisor is based on the iRSI (Relative Strength Index, RSI) indicator signals.

The Expert Advisor is based on the iOsMA (Moving Average of Oscillator, OsMA) indicator signals.

An Expert Advisor for two currency pairs

An oscillator in the DRAW_FILLING style, using digital filters.

The Expert Advisor tracks positions of all symbols with all magic numbers. If a position has been open for "Waiting for seconds" and its profit has reached "Take Profit" points, the EA closes the position. If the profit has not reached "Take Profit" points, the EA moves the take profit level.

A library for creating analog clocks using MetaTrader 4/5 graphical resources.

The Expert Advisor is based on Bill Williams' strategy.

A trend indicator, which receives trade signals from the XMACD histogram.

Closing positions: all, only profitable or only losing positions.

The XMA_Divergence indicator with the possibility to change the indicator timeframe from input parameters.

The indicator shows a text block with the values ​​of the user defined CCI oscillator period for each timeframe

A trend indicator displaying divergence areas on the price chart.

The ShadeOpenX indicator with the possibility to display the percentage value of time that has elapsed since the beginning of the trading session displayed in input parameters. The possibility is implemented using the classes of libraries that were described in detail in the article "Custom indicators and infographics in CCanvas".

Two identical trading systems based on the change in the ColorJFatl_Digit moving direction for long and short trades, which can be configured in different ways in one Expert Advisor.

A trading system based on the NRTR_ATR_STOP indicator signals with the possibility to set a strict trading time interval.

Works with pending Buy Stop and Sell Stop orders. The EA uses the iMA (Moving Average, MA) indicator with a VERY large period equal to 590.

The indicator marks the current day's time period specified in the indicator settings using colored rectangles.

The indicator marks the time period specified in the indicator settings using colored rectangles.

An alert (an audio alert, email and push notification) is generated when the iMA (Moving Average, MA) indicator crosses the bar with index N.

A strategy based on iMA (Moving Average, MA) and iMACD (Moving Average Convergence/Divergence, MACD).

The indicator shows the number of bullish and bearish bars in the given interval.

Counting the number of series of bullish and bearish bars. Displaying the result as a chart. Saving the screenshot of the resulting chart. The script uses the CGraphic class.

The indicator shows a text block with the values ​​of the user defined DeMarker oscillator period for each timeframe.

The indicator shows a text block with the values ​​of the user defined WRP oscillator period for each timeframe.

Counting the number of series of bullish and bearish bars. Displaying the result as a chart. Saving the screenshot of the resulting chart. The script uses the CGraphic class.

Color candlesticks display areas, in which the MACD indicator crosses the zero line.

Displays areas, in which the MACD indicator crosses the zero line.

An example of a template for developing automated trading systems.

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 (https://www.mql5.com/en/market/product/26229)

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

12345678910...109