Sometimes TimeCurrent() returns 1970.01.01 00:00:01
It has been fixed in 231 build.
みㄚのRタ #: its back
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.
Sometimes TimeCurrent() returns incorrect time (1970.01.01 00:00:01 or some seconds past it).
This happens rarely - only several times a day, while the TimeCurrent() is called each tick.
Is it a problem of the MT5 demo server or the TimeCurrent() function itself?