Create your own MetaTrader extension (dll) - page 12

 
mladen:
kfirmt

Excuse me for asking, but did you actually ever code in C/C++/C#?

It does not get simpler than the example from that post

I did code a lot in C#, just not with MetaTrader, so its new to me. I'm trying to use now the MetaEditor with the code that you gave to me, but the variable are not defined. how should I define each one of them?

 
Mistigri:
Do you mean "write a web service" that talks to a MT4 dll?

To be honest I have not looked at that, I did write in a MT4 DLL a function that connects to my web server and authenticates users, but on the server side the code is written in PHP ...

I can help with the windows socket part but I can't give out the whole setup

Patrick

Hi Patrick,

Thanks for the video. I would like to send/receive data between MT4 and Mysql database. I have tried "libmysql.dll" and "mysql-wrapper" (based on libmysql.dll), but it seems not stable.

I got example to create PHP socket, but it's for unix based system, and using PHP CLI to run it (#!/usr/local/bin/php -q), but my OS is windows XP.

I know that PHP can make good work with Mysql. Is it possible in Windows XP to create PHP tcp/ip socket (as server) and MT4 EA/Scripts (as client) to get/put data to Mysql database ?

Or may be make a client server communication. So the MT4 EA/Scripts (as Client) call a PHP page on Apache web server (as server - having WAMP/XAMMP/EasyPHP in windows XP), then the PHP send/get data to/from Mysql and send the result back to MT4. Is it possible?

Any idea how to do it ?

Thanks

=pedma=

 

Hi Patrick,

I found the answer here: "Native" MQL HTTP Client - MQL4 Code Base

Thanks

-pedma-

 

MQ4 to dll : indicators inside

Hi I am looking for the following mq4 to be translated into an external DLL to be used in Neuroshell. I had someone try to help me with this but they were unable. Can anyone check this out? CFP and complex pairs are the indicators. CFP is a tricky one because it is calling on all currency pair data simultaneously in order to give a value (its a separate indicator window w/ a line graph). Let me know if you need anymore info !

Files:
indicators1.zip  25 kb
 
pipscooper:
I wrote a sample project that may help those who are attempting to write an unmanaged C# DLL, and access it from Metatrader. You can see the source code to Export C# DLL to Metatrader Code Sample including a downloadable VS project. This code uses the C# Project Template for Unmanaged Exports by Robert Giesecke (link below).

The sample has been updated for Metatrader Build 600+. This C# DLL sample shows how to export DLL functions from C# using a NuGet package, and then reference those C# DLL functions from within MQL4.

Code to Export C# DLL to Metatrader 4 Build 600+

I hope this helps someone!

 

As I understand we need to put important code into a dll because if nobody can decompile it.

But I already have a few questions about the function and the use of dll's.

1.Can I only create dll's with C, C++ or C# projects?

2.Why can't I compile my mql4-Project directly into a dll? Why doesn't offer Metaquotes this opportunity or anyone else so that this works automatically?

3.Is it a big work to create a dll for my existing project?

Can I do it everytime in the same way, so that I have an empty dll-project and only have to copy my functions out of my indicator or expert advisor and put it into the dll project?

4.Is it possible to put also a picture into the dll, so that I don't have to send it separatly?

 

How can I sort an metatrader array using dll?

 
apprentice coder:
How can I sort an metatrader array using dll?

If you mean how to sort it in a dll and return the sorted result, the only way is to pass the array that you want to hold the results in a sorted form by reference to the dll

 
mladen:
If you mean how to sort it in a dll and return the sorted result, the only way is to pass the array that you want to hold the results in a sorted form by reference to the dll

Thanks

Is there a way that we get an array as a return value from the dll function?

 
apprentice coder:
Thanks Is there a way that we get an array as a return value from the dll function?

The only way to do that using metatrader is to create an array, pass it by reference to the dll function and fill that array. Metatrader does not accept arrays as return values from dll functions

Reason: