關於刪除訂單的程序,請各位大大指教小弟!!!!

 

{
ticket=OrderSend(Symbol(),OP_BUYLIMIT,Lots,buy,0,0,sell,"IceBaby",0,0,Blue);
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice());
}
else Print("Error opening BUY order : ",GetLastError());
Sleep(3600000);
}
{
ticket=OrderSend(Symbol(),OP_SELLLIMIT,Lots,sell,0,0,buy,"Icebaby",0,0,Red);
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("SELL order opened : ",OrderOpenPrice());
}
else Print("Error opening SELL order : ",GetLastError());
Sleep(3600000);
}
return(0);
for(i=0; i<OrdersTotal(); i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
{
cmd=OrderType();
//---- pending orders only are considered
if(cmd!=OP_BUYLIMIT && cmd!=OP_SELLLIMIT)
{
//---- print selected order
OrderPrint();
//---- delete first pending order
result=OrderDelete(OrderTicket());
if(result!=TRUE) Print("LastError = ", GetLastError());
break;
}
}
else { Print( "Error when order select ", GetLastError()); break; }
}

return(0);
}

請問為甚麼不會刪除訂單呢???是哪錯了??

 

应该是if(cmd!=OP_BUYLIMIT && cmd!=OP_SELLLIMIT)

改成if(cmd==OP_BUYLIMIT || cmd!=OP_SELLLIMIT)吧

 
yyy999 写道 >>

应该是if(cmd!=OP_BUYLIMIT && cmd!=OP_SELLLIMIT)

改成if(cmd==OP_BUYLIMIT || cmd!=OP_SELLLIMIT)吧

謝謝指點!!