I need to know how to limit an EA to account No.

 

Hello,

I got my EA coded via a friend, how can I limit it to an account no. or a broker company, so if it is launched on another account number or another broker company, it doesn't work, as I want to give it to someone but don't want to allow him to sell it.

 

Linux

> I got my EA coded via a friend

Better look after that one ;)

Something like this will get you started - OTTOMH :)

//+------------------------------------------------------------------+
//|                      www.selectfx.net                            |
//+------------------------------------------------------------------+



extern string UserInfo = "=== License Settings ===";
//#######################################
extern int LicenseEndYear=2009;
int RealLicenseEndYear=2009;
extern int LicenseEndMonth=11;
int RealLicenseEndMonth=11;
extern int LicenseAccount=1234;
int RealLicenseAccount=1234;
//#######################################




//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {


// Check each tick section START


  if (Check_License()!=0) return(0);

// ===== Your code stuff ========








// ===== Your code stuff ========

// Check each tick section END


   return(0);
}





int Check_License()
{
     if(Year()>RealLicenseEndYear)
     {
      Print("License Expired on Year: ", RealLicenseEndYear, " for this EA!");
      Alert("License Expired on Year: ", RealLicenseEndYear, " for this EA!");
      return(1);  
     }
     
     
     if((Year()==RealLicenseEndYear) && (Month()>RealLicenseEndMonth))
     {
      Print("License Expired at Month: ", RealLicenseEndMonth, " for this EA!");
      Alert("License Expired at Month: ", RealLicenseEndMonth, " for this EA!");
      return(2);  

     if(AccountNumber()!=RealLicenseAccount)
     {
      Print("Account Number: ", AccountNumber(), " not licensed for this EA!");
      Alert("Account Number: ", AccountNumber(), " not licensed for this EA!");
      return(3); 

     }
     
   return(0);
}




Good Luck

-BB-

 
BarrowBoy:

Linux

> I got my EA coded via a friend

Better look after that one ;)

Something like this will get you started - OTTOMH :)

Good Luck

-BB-

Thank you, but I can't still figure it out for the account no. or broker name

 

Account number is in the example above

Broker name is found by using AccountServer()

 
BarrowBoy:

Account number is in the example above

Broker name is found by using AccountServer()

Yes, just got it, thank you so much, I'll be trying it.

 

...Or just do it super simple:

int start() {
//------ Authenticate --------------
if (  AccountNumber()!=123454321)
   {
    Alert("Unlicensed copy!");
   return;
   }
//----------------------------------

//Your normal code starts here
 
DayTrader:

...Or just do it super simple:


Thank you so much, that's an easy way :)

 

how to set " Your Account Is Approve " in Comment ( Big Text )


int start() {
//------ Authenticate --------------
if (  AccountNumber()!=123454321)
   {
    Alert("Unlicensed copy!");
   return;
   }
//----------------------------------

//Your normal code starts here
Reason: