Download MetaTrader 5

Lock EA for multiple users please help!!

To add comments, please log in or register
Karish
138
Karish  

Hello, im trying to create a function that locks the EA for different users to use only by their AccountNumber

please help something is wrong here.. when im using only one user like here it is working fine and no problem what so ever:

bool LockToAccount=true;
int AccountNum=12345;

if(LockToAccount&&AccountNumber()!=AccountNum){Print("Account Number is WRONG!");return(true);}
but the problem showing up when im using multiple users like so, and even when one of the account is the allowed to use account, it still wont pass me..:
bool LockToAccount=true;
int AccountNum=12345;
int AccountNum2=22222;
int AccountNum3=33333;

if(LockToAccount&&AccountNumber()!=AccountNum||AccountNumber()!=AccountNum2||AccountNumber()!=AccountNum3){Print("Account Number is WRONG!");return(true);}
please help me out here i dont know whats wrong here, everything seems to make sense but still it wont pass none of the accounts not AccountNum not AccountNum2 and not AccountNum3..
thank you hoping to get some help here please..
Daniel Stein
33413
Daniel Stein  

Think about this line of code:

if(LockToAccount&&AccountNumber()!=AccountNum||AccountNumber()!=AccountNum2||AccountNumber()!=AccountNum3)

You can't combine an && with multiple || conditions

Build a new logical structure... 

To add comments, please log in or register