Visual C++ Express Edition 2010 (free edition) HOW to create DLL for Meta Trader 4 ?

 

Hi,


Anybody knows how to create DLL for Meta Trader using Visual C++ Express Edition 2010 (free edition) ?

And how to code the main OrderSend(), OrderModify() and OrderClose() functions on DLL and use external DLL file on Meta Trader 4 under Expert Advisor ?


I need any tutorial or other help, please.


Regards,

Puncher

 

Use OrderSend(), OrderModify() and OrderClose() functions in mql4 itself.


 

How to Exchange Data: A DLL for MQL5 in 10 Minutes -> https://www.mql5.com/en/articles/18

Guide to writing a DLL for MQL5 in Delphi -> https://www.mql5.com/en/articles/96

.

https://www.mql5.com/ru/code

https://www.mql5.com/en/code

 
Delphi is proprietary. use Lazarus/FPC instead.
 
7bit:
Delphi is proprietary. use Lazarus/FPC instead.

Hi 7bit,

What language should I use in order to build DLL under Lazarus ?

I have 64-bit windows system.

Rgds,

 
puncher:
What language should I use in order to build DLL under Lazarus ?

Lazarus uses the same language as Delphi: Object Pascal.

But judging from the way you are asking your questions I think it will take a long time until you are able to make your first MT4 DLL in *ANY* language. There are many little details involved in making a DLL usable for MT4 that are not obvious and not easy to figure out on your own and it is *ESSENTIAL* that you fully understand ALL of them.

Your questions suggest that you are not a very experienced programmer and not yet fully familiar with MQL4 and you already want to dive into an area of programmig where you will be confronted with complicated and tiny details on the lowest level of the machine. It is like if you are just in the process of learning to ride a bicycle (the training wheels are still attached to it) and already asking someone to tell you how to ride the 1500cm³ Kawasaki. This won't work!

 

7bit, I've read your thread on creating DLL with Lazarus. It's very clear & instructive, though I haven't tried it yet. I knew also your inclination to Python.

At one point I was ready to go the C++ or C# path but now I'm sort of on a diverge road. Since I don't have enough time to master new languages and I want to be certain enough I picked the right ones. 

Questions : If I were to opt Python and ObjectPascal would those cover all needs such as creating stand-alone application for Windows, Macs, Mobile apps (or do I still need to learn Java for this?)? I know a programmer use COM also to extend mq4 to use Windows forms & GUI, would learning that be unnecessary if I learn Python and ObjectPascal? I don't have formal programming background so my descriptions are perhaps very 'loose' on this. Thanks in advance. 

 

cameofx:

If I were to opt Python and ObjectPascal would those cover all needs such as creating stand-alone application for Windows, Macs, Mobile apps (or do I still need to learn Java for this?)

With Lazarus / Object Pascal you will be able to make GUI applications for Windows, Windows CE, Mac, Linux and most Unixes. I know of no other environment or Language (neither commercial nor free) that combines all the advantages of Lazarus in one product:

  1. Very elegant and clean and powerful programming language (superior to C++ in terms of usability, eqal in terms of performance and better in terms of memory usage)
  2. The Lazarus IDE has one of the best GUI form designers that is available anywhere today (equally good as the one in Netbeans)
  3. The GUI components will use native widgets on Windows and Mac and use GTK2 on Linux (alternatively you can also link it to Qt4 on all supported platforms)
  4. Your programs will compile on every supported processor and OS from the exact same source code with minimal (or no) modifications and they will compile to native machine code (as fast as C) and produce standalone executables without any dependencies to any runtime libraries.

It is currently not really usable for making Android Apps (you can't avoid using Java for this). It is also not yet usable for iPhone development. (It supports the processors and you can do some non-GUI stuff (libraries) but not full blown GUI applications yet).

For most of my application programming needs (I don't make mobile applications) when I need a GUI application and also when I need to do some low level stuff FPC/Lazarus is the tool of choice.


Python on the other hand is a language that is entirely different and has advantages but also disadvantages compared to a language like Pascal. Generally it is on a much higher level of abstraction, you can express more complicated things with less code, it is a dynamically typed language, it frees you from having to care about many annoying little details that only distract you from the actual problem you are trying to solve, I believe Python has a very high ranking amongst the most beautiful programming languages ever created by mankind. But these advantages also have their price: Python programs do not compile to native machine code, they run slower and they require their runtime environment (the python interpreter) installed on the target computer. However: I strongly recommend learning this language, whatever other languages you might want to learn additionally, Python should be in your repertoire and you will find many occasions where a little Python script is just the best tool for the job.

Most of my scripting (and also some prototyping) is done in Python. I used to do also cross platform GUI apps in Python with wxPython a few years ago but nowadays all my GUI needs are fully satisfied by Lazarus.


There are many more options and you should learn as many languages as possible. For example I didn't yet mention Java. You can easily do cross-platform stuff in Java (also GUI, I recommend Netbeans), the Java runtime can normally be expected to be installed on every consumer PC. Disadvantages might be that your GUI will not look native and the programs will use a bit more RAM and if you do number crunching it might be a bit slower than Pascal but for some applications Java/Swing might be an alternative to FPC/LCL (Lazarus). The Java runtime is available for virtually everything that can calculate with ones and zeros. There are also some trading platform APIs that are based entirely on Java (finally on-topic again), and many libraries you might need for some things are available for Java, you should learn Java also, it doesn't hurt.

If there were no Lazarus I would use Java/Swing/Netbeans for all my cross platform application needs (Java/Netbeans and Pascal/Lazarus are currently the only two players in this league).

 
7bit:

Lazarus uses the same language as Delphi: Object Pascal.

But judging from the way you are asking your questions I think it will take a long time until you are able to make your first MT4 DLL in *ANY* language. There are many little details involved in making a DLL usable for MT4 that are not obvious and not easy to figure out on your own and it is *ESSENTIAL* that you fully understand ALL of them.

Your questions suggest that you are not a very experienced programmer and not yet fully familiar with MQL4 and you already want to dive into an area of programmig where you will be confronted with complicated and tiny details on the lowest level of the machine. It is like if you are just in the process of learning to ride a bicycle (the training wheels are still attached to it) and already asking someone to tell you how to ride the 1500cm³ Kawasaki. This won't work!



Not true, anyone with half a brain and the ambition to learn can pick up a new langauge, albeit with a lot of trial and error and 'bang your head into the keyboard' moments. I know a lot of people who consider themselves an expert in something try to raise it to a level of black magic in order to feed their own egos. I've actually had a plumber tell me that I couldn't possibly clear my own drain because ' I didn't have the expertise', Really?

 
bryans1620:


Not true, anyone with half a brain and the ambition to learn can pick up a new langauge, albeit with a lot of trial and error and 'bang your head into the keyboard' moments.

I did not write it is impossible for him, I only wrote that it is NOT EASY and will take him MUCH TIME to learn these things. Only "half a brain" won't be enough, a fully intact brain is needed.

I made a guess about his current level of experience and his expected learning rate and then I posted the end result of my calculations: The result is: it will take him a long time because he is obviously only at the very beginning of this journey and not already almost there.

 
bryans1620:

I've actually had a plumber tell me that I couldn't possibly clear my own drain

How many percent of the population can clear their drain (and how long did they need to learn it)?

How many percent of the population can read and understand a stack dump?

Reason: