Hi gangsta1!
You are right. But why are you working with int if this data-type is to small for your needs?
gangsta1: 37037036730, this does not work. 10 digits for the license seems to be the limitation.
| No, the maximum value of an int (2147483647) is your limitation. |
If "int" is too limiting for you, then use a "long". Make sure that both the variables "acc" and "LicenseNumber" are both "long":
input long LicenseNumber = 37037036730; long acc = long( AccountNumber() ) * 3; if( LicenseNumber != acc ) //change to the password you give the user! { Alert ("Incorrect license number entered"); return (0); }
Alternatively use the following which returns a "long" version of the account number:
long acc = AccountInfoInteger( ACCOUNT_LOGIN ) * 3;
long acc = AccountInfoInteger( ACCOUNT_LOGIN ) * 3;
This is wrong. A int * int is an int. Then the result is expanded to a long. Same as double=int/int: On MT4 v434, division quotient don't give floating point values(Bug??) - MQL4 forum
One or the other must be lengthened, the other will automatically be.
long acc = AccountInfoInteger( ACCOUNT_LOGIN ) * Long(3);
This is wrong. A int * int is an int. Then the result is expanded to a long. Same as double=int/int: On MT4 v434, division quotient don't give floating point values(Bug??) - MQL4 forum
One or the other must be lengthened, the other will automatically be.
@WHRoeder: For your information the "AccountInfoInteger()" function is defined as returning a "long" and not a "int", as mentioned in my post. So a "long * int" is a "long"! That is the main reason why I suggested it as an alternative.
Alternatively use the following which returns a "long" version of the account number:
long acc = AccountInfoInteger( ACCOUNT_LOGIN ) * 3;
long AccountInfoInteger( int property_id // Identifier of the property );ENUM_ACCOUNT_INFO_INTEGER
Identifier
Description
Type
ACCOUNT_LOGIN
Account number
long

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
If I use my EA on a broker with a license number greater than 10 it will not work. The EA calculates the license number by multiplying the mt4 account number and this value is then entered into a "LicenseNumber" field of the inputs. For some reason, if the calculation is greater than 10 digits it wont work. Any ideas how to make this work if the license number needs to be ? 10 digits?
If account number = 15588 and is multiplied by 3 the LicenseNumber would be 31375, this works fine.
If account number = 12345678910 and is multiplied by 3 the LicenseNumber would be 37037036730, this does not work. 10 digits for the license seems to be the limitation.