spgandau » Sat Apr 04, 2015 1:48 pm wrote:MurphyMan » Fri Apr 03, 2015 1:00 pm wrote:What Forex giveth, Forex taketh away. At one point I was up almost $300 on a $10,000 demo. Now, I've lost all that but $27.
..............................
..............................
2015.04.03 12:58:33.020 10.7 HGB_v01e_strict_spgandau EURUSD,H4: Inside TradeContext.mqh, TradeIsBusy(), 2nd while..loop, the waiting time in TradeIsBusy() (30 sec) was exceeded!
...........................
.........................
I have been surprised by this 2nd error enough times that I began hunting. I originally was hit by it when I modified HGBB for closealltrades, and one of the trades would not close (for other reasons) and HGBB threw this "2nd while..loop, the waiting time in TradeIsBusy() (30 sec) was exceeded!" at me.
Originally, I explained it as: (which is correct, and functions properly)
The 2nd line does throw a "fault' which seems to have been that TradeContext.mqh never received a clear signal that the trade context was free. It waited 30 seconds for the Empty4 server (broker), but the server context was never made free to make a trade. After 30 secs, TradeContext.mqh quit trying, and the trade never took place. That appears to be a server (broker) issue. It correctly showed you that an error had been thrown, and why.
HOWEVER, it still bothered me, and I just discovered the logic flaw in CloseOrder. I have modified my code as follows:
existing code:
} //---end while(counter > 0) loop
//
return(false);
MODIFY IT TO READ:
} //---end while(counter > 0) loop
//
//if pgm reaches here, trade has failed, and the counter = 0.
TradeIsNotBusy();
//--
return(false);
What happened was that the counter went to zero and the logic skipped the prior line which would have released the trade route, so it remained closed.
Also, refer to my May 27 post.
I hope this helps.
Cheer and good trading.