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 Codes of Libraries for MetaTrader 5

Libraries are small sub-programs containing a certain functionality that can then be used for developing new applications. Once written and thoroughly checked, a library allows users to speed up the development of new MQL5 applications. One of the illustrative examples is ALGLIB library containing multiple numerical analysis functions.

Library source codes can be downloaded and used in MetaEditor when developing trading strategies. They cannot be launched in MetaTrader 5 independently.

latest|best

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

The class monitors the emergence of a candlestick

MqlParams container class that uses method chaining to quickly add params and reduce lines of code.

Many traders are interested in native work with the BTC-e exchange directly from MetaTrader. In the exchange API, it is necessary to send data with the confirmation of parameters validity through HMAC-SHA512. The algorithm of SHA512 and HMAC calculation is implemented in this class.

The library makes indicators' Init/Deinit synchronized

Original mathematical functions taken from different places, which either do not have analogues or perform much faster than alternative implementations

This time-series library brings lightning-fast timeseries access to MQL5 for time-sensitive applications while implementing the familiar methods of MQL4, e.g. iBarShift.

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

The CDir class allows getting information about files and folders outside the MQL5 sandbox similar to the MS-DOS Dir command. Call of system DLL is used, therefore you should allow their use.

Returns position profit in points based on the trading history.

The library allows to automatically assign 'magic' to an Expert Advisor on any symbol and any timeframe. It allows having up to 65535 magic numbers in one Expert Advisor.

A library of averaging algorithms, the algorithms were described in details in the article "Averaging Price Series for Intermediate Calculations Without Using Additional Buffers"

Libraries for the interaction of МТ4/5 with R

The class allows to easily determine from your MQL5 programs any changes in the Market Watch window (change of symbol sorting, adding, deleting a symbol or a set of symbols), as well as opening and closure of charts, and the availability of the one click trading option on the current chart, on which the program is running.

The function returns the number of positions opened by an Expert Advisor for the day.

Module of trading signals of the "Candels High Open" custom indicator for analyzing High and Open of the last three bars.

Here are 6 classes, designed for convenient and intuitive use of indicators in your code.

Constructor for creating histograms of statistical distributions of indicators, timeseries and their derivatives.

Version of the iBarShift function for the MetaTrader 5, takes a parameter of type datetime — opening time of the bar, the index of which must be found.

Class for exchanging data between programs. It allows to pass structures of arbitrary size via the global variables of the terminal from one program to another.

This library allows to automate the process of connecting to a trade server after the "Account disabled" error occurs.

Parallel use of the MetaTrader 4 and MetaTrader 5 order systems.

Class for working with AES-256 encryption.

Byte-wise operation with structures and standard data types.

Elegant and nimble comparison of 'double' values of the "price".

Instance of the class returns such values as Bid, Ask, High, Low, Close and Open prices of the current candle or any other specified in the parameters, as well as the candle opening time.

Regular expressions provide a formal language for quick and flexible processing of texts. Each regular expression is a pattern (mask), for which the regular expression engine tries to find matches in the source text. A pattern consists of one or more character literals, operators, or constructs.

Signal based on the indicator Gann Hilo.

Filter based on the Intraday time filter offered by the standard library.

A library of classes for creating a user-friendly interface of your programs.

Signal based on the indicator developed by the Brazilian analyst Odir Aguiar (Didi).

Class for expanding the capabilities of MqlRates.

The class restricts the EA trading by time. It has flexible configuration options, which allow to set a custom number of the time zones, and also to allow trading only on the specified week days.

This simple class can be used to adjust, for example, trading ranges, or to enable / disable certain actions by time or day of the week.

Class for displaying multi-line comments.

Serialization and deserialization of JSON protocol. The code is ported from a high-speed С++ library.

Bug fixed versions of CRect and CCanvas which are part of the standard library.

FuzzyNet library for developing fuzzy models was written in C#. While converting to MQL5, 8 membership functions and 4 defuzzification methods for Mamdani-type systems were added to the library.

This file replaces the WndContainer.mqh original file. It prevents the chart from being affected when you click and hold the mouse inside a container area.

Functions for creating various objects and changing object properties.

12345