//---------------------------------
// Close All Trade
//--------------------------------
void CloseAllTrades()
{
//go through all open trades
for (int i=OrdersTotal(); i>=0;i--)
{
//select trade
if (OrderSelect(i, SELECT_BY_POS)==true)
{
//check if trade belongs to current chart
if(OrderSymbol()== Symbol())
{
bool Ans = OrderClose(OrderTicket(),OrderLots(), MarketInfo(OrderSymbol(), MODE_BID),5,Red);
if (Ans == true)
{
Print ("Order Close !");
}
}
}
}
}

0 comments:
Post a Comment