MQL++: Interact with Metatrader5 directly via C++ code

 

We all know MQL5 is a great language. It provides a full set of functions to deal with the market data and to develop programs and automated strategies.

But sometimes it may not attend to all of our needs. Imagine you want pass a double** ptr to a function. You can't do that in MQL5, because pointers are not pointers to memory addresses, but just references.

Imagine you want to use a static library written in C++ instead of a DLL. Imagine you want to use C++ STL classes in your function and you cannot import functions that uses them as arguments. Imagine you want to create your own UI (MQL panels/dialogs can be really glitchy). Imagine you want to pass data from the terminal to another application (not using network functions). Imagine you just like better C++ over MQL5, I don't know.

Those are some cases that would justify (maybe?) the necessity of calling MQL5 functions directly via C++ code.

That's why I developed MQL++: a library that allows programmers to call MQL5 functions from C++ instead the other way around. The idea behind is simple: MetaQuotes already provided a Python API to interact with the Metatrader terminal. This library just imports the python Metatrader5 module and calls the functions available on it. You can do almost anything that's in the documentation. Some functions are not available yet (because I'm lazy af), but I'm planning to do so.

I believe C++ also has its place when developing financial tools alongside python and MQL5.

If you're interested in trying the library, please check out the github page for more information. 

If you're already using the library, your feedback is always valuable.

GitHub - Sapphhh/MqlPlusPlus: Allows the user to connect with a Metatrader5 terminal from C++ code
GitHub - Sapphhh/MqlPlusPlus: Allows the user to connect with a Metatrader5 terminal from C++ code
  • Sapphhh
  • github.com
C++ has been my favorite language for a while now. Despite its popularity due to its speed and capabilities of memory management, MetaQuotes has never released an official API so the users could work with it. Well, if it was a problem for someone, it is no longer. MQL++ allows the user fetch the data from the MQL5::Metatrader5 terminal to work...
 

Small update: minor compilation warning fixes.

Also, added the CTrade class, which consists in an object oriented approach to send orders and receive results from the terminal (similar to MQL5 CTrade class).