Hello, i need to insert in my code the account number protection, because i want to use the EA on a specific account number, i've tried but it shows me ever an error on it.
- Protect expert advisor
- How to protect my EA with multiple account number
- Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes
Angelo Speciale:
Hello, i need to insert in my code the account number protection, because i want to use the EA on a specific account number, i've tried but it shows me ever an error on it.
Hello, i need to insert in my code the account number protection, because i want to use the EA on a specific account number, i've tried but it shows me ever an error on it.
const int ACCOUNT_NUMBER = 11111111; int OnInit() { if(AccountNumber() != ACCOUNT_NUMBER) { Alert("Wrong account number: ", AccountNumber()); return(INIT_FAILED); } // ... return(INIT_SUCCEEDED); }
Vladislav Boyko #:
This is for MT4. For MT5 use AccountInfoInteger instead of AccountNumber().
And
const long ACCOUNT_NUMBER = 11111111;
instead of
const int ACCOUNT_NUMBER = 11111111;

Documentation on MQL5: Account Information / AccountInfoInteger
- www.mql5.com
AccountInfoInteger - Account Information - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
Vladislav Boyko #:
Thank you very much.
This is for MT4. For MT5 use AccountInfoInteger instead of AccountNumber().
And
instead of

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register