Any good tutorials or literature on developing Dynamic Link Libraries (DLLs) to work with Metatrader?
- Migrating MT5 to MT4 in Python
- Backtesting Questions from a newb
- Requests & Ideas
[...] and the advantages they offer MT4 by using dlls?
Various advantages spring to mind:
- Re-use of existing code, rather than having to rewrite things in MQL (not applicable in your case)
- Ability to transfer code from MT4 to other trading platforms (probably not applicable in your case)
- Speed of execution (though MQL is pretty fast except when used for some fairly niche scenarios)
- Availability of richer language features such as classes, inheritance etc (many of which are coming in MT5)
- Greater ability to call Windows API functions, other code libraries, etc
- Availability of better debugging tools than in MQL.
- Obfuscation of code. It's much harder to "decompile" a DLL than an EX4 file.
Just wondering if someone can point me in the right direction for some good tutorials to start learning about dynamic link libraries (dlls)
Writing DLLs basically means writing in C or C++. Off the top of my head, the only mainstream higher-level language which may offer the ability to write the sort of DLLs usable by MetaTrader (i.e. non-COM DLLs) is possibly Delphi.
Writing in MQL isn't a bad foundation for writing in C - the former is basically derived from the latter. But low-level languages such as C give you all sorts of extra headaches such as having to take care of memory allocation yourself, and having to understand the mechanics of memory addresses etc. Basically, it's very easy to make a DLL cause a fatal crash, whereas this should be impossible in MQL. The more general point is that a higher-level language such as MQL should give you greater speed of development than a lower-level language, traded off against a loss of flexibility and speed of execution.
Having said all that, I wouldn't know where to recommend that you start in learning about C/DLLs. Over to someone else...
Have you compiled, executed, and modified the sample DLL code included with MT4?
NO....i didn't know it included dlls?
The samples directory of an MT4 installation includes the C source code (and Visual Studio project files) for an example DLL. It's going to be pretty meaningless and intimidating as a starting point if you're not familiar with C. Which I'm guessing you're not.
I don't even know what a dll does....much less have any experience with C.
I do know PERL pretty well though (lotta good that'll do me)
Look again with Windows File Explorer
On mine it is
D:\Program Files (x86)\MetaTrader\FXDD - MetaTrader 4\experts\samples ├───DLLSample │ ExpertSample.cpp │ ExpertSample.def │ ExpertSample.dsp │ ExpertSample.dsw │ StdAfx.h │ ├───include │ sampledll.mqh │ └───libraries ExpertSample.dll
I don't even know what a dll does....much less have any experience with C.
I do know PERL pretty well though (lotta good that'll do me)
Knowing Perl is sorta of a Hero's badge imho. bout 1oyrs ago I based a selling site's server side ordering with it.
Then one happy day, I came across a buglet feature that just would not go away. Nobody seemed to understand. A sobering time...
But, seriously - IF can stand the PERL heat what are you waiting for???
MQL4 and/or C is seriously simple.
Is not the syntax, is the understanding and learning the howto's of an HLL. Web is overflowing with many tutorial sites on C
https://en.wikipedia.org/wiki/Dynamic-link_library gives you background.
I was looking at Metaeditors files (dumb!)
I found them in the root folders.
Now, how can I use this dll to learn?
Its a sample, like "Hello World"
Do you have a C compiler?
Can you compile the sample DLL?
Can your EA/Indicator/Script find and attach the DLL, and communicate with it?
Can you unerstand the sample and modify it?
There are many basic tasks to get out of the way before you can do anything exciting.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use