Create your own MetaTrader extension (dll)

To add comments, please log in or register
Ahmed Soliman
19533
Ahmed Soliman  
Anybody interested in creating his/her own MetaTrader extension (dll) may go to:

Create your own MetaTrader extension (dll) - Part 1

Create your own MetaTrader extension (dll) - Part 2

There'll be another part (or 2) which I'm writing them!

Hope you enjoy them!
Amritendu Maji
1446
Amritendu Maji  

Thanks a lot!

cubesteak
367
cubesteak  
codersguru:
Anybody interested in creating his/her own MetaTrader extension (dll) may go to:

Create your own MetaTrader extension (dll) - Part 1

Create your own MetaTrader extension (dll) - Part 2

There'll be another part (or 2) which I'm writing them!

Hope you enjoy them!

WOOT WOOT WOOT!

deeforex
93
deeforex  

EXCITING!!!!!

Codersguru you are FANTASTIC! THANKS!

dee

FX_Sniper
489
FX_Sniper  

Excellent Resource !!!

Eric Venturi-Bloxs
1068
Eric Venturi-Bloxs  

Hello codersguru!

Great courses you write there. Thanks.

I try to create a dll and test it on MT4. I have an error code 127 (cannot call function 'Test' from dll 'ExpertSample.dll' (error 127))

Here is all the process i do:

1. write the .cpp:

#define WIN32_LEAN_AND_MEAN

#define MT4_EXPFUNC __declspec(dllexport)

#include

BOOL APIENTRY DllMain(HANDLE hModule,DWORD ul_reason_for_call,LPVOID lpReserved)

{

switch(ul_reason_for_call)

{

case DLL_PROCESS_ATTACH:

case DLL_THREAD_ATTACH:

case DLL_THREAD_DETACH:

case DLL_PROCESS_DETACH:

break;

}

return(TRUE);

}

MT4_EXPFUNC int __stdcall Test()

{

return(12);

}

2. i write the .def:

LIBRARY ExpertSample EXPORTS Test

3. I compile, no error, and i put the ExpertSample.dll in the \experts\libraries folder

4. i create my mq4 test file:

#property indicator_chart_window

#import "ExpertSample.dll"

int Test();

#import

int init() { return(0); }

int deinit() { return(0); }

int start() { Alert( Test() ); return(0); }

5. i compile, no error

6. Attach the indy test on chart, check allow dll and ... error 127.

In VC++ i have problem to compile because of windows.h is not find. Then i use DevC++ or Code::Blocks with no error at compile.

My questions: did i forget something, in coding, in c++ project parameters or something else?

Thanks for your help.

FerruFx

ralphronnquist
420
ralphronnquist  

I'm far from expert on writing dll's on windows, but I did manage to write one for MT4 by using gcc on cygwin. Apart from the incantations in the code, the compiler needed some arguments in order to avoid using its defaults for dependent dll's. Maybe you have a similar problem?

The gcc arguments I used were: -shared -Wl,--add-stdcall-alias -mno-cygwin

Of course I don't know your compiler, so maybe this is of no help at all.

Pawel Masiewicz
6
Pawel Masiewicz  

Has anyone tried to write dll for MT4 with C# using VisualStudio2005? I've made an attempt but I keep geting error 127. Perhaps .net is not a good technology to write libraries for MT4?

Thx,

Pawel

bcforex
4
bcforex  

Where to get the script of ProfitProtector Expert Advisor

Hi codersguru,

I am very new to the MQL4 programming. I have downloaded your pdf manual. And I have found that you have explained the code snipets very well in the manual. I am very interested in learing about the Expert Advisor and surprised to learn that you can do a lot of things with this language for trading. In the manual, youu have mentioned that I can download the ProfitProtector script from your site. So far, I am not able to find the script. Please guide me how to download the sample script.

Thanks

Patrick
40
Patrick  

Video - Write a DLL for MT4

Just finished a video on how to write a DLL for MT4 ... I tried to make an example that returns an array since it's really what I though was missing when I first started to look into the sample provided by MetaQuotes.

Watch Video

If you are only interested in the code and VS 2008 project, these can be downloaded Here.

Hope you like it

Patrick

Ovidiu Marius
610
Ovidiu Marius  

Sweet, thanks for the video

To add comments, please log in or register