Hello everyone, I'm new to the forum, I have many Expert Advisor and I need to protect with time limit and account number. This part of the code I would like to put it in a library and have it uploaded by all the experts to their opening, so that, by modifying only this then all the experts work with the new data. I'm lost and I can not get out of it. I put below the code that I have inside the first Expert, I tried with the functions #include and #import but I can not load the data. This is the code: the date and the account number are for example. Thanks a lot to everyone.
//+------------------------------------------------------------------+ // -- EA protection //+------------------------------------------------------------------+ // //string expire_date; ="2018.10.20"; //<-- hard coded datetime year-month-day
// funzione controllo data datetime e_d=StrToTime(expire_date);
if(TimeCurrent()>=e_d) { Alert("The MPA Portfolio EA has been expired"); Comment("The MPA Portfolio EA has been expired"); return(0); }
//---- Account validation check ----
int numconto = AccountNumber(); if (numconto == 0) { Print("Waiting account number..."); return(0); }
datetime nopermitalert=0; if (numconto != AllowedAccountNo && nopermitalert != Time[0]) { Alert("You are not allowed to use This MPA Portfolio Expert Advisor!"); nopermitalert = Time[0]; return(-1); }
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.
//+------------------------------------------------------------------+
// -- EA protection
//+------------------------------------------------------------------+
//
//string expire_date; ="2018.10.20"; //<-- hard coded datetime year-month-day
//
//static int AllowedAccountNo; =156249;
//+------------------------------------------------------------------+
// -- Functions
//+------------------------------------------------------------------+
int start() {
// funzione controllo data
datetime e_d=StrToTime(expire_date);
if(TimeCurrent()>=e_d)
{
Alert("The MPA Portfolio EA has been expired");
Comment("The MPA Portfolio EA has been expired");
return(0);
}
//---- Account validation check ----
int numconto = AccountNumber();
if (numconto == 0)
{
Print("Waiting account number...");
return(0);
}
datetime nopermitalert=0;
if (numconto != AllowedAccountNo && nopermitalert != Time[0])
{
Alert("You are not allowed to use This MPA Portfolio Expert Advisor!");
nopermitalert = Time[0];
return(-1);
}
then continues the EA code