View Single Post
  #27 (permalink)  
Old 05-29-2008, 09:18 PM
Magick Magick is offline
Junior Member
 
Join Date: Mar 2007
Location: Copenhagen
Posts: 6
Magick is on a distinguished road
Quote:
Originally Posted by bwilhite View Post
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.
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.
Reply With Quote