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

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.


Two independent trading systems using indicators BykovTrend_V2 and ColorX2MA within one EA.

Two independent trading systems using indicators SilverTrend_V2 and ColorJFatl_Digit within one EA.

Cluster indicator based on article

Indicator BykovTrend as candlesticks.

Two independent trading systems using indicators BrainTrend2 and AbsolutelyNoLagLWMA within one EA.

The Expert Advisor places four positions with different Take Profit levels per time. As soon as one Take Profit triggers, the other positions will be moved to breakeven.

Synthetic Japanese candlesticks over the period defined in the indicator settings, calculating on each bar, based on the Bear_Bulls_Power_Candle indicator candlesticks.

Two identical trading systems (for long and short positions) based on the signals of indicator NRTR, which can be differently configured within one EA.

Indicator XPeriodCandle supplemented by Bollinger Bands, based on their candlesticks, and indicating with the bright candlestick color if the candlesticks go beyond the bands.

A candlestick-based chart based on histograms Bear_Bulls_Power calculated on the Open, High, Low, and Close timeseries of the price chart.

ZPF (Zero Point Force) - zero point force indicator. It displays the market climate.

Indicator XMA (Digital adaptive Moving Average) is a digital adaptive moving average XMA. It calculates the moving aberage using a digital filter.

Indicator WAAB (Waddah Attar ADXxBollinger) is intended for identifying the direction and strength of the current trend. For this pupose, a combination of the signals from two indicators is used: Advanced_ADX and Bollinger Bands.

The VFO (Volume Flow Oscillator) values above zero are bullish and indicate accumulating, while those below zero indicate distributing. Divergences between the price and the indicator values may indicate a forthcoming change in the trend.

Indicator UDP (Up/Down Percentage) displays the direction of candlesticks, i.e., up/down, as a percentage over the selected period.

Indicator SS (Stochastic Stack) represents a set of eight indicators Stochastic with different parameters, united in a single calculation process.

Indicator RMI (Running Median Indicator) is a moving average with the "Running Median" filtering algorithm.

Indicator PVO (Percentage Volume Oscillator) represents a momentum for the volume. It calculates the difference in the percents of large MA between two moving averages based on volumes.

Indicator MPO (Midpoint Oscillator) displays price movement without its trend component around its centerpoint. It is displayed as two lines: Price movement line and signal line. Centerline (MidPoint) is zero level of the oscillator.

Trend-following indicator LeManStop is a representative of system LeMan and displays Stop Loss levels for the existing positions in the chart. It draws two Stop Loss lines for Long and Short positions, displayed in different colors.

Indicator GB (Gaussian Bands) works in the same manner as standard indicator Bollinger Bands. However, unlike the former, it performs filtering centerline and deviation lines by Gaussian method. It also has two deviation lines on each side of the centerline.

Indicator DMX (Bipolar DMI) is calculated using the standard indicator ADX. However, as compared to that, it displays data as an oscillator with a signal line, and has shorter delay.

Indicator CA (Corrected Average), also known as Optimal Moving Average. The benefit of the indicator is the fact that the current value of the timeseries must exceed the current threshold that depends on volatility for the indicator line to follow the price, avoiding false signals in the trend.

Indicator ASO (Average Sentiment Oscillator) displays the general market climate.

This indicator calculates the index of a given currency, using the USD index. It is based on indicator SymbolX, but four prices are used for calculations: OHLC instead of just one Close price.

This indicator calculates the index of a given currency, using the USD index. The Close prices of six currency pairs are used to calculate the index.

A candlestick-based chart based on histograms Ang_Zad_C_Hist calculated on the Open, High, Low, and Close timeseries of the price chart.

Indicator Atr Lite calculates the average price motion

Candlestick size and shadow analysis. In OnTradeTransaction, opening (DEAL_ENTRY_IN) and closing (DEAL_ENTRY_OUT) the positions are intercepted, as well as closing by Stop loss (DEAL_REASON_SL).

An unorthodox approach to indicator MACD: The EA calculates the indicator's area displayed above and below zero line.

A trading system based on object Fibonacci Lines (OBJ_FIBO) and on indicator Resistance & Support

ADX trend smoothed - multi time frame

ADX trend - smoothed

Variation of a well known Pivot indicator showing pivot lines in a separate window and price position relative to those pivot lines.

Pivot oscillator - averages


RSI (var) using Jurik MA

A histogram based on the difference between the main and the signal lines of indicator Ang_Zad_C in the points of the price chart.

A trend-following indicator of the main and signal lines, drawn as a color cloud.

Indicator AbsolutelyNoLagLwma_Digit_Cloud with the timeframe selection option available in its input parameters.