dmmikl86: I'm a programmer for 2 years in MQL4, studied the tutorial from the site. now I want to learn how to write a dll for mt4. i want to learn how to start writing a dll. advise where to get help, what to read, first I would like to write a simple advisor with dll-key connection, which will create a window with two buttons BUY and SELL. i.e. trade in one click. i appreciate any help ...
good topic, well done compatriot
I am very curious to share my experience and knowledge with the mt4 programmers.
#import "ExpertSample.dll"int GetIntValue(int);
int myfunc(int,int);
double GetDoubleValue(double);
string GetStringValue(string);
double GetArrayItemValue(double arr[],int,int);
bool SetArrayItemValue(double& arr[],int,int,double);
double GetRatesItemValue(double rates[][6],int,int,int);
int SortStringArray(string& arr[],int);
int ProcessStringArray(string& arr[],int);
then added it to the Expert Advisor
int init()
{
double ret,some_value=10.5;
string sret;
int cnt,c;
string strarray[6]={ "first", "second", "third", "fourth", "fifth" };
//---- simple dll-functions call
cnt=GetIntValue(some_value);
Print("Returned value is ",cnt);
ret=GetDoubleValue(some_value);
Print("Returned value is ",ret);
sret=GetStringValue("some string");
Print("Returned value is ",sret);
//----
cnt=SortStringArray(strarray,ArraySize(strarray));
for(int i=0; i<cnt; i++) Print(i," - ",strarray[i]);
cnt=ProcessStringArray(strarray,ArraySize(strarray));
for(i=0; i<cnt; i++) Print(i," - ",strarray[i]);
//----int a=5;
int b=6;
c=myfunc(a,b);
Comment("!!!="+c);
return(0);
}
During the debug in the visual it said: The program "[5248] regsvr32.exe: Machine code" has stopped with code 0 (0x0).
when I run this advisor on the terminal, it says error : 2011.07.08 12:20:14 ExportFunctions EURUSD,H1: cannot call function 'myfunc' from dll 'ExpertSample.dll'(error 127)
Please advise where are the errors and how to fix them...
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
regarding the means - everyone does it their own way
I will when I'm done.
In fact, I was advised to look here for a start http://msdn.microsoft.com/ru-ru/library/1ez7dh12.aspx
I'm a programmer for 2 years in MQL4, studied the tutorial from the site. now I want to learn how to write a dll for mt4. i want to learn how to start writing a dll. advise where to get help, what to read, first I would like to write a simple advisor with dll-key connection, which will create a window with two buttons BUY and SELL. i.e. trade in one click. i appreciate any help ...
good topic, well done compatriot
I am very curious to share my experience and knowledge with the mt4 programmers.
good topic, well done compatriot
And I recommend to tough programmers (as well as site administrators) to start tutorial branches on such topics
Man, we all need your advices, we just can't live without them...
We all need your advice, we just can't live without it...
you could just add a question to the FAQ section with a good answer....
can we just add a question to the FAQ section with a good answer....
I tried to add my function to the .cpp and did it like this:
added a function to .def
added the function to .mqh
then added it to the Expert Advisor
During the debug in the visual it said: The program "[5248] regsvr32.exe: Machine code" has stopped with code 0 (0x0).
when I run this advisor on the terminal, it says error : 2011.07.08 12:20:14 ExportFunctions EURUSD,H1: cannot call function 'myfunc' from dll 'ExpertSample.dll'(error 127)
Please advise where are the errors and how to fix them...
here's all the text from the debug