品牌:自定义函数 平所有持仓单(含挂单)
起订:1
供应:321
发货:1天内
发送询价
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);if(OrderSymbol()==Symbol() OrderMagicNumber()==Magic)
{j=j+1;
tick[j]=OrderTicket();
Print( 全部平仓! : ,tick[j]);
}
}
if (j!=0)
{
for(i=1;i i++)
{
OrderSelect(tick, SELECT_BY_TICKET);
if(OrderType()==OP_BUY)
{
if(OrderClose(OrderTicket(),OrderLots(),Bid,滑点可接受范围)==false)
{
PingFlag=1;
Print( 多头平仓失败 +GetLastError());
}
}
//OrderSelect(tick, SELECT_BY_TICKET);
if(OrderType()==OP_BUYSTOP)
{
if(OrderDelete(OrderTicket(),CLR_NONE)==false)
{
PingFlag=1;
Print( 多头挂单撤销失败 +GetLastError());
}
}
//OrderSelect(tick, SELECT_BY_TICKET);
if(OrderType()==OP_BUYLIMIT)
{
if(OrderDelete(OrderTicket(),CLR_NONE)==false)
{
PingFlag=1;
Print( 多头挂单撤销失败 +GetLastError());
}
}
if(OrderType()==OP_SELL)
{
if(OrderClose(OrderTicket(),OrderLots(),Ask,滑点可接受范围)==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) PingStop=1;
} 本文标签: