Download Developing a multi-currency Expert Advisor — source codes from a series of articles for MetaTrader 5

Developing a multi-currency Expert Advisor — source codes from a series of articles

Developing a multi-currency Expert Advisor — source codes from a series of articles

This professional-grade solution for MetaTrader 5 helps traders achieve greater efficiency in their daily workflow. This library provides a collection of modular, reusable code. It is utilized by developers to organize common functions, allowing for the integration of complex logic across multiple Expert Advisors, indicators, or scripts without the need for code duplication.

MT5 library Pack 📂

How to Setup and Use Developing a multi-currency Expert Advisor — source codes from a series of articles

1. Storage: Place library files in the MQL/Libraries directory to ensure they are accessible to your projects.

2. Implementation: Include the library in your code using the #import directive, ensuring you match the exact function names and parameters.

3. Compilation: Ensure the library is present in the directory before you compile your main EA or script, as the compiler links them during this phase.

4. Management: Keep libraries organized in sub-folders if you manage many custom functions to maintain a clean project structure.

Frequently Asked Questions

Q: What is a library file used for? A: Libraries store reusable code modules, allowing you to centralize common logic used by multiple EAs or indicators.

Q: Is a library executable? A: No, libraries are non-executable files containing functions; they must be imported into an EA, indicator, or script to function.

Q: Can I update a library while the platform is running? A: You should compile your EA or script after updating a library to ensure the latest code changes are integrated.

Description & Settings


This series of articles is in the process of being written. As we move forward, source codes from new articles will be added to this library.
It is recommended to review the code in the order of publication of articles in order to better monitor the development and changes made.
At this stage, the general scheme of the library looks like this:
An example of the test results for Expert Advisor from the article (Part 3):
A list of published articles with a detailed explanation of the development process:

There are quite a few different trading strategies. From the point of view of risk diversification and increasing the sustainability of trading results, it may be useful to use several parallel strategies. But if each strategy is implemented as a separate adviser, then it becomes much more difficult to manage their joint work on one trading account. To solve this problem, it is advisable to implement the work of different trading strategies in one Expert Advisor.

We will continue to develop a multi-currency advisor with several parallel strategies. Let's try to transfer all the work related to opening market positions from the strategy level to the level of an expert managing strategies. The strategies themselves will only trade virtually, without opening market positions.

We have already made some progress in developing a multi-currency advisor with several parallel strategies. Taking into account the accumulated experience, we will review the architecture of our solution and try to improve it before we go too far ahead.

Having started developing a multi-currency advisor, we have already achieved some results and managed to carry out several iterations of code improvement. However, our advisor could not work with pending orders and resume work after restarting the terminal. Let's add these features.
The full code is located in the attached archive due to the large number of files. Unzip it into the Experts folder. The files inside are divided into folders related to individual articles. Code from all parts added in archive, but at present only Part 1 and Part 2 have translated comments.
The two visible source code files are not used, they are only needed for publication.

You May Also Like

RobotFX does not own any of the code provided on this platform. All tools are freely available on the internet; we simply index and re-offer them for download. We are not responsible for any financial losses that may occur. Trading responsibilities rely solely on the traders downloading and using the displayed Expert Advisors, indicators, and scripts. These tools are provided for educational purposes only and may require modification or optimization to align with a trader's specific strategy or needs.
© ROBOTFX - Best MetaTrader Expert Advisors & Indicators