DLL Imports + MT4 = ?

 

Hi,

I noticed that it's possible to incorporate Windows DLLs into MT4 (I saw the checkbox in the options menu). Just curious, what are people doing with this feature? I would like to have a second window outside the MT4 sandbox showing various statistical calculations and other data. Could this be accomplished via this DLL import feature? Are there any documentation/tutorials with more information?

Thanks in advance!

Vishal

 

Allmost can do anything (some things need to cooperate with other program), but first you should know what is DLL, what DLL can do, and how to program a DLL.

most time, use DLL is to calculate something with data from MT and give data to MT.

MT data -> DLL, and MT <- data from DLL. So you can do anything if you want and you can, since data can be anything except user interface(since use thread is to0 complex and too diffcult for a DLL inside MT process).

if you want a second window outside the MT4 sandbox showing various statistical calculations and other data?

you should program a program (A) alone with C/C++ for your second window,

and a DLL (B) for MT, and communicate between the DLL (B) and your program (A) using some kind of communication betweent processes.

SO the information you need is C/C++, communication betweent processes in Windows' SDK, and MT's sample for DLL in MT directory.

MT====== DLL (B) ======Program or software (A).

So you should code (B) and (A).

 
DxdCn:

you should program a program (A) alone with C/C++ for your second window,

There are compilers for more programming languages around than only C and C++ and most of them are better and easier to use. What happened to this generation that they don't know anything about compilers and languages anymore?
 

And this (for those who talk about C/C++ without knowing what they are talking about and how stupid this always sounds to other people)

From Stroustrup's C++ Glossary:

C/C++

A mythical language referred to by people who cannot or do not want to recognize the magnitude of differences between the facilities offered by C and C++ or the significant differences in the programming styles supported by the two language.

 
DxdCn:

anything except user interface(since use thread is to0 complex and too diffcult for a DLL inside MT process).

Why is it difficult? Could it be possible that you have not the slightest clue about programming and only want to post something every few days so that your quota of posts per month is fulfilled?


What on earth makes you think that only you not knowing what a thread is an how to create (or even use) one makes it difficult for all others to use them?

 

vgoklani:

Are there any documentation/tutorials with more information?

There is a tutorial on forexfactory: http://www.forexfactory.com/showthread.php?t=219576 and of course it won't require you to touch any C++ or C compiler since it is the year 2010 and there are more advanced tools around nowadays.
 

vgoklani:

Just curious, what are people doing with this feature?

I wrote an mql4-Python binding (available for free, just google for it). It easily allows you to start an arbitrary number of threads and even use GUI (I have one example with an EA hat opens a PyCrust shell in a separate thread to prove the concept). With this python binding I managed to make an EA that will communicate with R (I used the RPy Python-R bindings) to use a support vector machine for price predictions. In the end I was able to directly call R functions and get return values from mql4. At the moment I am working on another more direct interface between mql4 and R and I will publish it under an open source license when it is done.
 
7bit:
I wrote an mql4-Python binding (available for free, just google for it). It easily allows you to start an arbitrary number of threads and even use GUI (I have one example with an EA hat opens a PyCrust shell in a separate thread to prove the concept). With this python binding I managed to make an EA that will communicate with R (I used the RPy Python-R bindings) to use a support vector machine for price predictions. In the end I was able to directly call R functions and get return values from mql4. At the moment I am working on another more direct interface between mql4 and R and I will publish it under an open source license when it is done.


"support vector machine for price predictions."

how is this working for you? This is on my list of things to try, and it's one of the main reasons I wanted to use a DLL.

I can program in C/C++ and Java, but all on UNIX. I can poke around at things in Python and R/Matlab too, but weakly-typed programming languages make me nervous :)

Thanks for the forexfactory link, please feel free to send me anything else that might be useful.

 
DxdCn:

Allmost can do anything (some things need to cooperate with other program), but first you should know what is DLL, what DLL can do, and how to program a DLL.

most time, use DLL is to calculate something with data from MT and give data to MT.

MT data -> DLL, and MT <- data from DLL. So you can do anything if you want and you can, since data can be anything except user interface(since use thread is to0 complex and too diffcult for a DLL inside MT process).

if you want a second window outside the MT4 sandbox showing various statistical calculations and other data?

you should program a program (A) alone with C/C++ for your second window,

and a DLL (B) for MT, and communicate between the DLL (B) and your program (A) using some kind of communication betweent processes.

SO the information you need is C/C++, communication betweent processes in Windows' SDK, and MT's sample for DLL in MT directory.

MT====== DLL (B) ======Program or software (A).

So you should code (B) and (A).


Thanks for the reply. Do you know of any sample code/documentation which shows communication between C/C++ and MT4 via a DLL? I can do both Java and C/C++, and I can pick up anything that I need to learn. I am just looking for a starting point, something to build from.
 
vgoklani: things in Python and R/Matlab too, but weakly-typed programming languages make me nervous :)

No need for nervousness. They are useful, they are valuable tools. The nature of this whole algo trading thing presents a completely new class of problems that are usually not known to the "conventional" enterprise applications programmer. You will face problems that you never faced before: You do not only try to implement a solution to a problem, you also do not even know what the problem actually is! You will do a *lot* of prototyping and groping in the dark, trying all sorts of things, only to throw away most of the code after you found it won't bring you forward.

And for rapid prototyping of such experimental programs you can use languages like Python and R, you will also start building yourself a repository of easily reusable components for a lot of sub-problems that you can simply plug together and you will also make use of entire data mining suites like knime and rapidminer for your research (it is research, not only coding). And only when you found something really promising - and this won't happen very often - it is worth casting it into concrete by implementing it (or parts of it) in a different language.

 
vgoklani:


"support vector machine for price predictions."

how is this working for you?

it was not the holy grail. But it also was not useless either. I tried to predict whether the market will be more long or more short during the next x hours based on recent history from several other currencies, the current time and the weekday. At the moment it is not my #1 candidate, but I also did not try many other things that would have been possible and I still have some ideas with it in the back of my mind. This is all very time consuming.