Store the allowed account numbers in an array and check if the current account number is equal to any of the account numbers stored in that array
Store the allowed account numbers in an array and check if the current account number is equal to any of the account numbers stored in that array
I appreciate the reply. Could you please give an example? I tried this
but it's not working. I'm pretty new to coding.
I appreciate the reply. Could you please give an example? I tried this
It is done like this :
int acc_number[]={1249275,8633,9985};
It is done like this : int acc_number[]={1249275,8633,9985};
Much appreciated. I modified the code:
bool use_demo=True;
int demo_year=2015;
int demo_month=7;
int demo_day=30;
//Account Number Lock
int acc_number[]={1249275,8633,9985};
int start() {
//demo
if(use_demo)
{
if((Year()>demo_year || (Year()==demo_year && Month()>demo_month) || (Year()==demo_year && Month()==demo_month && Day()>=demo_day)) || IsTesting())
{
Alert("License Expired, Contact Seller: example@example.com");
return(0);
}
}
//acc number
if(acc_number[]!=0 && acc_number[]!=AccountNumber())
{
Alert("EA Not Licensed For Your Account Number, Contact Seller: example@example.com");
return(0);
}But I'm getting an error at the bottom line "expression expected". Many thanks again for your tutoring.
Much appreciated. I modified the code:
bool use_demo=True;
int demo_year=2015;
int demo_month=7;
int demo_day=30;
//Account Number Lock
int acc_number[]={1249275,8633,9985};
int start() {
//demo
if(use_demo)
{
if((Year()>demo_year || (Year()==demo_year && Month()>demo_month) || (Year()==demo_year && Month()==demo_month && Day()>=demo_day)) || IsTesting())
{
Alert("License Expired, Contact Seller: example@example.com");
return(0);
}
}
//acc number
if(acc_number[]!=0 && acc_number[]!=AccountNumber())
{
Alert("EA Not Licensed For Your Account Number, Contact Seller: example@example.com");
return(0);
}You have to loop through each elemnt of acc_number array and compare it to AccountNumber(). This :
if(acc_number[]!=0 && acc_number[]!=AccountNumber())
means nothing since you are using an array without an array element index.
what element of acc_number array is this : "acc_number[]"?
I'm terribly sorry for my ignorance. I'm just trying to modify a messy code. I'm no coder in any way. I'm just trying to run away from inserting 20 lines in the code if I have 20 accounts, which only adds to the mess.
I'm terribly sorry for my ignorance. I'm just trying to modify a messy code. I'm no coder in any way. I'm just trying to run away from inserting 20 lines in the code if I have 20 accounts, which only adds to the mess.
aminhakim
I am trying to understand one thing. You say :
Then who is the one that wrote the EA that you want to limit to work only on certain accounts? Why don't you ask the author of the EA to do that additional coding (since he will most certainly do it in no time at all)?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello
I'm using the following part of code to lock a certain EA
bool use_demo=True;
int demo_year=2015;
int demo_month=7;
int demo_day=30;
//Account Number Lock
int acc_number=11223344;
int start() {
//demo
if(use_demo)
{
if((Year()>demo_year || (Year()==demo_year && Month()>demo_month) || (Year()==demo_year && Month()==demo_month && Day()>=demo_day)) || IsTesting())
{
Alert("License Expired, Contact Seller: example@example.com");
return(0);
}
}
//acc number
if(acc_number!=0 && acc_number!=AccountNumber())
{
Alert("EA Not Licensed For Your Account Number, Contact Seller: example@example.com");
return(0);
}
My question is how can I output an ex4 file to work on several accounts instead of producing 1 ex4 file for each account ie: 11223344, 124578, 458789, 87859.