'\end of program'- unbalanced paranthesis - not compiling

 
I don't know why this is not compiling. Can you help me?

int start ()

{

int ABUY, ASELL, pos;

if ( ABUY== 2 ) {
if ( ASELL>0 ) {
for(pos = OrdersTotal()-1; pos >= 0 ; pos--)
if ( OrderSelect(pos, SELECT_BY_POS) // Only my orders
&& OrderMagicNumber() == 2 // my magic number
&& OrderSymbol() == Symbol() ){ // and my pair.
if (!OrderDelete(OrderTicket())
Alert("OrderDelete(",OrderTicket(),") failed: ", GetLastError());
}
}

}

return (0);

}

 

Hi!


I strongly suggest that you make proper indentions of your code, which will make it a lot easier to find errors in the code.

See the corrected line below

// Pierre



int start ()


{

int ABUY, ASELL, pos;
if ( ABUY == 2 )
{
if ( ASELL > 0 )
{
for (pos = OrdersTotal() - 1; pos >= 0 ; pos --)
if ( OrderSelect (pos, SELECT_BY_POS) && OrderSymbol() == Symbol() )
{ // <= This parenthesis
if (!OrderDelete(OrderTicket())) // <==== You missed a ) at the end here
Alert("OrderDelete(",OrderTicket(),") failed: ", GetLastError());
} // ...and this parenthesis can be removed since there is only one line of code
}

}

return (0);

}