Error number 6 - page 28

 
This is what I got yesterday. Build 183 beta of 7/10. After manual restart everything is fine.

18:29:55 TradeContext: start connection
18:29:55 'Alpari-Demo': start connection
18:29:56 '67794' - login error (6, 10054)
18:29:56 '67794': cannot login [No connection]
18:30:35 'TradeContext': start connection
18:30:35 'Alpari-Demo': start connection
18:30:35 '67794' - login error (6, 10054)
18:30:35 '67794': cannot login [No connection]
18:31:03 'TradeContext': start connection
18:31:03 'Alpari-Demo': start connection
18:31:03 '67794' - login error (6, 10054)
18:31:03 '67794': cannot login [No connection]
18:31:10 'TradeContext': start connection
18:31:10 'Alpari-Demo': start connection
18:31:10 '67794' - login error (6, 10054)
18:31:10 '67794': cannot login [No connection]
18:31:11 'TradeContext': start connection
18:31:11 'Alpari-Demo': start connection
18:31:11 '67794' - login error (6, 10054)
18:31:11 '67794': cannot login [No connection]
18:31:20 'TradeContext': start connection
18:31:20 'Alpari-Demo': start connection
18:31:20 '67794' - login error (6, 10054)
18:31:20 '67794': cannot login [No connection]
18:31:27 'TradeContext': start connection
18:31:27 'Alpari-Demo': start connection
18:31:27 '67794' - login error (6, 10054)
18:31:27 '67794': cannot login [No connection]
 
xxx
 
Results of the expert test proposed by Slava "take it from this thread and run it".
"I ran it on two computers with different versions of MT4 from 18:00 to 24:00 on 11.10.2005.
First computer: Extended Logging version dated 05.10.2005: 114 errors 146 and 1 error 138.
Second computer: official version of 07.10.2005: 278 errors number 146

Explain, Slava...
 
First comp: version with extended logging from 05.10.2005: 114 ошибок номер 146 и 1 номер 138
Second comp: official version from 07.10.2005: 278 errors number 146

Explain, Slava...

let me explain. to exclude error 146 (trade context is busy), you need to pause before releasing semaphore. instead of
if(!IsTesting()) GlobalVariableSet(strTradeSemaphore, 0.0);


write

	if(!IsTesting()) { Sleep(1000); GlobalVariableSet(strTradeSemaphore, 0.0); }


the size of the delay should be adjusted "organoleptically". it may be different for different computers

 
<br / translate="no"> the size of the delay must be adjusted "organoleptically". it may be different for different computers
Cool !
"Something in my engine started tapping
Let's hear it
And there's a gasoline smell coming from the cabin.
Let's smell it."
 
Sleep(1000); - the error has not disappeared
Sleep(10000); - the error has not disappeared
How do you make it "organoleptically"?
 
Sleep(1000); - the error has not disappeared<br / translate="no"> Sleep(10000); - the error has not disappeared
What is the "organoleptic" way to do it?

please find the value when the error disappears. report this value and send the Expert Advisor logs from the previous (still erroneous) value to stringoATmetaquotesDOTru
 
following. After some thought it turned out that there is an exact method. i will try to formulate it
while(!IsStopped() && !IsTradeAllowed()) Sleep(1000); GlobalVariableSet(strTradeSemaphore, 0.0);


i.e. we are waiting for our own trade context to be released

and this situation is extremely strange. after a trade operation is executed, the context is released instantly. otherwise it would be impossible to close positions in the loop

 
Sleep(1000); - the error has not disappeared<br/ translate="no"> Sleep(10000); - the error has not disappeared
What is it to make it "organoleptically"?

another question. don't you have other Expert Advisors that trade? they may not know anything about our trade semaphore. then error 146 is very well explainable
 
logs sent.
Where should I put this code?
while(!IsStopped() && !IsTradeAllowed()) Sleep(1000); GlobalVariableSet(strTradeSemaphore, 0.0);
Reason: