- Amini1382: when my MT5 was disconnected the expert print 4011 error
Stop using the timer. Wait for a new tick.
-
int OnInit() { //--- create timer int tick_count=CopyTicks(Symbol(),tick_array,COPY_TICKS_ALL,0,tick_num);
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.
-
Stop using the timer. Wait for a new tick.
-
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.
very thanks for your answer
you right but i have to use ontimer to control my pc cpu
can you tell me what can i do for this problem?
I want to create a bool value that will be valued True when tick is changed ( ontick() is called) , then call the ontimer. can you help me to make it?
or please help me if you have your own idea
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
hello
im sorry im not well in english language
my expert create renko closes,opens and etc and save the data in a few arrays
when my MT5 was disconnected the expert print 4011 error
my mqltick array size is 10000 and The other 14 arrays each have a size of 50
I don't understand how the size of arrays is related to internet
and few hours ago when internet was connected the error fixed automatically
now i run it again on two different chart( XAUUSD and WTI )
My expert works very well on XAUUSD chart but the other one doesn't work and gives 4011 error
can u help me to fix this problem
my code :
please help me!