Cancel or delete a pending stop order

To add comments, please log in or register
Corn Elius
7
Corn Elius  
Hi. I put in a buy stop above the current price and a sell stop below the current price. Once one of them gets hit, I would like to cancel the other one. How do I do this?

Thanks.
Lagarde François
53
Lagarde François  
Cornelius127, you could try something like that :

int delorderstop()
{
int i;
for(i=0;i<OrderTotal();i++)
{
if(OrderSelect(i, SELECT_BY_POS)==true)
//OP_BUYSTOP 4 Buy stop pending position.
//OP_SELLSTOP 5 Sell stop pending position.

if(OrderType()>3)
{
OrderDelete(OrderTicket());
return(1);
}
}
return(0);
}

To add comments, please log in or register