一键平仓脚本执行错误 算是老问题了 可怎么解决呢?(源码)
btclyb85
|
4688 人阅读
|
18 人评论
|
2011-11-25
牛板的一键平仓脚本全商品版 怎么都执行不了 返回错误4051或4109
到底出错在哪里?
代码稍有改动(没改动的也不行):
- int start()
- {
- int tick[200];
- int PingFlag=0,SlipPoints=3;
- int j=0;
- for(int i=0;i=0;i--)
- {
- OrderSelect(tick, SELECT_BY_TICKET);
- if(OrderType()==OP_BUY)
- {
- if(OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_BID),SlipPoints)==false)
- {
- PingFlag=1;
- Print(\"多头平仓失败\"+GetLastError());
- }
- }
- OrderSelect(tick, SELECT_BY_TICKET);
- if(OrderType()==OP_BUYSTOP)
- {
- if(OrderDelete(OrderTicket(),CLR_NONE)==false)
- {
- PingFlag=1;
- Print(\"多头挂单撤销失败\"+GetLastError());
- }
- }
- if(OrderType()==OP_BUYLIMIT)
- {
- if(OrderDelete(OrderTicket(),CLR_NONE)==false)
- {
- PingFlag=1;
- Print(\"多头挂单撤销失败\"+GetLastError());
- }
- }
- if(OrderType()==OP_SELL)
- {
- if(OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_ASK),SlipPoints)==false)
- {
- PingFlag=1;
- Print(\"空头平仓失败\"+GetLastError());
- }
- }
- if(OrderType()==OP_SELLSTOP)
- {
- if(OrderDelete(OrderTicket(),CLR_NONE)==false)
- {
- PingFlag=1;
- Print(\"空头挂单撤销失败\"+GetLastError());
- }
- }
- if(OrderType()==OP_SELLLIMIT)
- {
- if(OrderDelete(OrderTicket(),CLR_NONE)==false)
- {
- PingFlag=1;
- Print(\"空头挂单撤销失败\"+GetLastError());
- }
- }
- }
- }
- if (PingFlag==0)
- {
- Alert(\"平仓完成!\");
- }else
- {
- Alert(\"平仓不彻底,再来一次!\");
- }
- return(0);}
复制代码 |
|
|
|
|