Hi
I’m not sure if I understood you correctly.
When you start the platform, or it has been just opened- the information provided by the broker (like account information) might not be uploaded fully at the beginning. Check Account Number a few moments. If you have this function in OnInit – move it to on tick (this way you are sure that account will be loaded on time)
Best Regards
Dmitry Zhakov: by login into MetaTrader via Start Up configuration file and running script, how is it possible to receive the error Invalid Account by the code?
Don't try to use any price (or indicator) or server related functions in OnInit (or on load or in OnTimer before you've received a tick), as there may be no connection/chart yet: - Terminal starts.
- Indicators/EAs are loaded. Static and globally declared variables are initialized. (Do not depend on a specific order.)
- OnInit is called.
- For indicators OnCalculate is called with any existing history.
- Human may have to enter password, connection to server begins.
- New history is received, OnCalculate called again.
- A new tick is received, OnCalculate/OnTick is called. Now TickValue, TimeCurrent, account information and prices are valid.

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
Hello,
by login into MetaTrader via Start Up configuration file and running script, how is it possible to receive the error Invalid Account by the code?
Best Regards,
Dmitry