I will add that the account does not have a balance of 0.
void OnInit() { Print("OnInit: ", AccountInfoDouble(ACCOUNT_BALANCE));
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 everyone,
I'm developing an EA and upon trying to get the account balance I'm getting the value 0. Does anyone know which is the reason of this?
Here there is an example of how I'm getting a 0.
The output is the following:
Thank you very much.