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

icon

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.

Submit your code
latest | best

The CDebugLogger class is a flexible and comprehensive logging utility designed for use in MQL4/5 environments. It allows developers to log messages at various levels of importance (INFO, WARNING, ERROR, DEBUG) with options to include timestamps, function signatures, file names, and line numbers in the log entries. The class supports logging to both the console and files, with the ability to save logs in a common folder and in CSV format. Additionally, it offers functionality to silence logs based on specific keywords, ensuring that sensitive information is not logged. This class is ideal for developers looking to implement robust logging mechanisms in their MQL4/5 applications, with customizable features that cater to a wide range of debugging and monitoring needs.

This library simulates prop trading firm scenarios by resetting the account balance based on configurable profit and loss thresholds during backtesting, and logs reset results for analysis.

The CDebugLogger class is a flexible and comprehensive logging utility designed for use in MQL4/5 environments. It allows developers to log messages at various levels of importance (INFO, WARNING, ERROR, DEBUG) with options to include timestamps, function signatures, file names, and line numbers in the log entries. The class supports logging to both the console and files, with the ability to save logs in a common folder and in CSV format. Additionally, it offers functionality to silence logs based on specific keywords, ensuring that sensitive information is not logged. This class is ideal for developers looking to implement robust logging mechanisms in their MQL4/5 applications, with customizable features that cater to a wide range of debugging and monitoring needs.

This EA is a demonstration of how you can implement your own Hedging strategy with the help of the include file.

Basic library to create Volume Profiles on chart.

This is a basic library to create and manage grids.

Class to access to the local time for the specified location, as well as time zone information and the local trading session hours.

The source codes written during the development of the library for creating multi-currency Expert Advisors that combine many instances of various trading strategies.

Static class to fix the TimeGMT() function during testing in the strategy tester.

Calculate the cosine distance and similarity between 2 vectors . The cosine distance is 1-cosine_similarity and the cosine similarity is the dot product of two vectors by their magnitudes multiplied.

Smooth Algorithms fixed version plus Trade Algorithms plus full operational EA, plus two indicators . So you will get complete project where you be able to see example how to use and implement this libraries

This Include File checks for Market Open Hours. An EA to test it is also included.

With these classes you can create and test your signals runtime.

Monitoring of memory leaks in the strategy tester

Enables Programmers to create Martin Gale and Grid Trading strategies with ease.

PNG

Forget about BMP files like a bad dream. Thanks to this library, you can now use the PNG format, which has a number of advantages, such as being more compact without losing image quality and maintaining transparency.

Calculate DST for USA, EUR, AUD and RUB and the offset time of the broker automatically from the 70's until 2030 - even in the Strategy Tester of MQ.

The purpose is to check whether new bar are generated This is a class file that can be used as a class or copied to EA or scripts for use

A set of macros to benchmark small code snippets for their execution speeds.

The 64-bit xoshiro256** Random Number Generator.

Smooth Algorithms - Corrected/Modified

Sort the input array in-place using comparison function less.

for export/import of orders and trades between EAs and terminals

This library shows useful informations and do a lot of functions to a symbol.

Allows you to determine the occurrence of a new bar event in a multicurrency Expert Advisor

The ZigZagExtremaOnArray is an mqh include file which contains the calculation function of MetaQuotes' Examples ZigZag, BUT you can use it on any buffer that contains curves or histograms, similarly to the MovingAverages.mqh from include. The idea was to get highs and lows of an indicator curve quickly with the help of an "onBuffer" function.

Utility for copying transactions from one MT5 account or MT4 account to another MT5 account.

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

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

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

This EA demonstrates creating and saving a graphic chart using data from the MT5 Strategy Tester.

Simple class for getting the number of microseconds (µs) elapsed since January 1, 1970

A collection of useful string manipulation functions.

Extend of CFile class to work with the .set extension file which terminal will produce when the Input/Optimisation is saved.

This Function will retrieve the Assets next Opening Time and Closing Times, either following the current time or following a given time.

This class loads a licensing file by reading 64bit encrypted account data from a license file into an account array for the purpose of licensing. The Class is initialised with a Filename, a Master Key (m_hkey -> can be a secret key of your choice) and whether the file needs to be saved in the common folders or not.

An easy-to-use multi-currency library, usable in indicators and EA.

hybrid sorting algorithm that provides both fast average performance and (asymptotically) optimal worst-case performance

gnome sort is based on the technique used by the dutch garden gnome

123456789