Code:
if (Fun_New_Bar())
{
for (int i;i<OrdersTotal();i++)
{
if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
{
OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),3);
}
}
}
void Fun_New_Bar()
{
static datetime New_Time=0;
New_Bar=false;
if(New_Time!=Time[0])
{
New_Time=Time[0];
New_Bar=true;
}
}