Download MetaTrader 5

How to call/import a mql4 or mql5 function into a c++ code?

To add comments, please log in or register
Nathan123
43
Nathan123  

Hello everyone,

There are a lots of topic dealing with importing a function from a DLL into a mq4 or mq5 file, but none about doing the contrary i.e importing a mql4 or mql5 function into a c++ code?

Does anyone know how to do this?

Thank you in advance,

Cheers,

NA

Stanislav Korotky
22741
Stanislav Korotky  

You can't "import" MT4/5 core into your c++ code directly. But you can implement wrapper methods. Create a bridge script which imports your c++ callbacks and calls MT4/5 methods, then invokes the callbacks with obtained results.

If you provide more info about the task, this could make it easier to suggest a proper solution.

Alain Verleyen
Moderator
33770
Alain Verleyen  
marketeer:

You can't "import" MT4/5 core into your c++ code directly. But you can implement wrapper methods. Create a bridge script which imports your c++ callbacks and calls MT4/5 methods, then invokes the callbacks with obtained results.

If you provide more info about the task, this could make it easier to suggest a proper solution.

I can't see the goal to call a mql4/mql5 function in a c++ code ?
Stanislav Korotky
22741
Stanislav Korotky  
angevoyageur:
I can't see the goal to call a mql4/mql5 function in a c++ code ?
This is why I'm asking about more details. For example, in some cases one could decide to built an external analytical/aggregating software, which uses MT (and other products) as data provider.
Alain Verleyen
Moderator
33770
Alain Verleyen  
marketeer:
This is why I'm asking about more details. For example, in some cases one could decide to built an external analytical/aggregating software, which uses MT (and other products) as data provider.
Humm...yes. Thank you. We will see.
Nathan123
43
Nathan123  

Well, for instance : with AccountInfoDouble(), what I used to do is to call it in the .ex4 and pass the value to an imported function from a DLL; which roughly is something like this:

in the mq4/mq5 file : #import double func1(double Var1) #import .....func1 being within the DLL and of course Var1 is the passed value of AccountInfoDouble(). Well that's the traditional way. 

And I was wondering whether one can call directly AccountInfoDouble() from the DLL? Mainly for security purpose, having heard that .ex4 file is relatively easy to decompile, any security measure can be easily dodged by changing the checking value within the .ex4 file...even though it is the DLL that handles the function, Var1 can be easily perverted, since it is given within the .ex4 file...

Am I wrong?

Thank you and cheers,

NA

Stanislav Korotky
22741
Stanislav Korotky  
Nathan123:

Well, for instance : with AccountInfoDouble(), what I used to do is to call it in the .ex4 and pass the value to an imported function from a DLL; which roughly is something like this:

in the mq4/mq5 file : #import double func1(double Var1) #import .....func1 being within the DLL and of course Var1 is the passed value of AccountInfoDouble(). Well that's the traditional way. 

And I was wondering whether one can call directly AccountInfoDouble() from the DLL? Mainly for security purpose, having heard that .ex4 file is relatively easy to decompile, any security measure can be easily dodged by changing the checking value within the .ex4 file...even though it is the DLL that handles the function, Var1 can be easily perverted, since it is given within the .ex4 file...

Am I wrong?

Thank you and cheers,

NA

New version of ex4 uses the same - improved - level of protection which is used for ex5, so I don't think one can find a decompiler for it.

You can't call MT core functions from a DLL directly. For security reason as well, by the way.

Alain Verleyen
Moderator
33770
Alain Verleyen  
From what Metaquotes said, ex4 and ex5 are at the same level of security as DLL.
Nathan123
43
Nathan123  
angevoyageur:
From what Metaquotes said, ex4 and ex5 are at the same level of security as DLL.

A OK cool. I did not know that. It is somehow reassuring, because from what I have found out, the previous versions/builds was as easily decompiled as cutting butter...

Well many thanks for the answers, cheers,

NA

batchboy999
11
batchboy999  
Dear folks,
Incredible GA EA development system of your own opportunity!: 
Please help me save hundreds of dollars in programming expense by having a barebones mql/dll C++ subroutine call code micro substructure to use in my main mql programmer's work.  C++ programmers are not cheap.  Important project! Trying to see if can put together a two EA setup "system" to create Genetic Algorythm EAs of your own using the HIGHEST CALIBER Genetic Algorythm processor/resolver on the planet, Discipulus (rmltech.com).  First one to help with this very basic subroutine call like interface will be owed the whole tamale when its done to create your own GA EAs!

I've been told that the way a C++ dll would work subroutine call wise is by passing an "object" with int/floatings in it?  The quantity of values will be 2 to 64. And of course, like a subroutine call, it need obtain the answer back, in this case a 1 or 0. It is to subroutine call a math C++ subroutine code block.

No need fancyness like reading from a csv sheet, I'll have my mql programmer do the whole EA, just make the micro mql part be the fixed values to call with so I can test its working with the C++ code block it is subroutine calling. For those of any dll C++ dll experience, simple, right? (I'm not a programmer, just being my own project engineer on this)

The ultimate end product setup will not be like its superman son TSL (tradingsystemlab.com) with all its ever advancing bells & whistles, but Discipulus in its heart before TSLs advancements was already doing wonders. 

Hope someone can take up this offer and help.

Thanks, 
Truly,
Jerry
Batchj2011 at gmail dot com


lspaziano
5
lspaziano  
batchboy999:
Dear folks,
Incredible GA EA development system of your own opportunity!: 
Please help me save hundreds of dollars in programming expense by having a barebones mql/dll C++ subroutine call code micro substructure to use in my main mql programmer's work.  C++ programmers are not cheap.  Important project! Trying to see if can put together a two EA setup "system" to create Genetic Algorythm EAs of your own using the HIGHEST CALIBER Genetic Algorythm processor/resolver on the planet, Discipulus (rmltech.com).  First one to help with this very basic subroutine call like interface will be owed the whole tamale when its done to create your own GA EAs!

I've been told that the way a C++ dll would work subroutine call wise is by passing an "object" with int/floatings in it?  The quantity of values will be 2 to 64. And of course, like a subroutine call, it need obtain the answer back, in this case a 1 or 0. It is to subroutine call a math C++ subroutine code block.

No need fancyness like reading from a csv sheet, I'll have my mql programmer do the whole EA, just make the micro mql part be the fixed values to call with so I can test its working with the C++ code block it is subroutine calling. For those of any dll C++ dll experience, simple, right? (I'm not a programmer, just being my own project engineer on this)

The ultimate end product setup will not be like its superman son TSL (tradingsystemlab.com) with all its ever advancing bells & whistles, but Discipulus in its heart before TSLs advancements was already doing wonders. 

Hope someone can take up this offer and help.

Thanks, 
Truly,
Jerry
Batchj2011 at gmail dot com


@BatchBoy999, just sent you an e-mail.

I am a computer engineer and forex trader.  I’ve been working closely with an AI professor at Brigham University to develop an intelligent EA, with no success.  Perhaps we can discuss your project.

Lee

To add comments, please log in or register