Hello folks.
I'm trying to make myself some kind of a code which will close orders.
Here it is:
I really don't understand the "return" parameter yet. I bet it's easy, if somebody can explain it to me different than what the help tells me. So far I just don't get it.
My concern here is that I want the programm to sleep for three seconds, if an error occurred, but I don't tell it to start over and try again. How can I do that?
Don't I have to add something like a return(-1), which afaik will make the program go back to the next outside bracket, which should be the start of this "switch"-code, right?
Thanks for your time in advance.
Greetings.
MikeFT
I'm trying to make myself some kind of a code which will close orders.
Here it is:
Inserted Code
switch(type2)
{
case OP_BUY :
case OP_SELL : result = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 5,CLR_NONE);
break;
case OP_BUYSTOP:
case OP_SELLSTOP: result = OrderDelete( OrderTicket() );
break;
}
if(result == false)
{
Alert("Order " , OrderTicket() , " failed to close. Error:" , GetLastError() );
Sleep(3000);
} My concern here is that I want the programm to sleep for three seconds, if an error occurred, but I don't tell it to start over and try again. How can I do that?
Don't I have to add something like a return(-1), which afaik will make the program go back to the next outside bracket, which should be the start of this "switch"-code, right?
Thanks for your time in advance.
Greetings.
MikeFT