品牌通用自定义函数-平调所有持仓单(含挂单) | 有效期至长期有效 | 最后更新2019-01-10 18:46 |
浏览次数812 |
通用自定义函数-平调所有持仓单(含挂单)
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;
} 本文标签:
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;
} 本文标签: