Hey Folks,
I found this great script to delete ALL pending orders, no matter which Symbol.
Works great!
I was however trying to figure out how I tell it to delete only the pending oders from the current Symbol (the chart where I place it).
After trying for two hours I still didn't make it.
Well, I'm not a coder, just can read it more or less and sometimes modify it. In this case I couldn't.
It's a shame, especially since I guess it's a very simple mod.
Anybody able to help?
Thanks.
MikeFT
I found this great script to delete ALL pending orders, no matter which Symbol.
Works great!
I was however trying to figure out how I tell it to delete only the pending oders from the current Symbol (the chart where I place it).
After trying for two hours I still didn't make it.
Well, I'm not a coder, just can read it more or less and sometimes modify it. In this case I couldn't.
It's a shame, especially since I guess it's a very simple mod.
Anybody able to help?
Thanks.
MikeFT
Inserted Code
//+------------------------------------------------------------------+
//| close-all-orders.mq4 |
//| Copyright © 2005, Matias Romeo. |
//| Custom Metatrader Systems. |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, Matias Romeo."
#property link "mailto:matiasDOTromeoATgmail.com"
int start()
{
int total = OrdersTotal();
for(int i=total-1;i>=0;i--)
{
OrderSelect(i, SELECT_BY_POS);
int type = OrderType();
bool result = false;
switch(type)
{
//Close opened long positions
case OP_BUYSTOP : result = OrderDelete( OrderTicket());
break;
//Close opened short positions
case OP_SELLSTOP : result = OrderDelete( OrderTicket());
}
if(result == false)
{
Alert("Order " , OrderTicket() , " failed to close. Error:" , GetLastError() );
Sleep(3000);
}
}
return(0);
}