Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.
From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.
Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
Elite Section
Get access to private discussions, specialized support, indicators and trading systems reported every week.
Advanced Elite Section
For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
Since I was here, I thought I'd share my experience. What you are wanting to do can certainly be done, and I've done it many times myself.
When I first started writing DLLs for use in MT4 I couldn't ever get it to work in C++. I think the problem was/is that my project settings were always incorrect in Visual Studio (there's so d@$% many of them). Just recently I found an example from CodeGuru, which I was actually able to compile and use. Now I basically cleaned out that project and use it as a template.
In the meantime, I've been writing C# DLLs and using this excellent tool here. It basically takes the IL and alters it so that it can be called from unmanaged code. The only problem is that MT4 seems to exhibit a memory leak when doing this. I haven't definitively determined if that's due to MT4 or the altering of the IL, or what, but it happens.
Next I'll either be learning to write wrappers on C++ and/or just go ahead and learn C++. Hopefully that will address the memory issue.
Anyway, what you are wanting to do can definitely be accomplished. I've managed to write some pretty complicated DLLs for MT4 in C#, including things like remoting, raw sockets, http, WinForms. Pretty much anything you can do with .NET can be called from MT4 this way (you name it, and I've probably done it). And it's very reliable. The only problem is the relatively slow memory leak.
Were you ever able to identify the source of this slow leak bwilhite? I'd appreciate your help in this area if you are still willing. At the moment, I'm looking for a simple mql dll that will allow me to send and receive messages via sockets. I'm familiar with the basics of c#, so if I could find a way to take advantage of the, all the better.
bwilhite you are a life saver! That looks like a great tool. Do you, by chance, have a c# project that demonstrates communicating with MT from C#? What I am wanting to do is have my .net app tell MT when to trade. Or perhaps you can recommend a link that could help. Any help would be greatly appreciated.
Have you had any luck with this Magick? This is exactly what I am looking to do as well - have the .net app tell MT when and what to trade. Please let me know if you have found a solution.
I also appreciate and would like to hear more from bwihite. Do you have any sample c# dlls that you could share.
Of course that's not ALL that they contain, but that's the pertinent information. Now, based on my understanding, I have everything there to try to call the function from MT4.
For some reason, it's just not "seeing" that it exists. I thought it was the fact my DLL lacked a .def file, but even after manually creating it one it still doesn't work. Also, I believe the MT4_EXPFUNC line means that the function will be exported anyhow, so a .def is unnecessary. The whole thing compiles fine, the EA runs fine right up until I try to call the function (as it can't see it) and then it stops.
I'm at my wits end. I really thought it was a .def issue, but the more I think about it, I don't believe it is.
I'm having some major problems getting my own DLL to function.
I finally got it to the point where it can call the dll from within an EA, and it doesn't give me the 127 error. Unfortunately, every single time I get an exception.
I've attached the entire project, and the MT4 files.
If one of you programming gods could just take a quick look at it, I'd be very grateful!
[NOTE: Compiled on Visual Studio C++ Express 2008 Edition, running on Vista x64 Ultimate dual-core w/ 6GB RAM]
-Jason
__________________
//AirforceMook//
Last edited by AirforceMook; 03-05-2009 at 09:44 PM.
There has been a critical error
Time : 2009.03.05 14:32
Program : Client Terminal
Version : 4.00 (build: 220, 7 Nov 2008)
OS : Windows Vista Professional 6.0 Service Pack 1 (Build 6001)
Processors : 2 x X86 (level 15)
Memory : 4194303/4194303 kb
Exception : C0000005
Address : 8B222B17
Access Type : read
Access Addr : 8B222B17
creation .dll file with Dev-C++ Editor for Metatrader
Have somebody experience to create a .dll file with Dev-C++ that can be used for Metatarder.
When i trie it i think the .def file is not correct includet in the .dll file, and i become the error 127.
I have find a tutorial how I can create .dll file for Metatrader with Visual Studio, but not with the free version, in the free version there is no possibility to create MFC-Dll like in the tutorial I have see.
It would be helpfull for much people I think if anywhere is a tutorial how to create .dll files with the open source free editor Dev-C++ for use in Metatrader.