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

MQL4 Source Codes of Libraries for MetaTrader 4

Libraries are small sub-programs that can be used for developing new applications. They do not execute trading or analytical functions and cannot be run in MetaTrader 4. Their purpose is to simplify development of new applications in MQL4.

These applications can be downloaded and used in the editor of trading strategies MetaEditor.


CEquityHstBar - library for showing the equity of EA back-testing by the offline chart.

Class for working with synchronization events.

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.

A class system to represent a hidden stop loss and take profit system, combined with 4 example files showing the use of the classes.

FileLog class for efficient logging at different Levels.

The header file contains functions and input variables for a time management.

Various helper functions for sending messages of different types to different sources.

This library has smart notification(alert, push and alert) function with an option of having a single notification per candle at a time.

Build Binary Options strategies to test in the Strategy Tester of MetaTrader 4 with Binary Options Strategy Tester utility from marketplace.

Byte-wise operation with structures and standard data types.

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

Class for working with ticks in the MetaTrader 4. It is suitable for creating experts that make decisions on trading based on the analysis of tick data.

Rapid Application Development library.

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

OBz library of trading functions: position size, open, close position etc.

Fast time range checking function. Doesn't use slow string parsing.

Trading signals function. Based on the values of the CCI indicator.

Errors function. In Russian.

Based on the values of the OsMA indicator.

This is a conversion factor. It is used to detect whether broker is 4 or 5 digits. As MetaTrader 4 calculates everything using point basis, coder can use this function to convert pips to point for machine reading.

Lot sizing library. 29 money management options.

A set of functions to emulate the dynamic arrays.

Displays the levels of the current week!

Have you perhaps heard about the caterpillar? Here it is.... I do not remember where I got the code, I simply translated it from С++ to MQL4.

Library functions, get the HIGH LOW for the specified time interval

Set of standard functions for the YR1 timeframe.

This library is made for experts that need to calculate StopLoss and TakeProfit without putting SL/TP points on the trade.

This library made to simplify calculating your stop loss.

This library has SmartTrail trail function that depends on the previous candle.

It calculates the lot size depending on risk percentage entered by user in input parameters.

This library has two functions: first to count OP_BUY positions and second to count OP_SELL positions.

This library has two functions: BreakEven & TrailingStop.

This function calculates your lot size depending on definite conditions explained in input variables.

A simple function that creates a list of the available currency pair symbols.

Function library and Experts for trailing (11 types). Simple usage of complex algorithms.

The library for automated optimization of an EA during its operation.

This library allows you to write a text file with the quotes of the symbol in any place on your hard drive.

Additional functions for working with the datetime variables.

The Comment2 library expands the capabilities of the standard Comment function for comment output.

With the help of this library it is possible to implement the ability to maintain positions with a simple trailing stop in any Expert Advisor.