很多下单面板里边有反手按键,就是平掉当前,反手开仓
//+-------------- 反手订单----------------------------------------------------+
int Reverse_Button (const string sparam)
{
int total=OrdersTotal();
int i = 0;
for(i = total; i >=0; i--)
{
if(OrderSelect(i,SELECT_BY_POS) && OrderSymbol()==Symbol())
{
if(OrderType()==OP_BUY)
{
ticket = OrderSend(Symbol(),OP_SELL,OrderLots()*Koeff,Bid,slip,0,0,"Reverse Sell",MagicS,0,clrNONE);
ticket = OrderClose(OrderTicket(),OrderLots(),Bid,slip,clrNONE);
PlaySound("click.wav");
SlTp();
}
else if(OrderType()==OP_SELL)
{
ticket = OrderSend(Symbol(),OP_BUY,OrderLots()*Koeff,Ask,slip,0,0,"Reverse Buy",MagicB,0,clrNONE);
ticket = OrderClose(OrderTicket(),OrderLots(),Ask,slip,clrNONE);
PlaySound("click.wav");
SlTp();
}
}
}
return(0);
} |