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.

Submit your code

Study of the dependencies of two iMA (Moving Average, MA)

Signals (Arrow objects) of iCHO indicator (Chaikin Oscillator, CHO) and smoothed iCHO intersections

An indicator to monitor the appearance (or change) of a rectangle whose name starts with ...

Adds the ability to automatically export the transaction history after running the Expert in the strategy Tester.

Export the history of transactions on the trading account.

Standard MA + Hull MA + DEMA + TEMA

Very simplified code: intersection of two custom indicators 'MA Other TimeFrame Correct'. There is no Stop Loss, Take Profit or Trailing.

Candle close above/below BB & Envelopes

Strategy based on the signals of the custom indicator 'RSI_MAonRSI_Dual'

from the logistic regression Article, I welcome all the thoughts on how we can build multiple dynamic Logistic Regression

Two indicators iRSI (Relative Strength Index, RSI) smoothed using iMA (Moving Average, MA)

iSAR indicator (Parabolic SAR, SAR) with filled areas between the indicator and the price. On the right side, a rectangle is drawn equal in size to the fill area

The indicator shows 'Daily Change' on the daily timeframe. When the specified limit is reached, plays sounds

'MACD' indicator with the same color scheme as the 'Awesome Oscillator' indicator

Strategy based on the custom indicator 'RSI_MAonRSI_Filling'. The minimum step is set between positions

'RSI' line, 'RSI' line smoothed with 'MA'. Fill areas between these two lines.

The indicator shows signals ('Arrow' objects) of the 'Moving Average' indicator crossings. The peculiarity of the indicator: if there was an intersection of 'MAs' (on bar #0), and then the intersection disappeared, the signal remains on the chart

Sorts the values in the first dimension of a multidimensional numeric array in the ascending order.

This indicator displays the percentage of price movement per candle, as an average of the latest candles.

Currency Strength Meter for MetaTrader 5 with configurable timeframe parameter, It was converted from "Currency Strength Giraia 28 pairs TRO MODIFIED" MetaTrader 4 version

Trend Rider is a combination of several indicators eg super trend, rsi, and macd to assist in spotting and riding trends by showing direction inform of color candles and also showing trailing stop levels, It can be used independently or with additional filters.

Trend Direction And Force Index with Alert derived from Mladen Rakic's version

Ao changes direction Engulfing candle

Rsi oversold bought , Moving average

The Leading Indicator was created by John Ehlers (Cybernetic Analysis For Stocks And Futures pg 235)

Recursive Moving Average calls itself a number of times in order to reach the appropriate smoothing. For instance DEMA and TEMA indicators are recursive exponential moving averages. The goal is to remove the loop limit while still running fast. In addition a trigger line provides the trading signal.

Reverse candle patterns

Use this simple Indicator to monitor your VPS.

Around the moving average index to set grid.

Proportional grid distance, open long and short orders at the same time, skip two grids to take profit; When the equity recaches the take profit of setting, close all positions and restart.

I search Moving Average that can be hide and shown with button, just like in Trading View, but I cannot found it. Then I try to modify example of Moving Average code from MQL5 Metaeditor Help, and do some add for button and logic for toggleable the button to show or hide Moving Average. Just like in Trading View. For those who need this, please feel free to use or modify for your own requirement.

Calculates the average volume for EA

Single Currency or Manual orders Closing or deleting sections are very easy to understand but if you have a question you leave it at comment section. The code check for Comment to detect the Orders to close or delete for multi currencies EA in case the input EAComment is empty It will close according to type of close. It supports prefix or suffix of EA Comment. Many options can be added if you are interested on developping it more you can leave your suggestion on comment section.

Shows Last Price, Daily % Change, Symbol name, Countdown or Time left on closing and Time on chat

Set Trailing Stop only when profit

Fast way to calculate Simple moving average.

Rates Version of a script

Add High and Low lines based on number of previous bars defined in input field

This EA help you to auto set the TP, SL & TRAILING by default, easy to close all orders with button "Close All" *Update April 2022. Channge ushor to ulong to support giant spread like Boom/Crash Synthetic Symbols

Add Popup or Push Alert notification on manually placed horizontal lines, The lines are deleted and reset itself as soon as price touches these lines