TradePool messing things

 
I have a function that closes all the trades opened in a buy or sell position, here it is: http://rafb.net/paste/results/jhCL1M85.html
When running testing i got thinks really weird like you can see in log line 39 and 40 when the position have his OrderSymbol() equals "", then when forced to close, his ticket number is #0 and cannot be closed.
Here is the full log: http://rafb.net/paste/results/V8knvL55.html

I am thinking this a platform bug.
 
There is your bug not platform. Use loop from end to begin
for(counter=tradePoolSize-1;counter>=0;counter--)