Lock account number and time limit

 

Dear Sir,

I need somebody to correct the follow code:

#property copyright " www.OnlyWinnerClick.com "

#property link      "www.OnlyWinnerClick.com" 

const string allowed_broker = "Instaforex Companies Group";

const long allowed_accounts[] = { 61736192, 436290, 646490, 225690, 279260 };

                             

int password_status = -1;



//+------------------------------------------------------------------+

//| Expert initialization function                                   |

//+------------------------------------------------------------------+

int OnInit()

  {

//---

   string broker = AccountInfoString(ACCOUNT_COMPANY);

   long account = AccountInfoInteger(ACCOUNT_LOGIN);

   

   printf("The name of the broker = %s", broker);

   printf("Account number =  %d", account);

   

   if (broker == allowed_broker) 

      for (int i=0; i<ArraySize(allowed_accounts); i++)

       if (account == allowed_accounts[i]) { 

         password_status = 1;

         Print("EA account verified");

         break;

       }

   if (password_status == -1) Print("EA is not allowed to run on this account."); 

    

//---

   return(0);

  }

//+------------------------------------------------------------------+

//| Expert deinitialization function                                 |

//+------------------------------------------------------------------+

void OnDeinit(const int reason)

  {

//---  

  }

//+------------------------------------------------------------------+

//| Expert tick function                                             |

//+------------------------------------------------------------------+

void OnTick()

  {

//---

  if (password_status == 1) 

  {

    // password correct

  } 

  }------------------------ 4 --



datetime allowed_until = D'2016.02.11 00:00'; 

                             

int password_status = -1;



//+------------------------------------------------------------------+

//| Expert initialization function                                   |

//+------------------------------------------------------------------+

int OnInit()

  {

//---

   printf("This EA is valid until %s", TimeToString(allowed_until, TIME_DATE|TIME_MINUTES));

   datetime now = TimeCurrent();

   

   if (now < allowed_until) 

         Print("EA time limit verified, EA init time : " + TimeToString(now, TIME_DATE|TIME_MINUTES));

   

    

//---

   return(0);

  }

//+------------------------------------------------------------------+

//| Expert deinitialization function                                 |

//+------------------------------------------------------------------+

void OnDeinit(const int reason)

  {

//---

  }

//+------------------------------------------------------------------+

//| Expert tick function                                             |

//+------------------------------------------------------------------+

void OnTick()

  {

//---

  if (TimeCurrent() < allowed_until) 

    {        

    }

   else Print("EA expired."); 

  } 
 
Suy Kok Yik:

Dear Sir,

I need somebody to correct the follow code:

Hello Suy Kok Yik,

Please take a look at the Freelance section of the website.

Regards,
Malacarne 

 
code is ok. actually what u want
 
web11:
code is ok. actually what u want

But how come the EA still allowed to attached to different broker and different account ?

 
Suy Kok Yik:

But how come the EA still allowed to attached to different broker and different account ?

Can you help me to correct my EA ? I will send you my EA and can you help me to add in this lock into my EA?
 

of course it still allows all brokers because you only filter on time.

void OnTick()

  {

//---

  if (TimeCurrent() < allowed_until) 

    {        

    }

   else Print("EA expired."); 

  if you want more filter you have to code them in as well.

 
Marco vd Heijden:

of course it still allows all brokers because you only filter on time.

  if you want more filter you have to code them in as well.

Sir
Can i send u my EA and you help me to code  in the allow  period  , broker and limited by account  no?

Regards  
Reason: