Issue with visual strategy tester, it stops

 

Hi all, i need some help with the strategy tester functionality.

I'm making an EA (thanks to the mql4 community!) and i'm testing it with the strategy tester in visual mode, everything goes fine until the EA enter in a cycle like a while or for(;;). The strategy tester suddenly stops

For example:

while(pending)

{

Print("cycle");

if(OrderSelect(orders[1][i], SELECT_BY_TICKET)==true)

{

if(OrderType()==OP_SELL) {pending=false;}

}

else {Print("OrderSelect returned the error of ",GetLastError());}

}

The purpose of this piece of code is to wait for the order to be trigged then exit the cycle, but the only thing it does is to keep writing "cycle" (the EA is executed properly) because the price stop at the exact point where the EA enter the cycle.

What i'm doing wrong?

Thanks for your help!

 
 
Perhaps you have a forever loop. This could happen if pending never gets set to false. And that could happen if your if(){Commands} fail or the status of the order is not OP_SELL.
 

Cocoon:

The purpose of this piece of code is to wait for

You can NOT wait in the tester, you MUST return and process the next tick.
Reason: