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

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

Oscillator using inverse Fisher Transform.

If a trade is closed by Stop loss, the volume is doubled; if by Take profit the minimum volume is used. OnTradeTransaction is used to determine whether a trade was performed after the activation of Stop loss or Take profit.

A semaphore signal indicator.

A channel based on peaks and troughs of ZigZagOnParabolic.

Buy a security (open BUY positions) at a lower price, sell (open SELL positions) at a higher price.

The Paramon indicator with a color filling of the channel.

A trading system based on the Omni_Trend indicator signals.

A breakout trading system based on the signals of the Color_PEMA_Envelopes_Digit_System indicator.

A breakout trading system based on the signals of the Color_QEMA_Envelopes_Digit_System indicator.

Buy a security (open BUY positions) at a lower price, sell (open SELL positions) at a higher price.

The BarTimer indicator implemented using the classes of libraries that were described in detail in the article "Custom indicators and infographics in CCanvas", with the possibility to set a fixed timeframe, data from which the indicator displays in input parameters.

The BarTimer indicator implemented using the classes of libraries that were described in detail in the article "Custom indicators and infographics in CCanvas", using current timeframe data.

The Omni_Trend indicator with the timeframe selection option available in the indicator input parameters.

A trend indicator of NRTR type using an MA and ATR.

This utility program records tick quotes in the CSV and BIN format. A flexible set of symbols is available for writing.

Standard VWAP (Volume Weighted Average Price) calculation, but with configurable start position.

Returns the profit of a position in points, as well as commission, swaps and profit in money based on the trading history.

Trades on PERIOD_M1 (M1). Calculates bullish and bearish candlesticks.

Closing all open positions with the specified profit percent.

The EA trades during two trading sessions, starting at the specified session beginning time. Stop Loss. Take Profit.

An assistant Expert Advisor. Only CLOSING positions.

Automated calculation of Stop Loss levels based on the ATR indicator.

The Expert Advisor uses three indicators: MA(150), RSI(3) with levels 80 and 20, Stochastic(6, 3, 3) with levels 70 and 30.

The Color_QEMA_Envelopes_Digit indicator with the timeframe selection option available in the indicator input parameters.

The Color_PEMA_Envelopes_Digit indicator with the timeframe selection option available in the indicator input parameters.

The EA uses the following indicators: CCI, fast and slow MA, Larry Williams' WPR.

The indicator implements a breakthrough system using the Color_PEMA_Envelopes_Digit channel.

The indicator implements a breakthrough system using the Color_QEMA_Envelopes_Digit channel.

A channel based on peaks and troughs of the Zigzag2_R_Color indicator.

A channel based on peaks and troughs of the ZigZag indicator.

A channel based on peaks and troughs of Boa_ZigZag

Trading strategy: the breakout of a High/Low in the selected time interval.

The Boa_ZigZag_Arrows indicator with the timeframe selection option available in the indicator input parameters.

The indicator marks all performed trades with short horizontal lines.

Two ZigZag indicators are used for analysis.

The indicator draws a channel using the High and Low values of a candlestick of a higher timeframe specified in the indicator input parameters.

The indicator draws the open level of a candlestick of a higher timeframe specified in the indicator input parameters.

Envelopes using the Color_PEMA_Digit MA, with an indication of trend direction and display of the last values of channel borders.

Envelopes using the Color_QEMA_Digit MA, with an indication of trend direction and display of the last values of channel borders.

The Expert Advisor searches for N identical candlesticks in a row. It buys on bullish candlesticks and sells on bearish ones. The account type is taken into account, i.e. whether it is netting or hedging.

1...5678910111213141516171819...115