| New signals service! | |
|
|||||||
| Register in Forex TSD! | |
|
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time). Click here to register and get more information |
|
![]() |
| LinkBack | Thread Tools | Display Modes |
|
||||
|
Quote:
Now a MT4 DLL can connect to a php script but I have never tried to pass the information from the EA to the Website, I was able to successfully do it the other way around though ... You would have to look into windows sockets, and functions such as HTTP_GET / HTTP_POST. Patrick |
|
||||
|
How about something a little easier, using the FTP function in MT4
![]() Set your FTP settings in Metatrader under Tools / Options / Publisher. Then write an EA with something like this: PHP Code:
PHP Code:
For an example Go to this link : MistigriFx - View Trades Enter 123456 for the account number or Click on MistigriFx - View Trades?Account=123456 Patrick Last edited by Mistigri; 03-29-2008 at 04:29 PM. |
|
|||
|
Thanks Patrick
thats a very interesting idea to use the FTP. however I do want to be able to interact with MT - to send the tick and candle info to the .net app and this app communicate back to MT on when to trade. I found this that I thought may help - Simplified Wrapper and Interface Generator However I am a rather entry level programmer, and dont fully appreciate what is involved in having a c++ wrapper middle layer. I would be interested to hear your opinion, if you think this could be a useful tool to use to help bridge between the c++ and .net? |
|
|||
|
Really a C++ question...external DLL for MT4
Hi all,
I have an external DLL that I've written in C++. However, I'm still quite new to C++, so I think that might be why I'm having this problem. I have another version I've written in C# that works fine, except to make C# DLLs callable by MQL I have to alter them, and this alteration appears to cause small memory leaks. I'm hoping someone here can help me out with the C++ version. Here's the story: I've been slowly developing various libraries for programming trading strategies. One of the things I'm trying to do is develop a consistent set of services for various things like logging, locking (thread-safe access to resources), and event notification. So basically, I'm trying to pull MQL up by its bootstraps into a more modern programming paradigm. Anyway, currently I'm working on a library that will allow EAs to receive notification of various trade events (placed, filled, closed). These events could be as a result of trades taken by the event-subscribing EA or from other EAs. To accomplish this, I'm using an external DLL that basically facilitates communication between EAs via message passing. There is a publishing EA that just looks for new trade events and when one occurs, it puts a message onto a queue for the subscribing EA (each subscriber has its own queue). So the problem is this...As long as it's only one message being passed at a time, all works fine. Obviously that's not acceptable at all though. When more than one message is passed at a time, what I'm finding is that the first message gets corrupted (it keeps returning the message as "1" when instead it should be something like "FILLED,1005167"). The second message is fine, but the first is not. I haven't tested more than two messages yet, but presumably we'd still see the same thing. I'd love it if someone knew the answer to what it is I'm doing wrong and could shed some light on my problem. A few notes: 1) I'm eventually going to be releasing this code under Apache 2.0 and so this source file is also being put out there under Apache 2.0...I intend to release this to the community when it's working fairly smoothly. 2) I've repeatedly said 'queue' here, but if you look at the source code you'll see me using a vector instead, and basically using it like a stack. Originally I had a queue, but changed it to a vector just on the off-chance that I was doing something wrong with the STL queue that I wasn't aware of. No such luck. The real implementation will be a queue, but for now neither queue nor vector are working correctly for me. Thanks in advance for any insight. Brandon Wilhite Last edited by bwilhite; 05-23-2008 at 07:53 PM. |
|
|||
|
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. Quote:
|
|
|||
|
Quote:
|
![]() |
| Bookmarks |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| About Fibo extension | phildunn | General Discussion | 11 | 03-30-2008 12:31 PM |
| How do I use the files with .ex4 extension. | NEEL123 | General Discussion | 4 | 04-06-2007 09:13 AM |
| there is any script/program to create walk forward test data for metatrader???? | giraia_br | Metatrader 4 | 1 | 03-26-2007 12:44 AM |
| Please create an EA | matrixebiz | Expert Advisors - Metatrader 4 | 0 | 11-28-2006 07:19 PM |