下载MetaTrader 5
要添加评论,请登录注册
在闲置电脑上启用代理。这可以使您获利!
ice665683
55
ice665683 2008.10.23 13:24 

{
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);
}

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

yyy999
176
yyy999 2008.10.23 17:40  

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

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

ice665683
55
ice665683 2008.10.24 00:11  
yyy999 写道 >>

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

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

謝謝指點!!

/
要添加评论,请登录注册